Seeing what is being written or read in real time in Linux

Have you ever wondered which processes/tasks write or read to disk in Linux?  Maybe a real time log?

It’s quite simple to enable that feature with the following command:

echo 1 >/proc/sys/vm/block_dump

The output of the command goes to /var/log/messages or /var/log/kernel.log . It depends on the distribution you are using and how your log manager is configured.

Nov  9 21:21:01 hellboy kernel: [140072.428410] bash(31632): READ block 14156776 on md126p4 (8 sectors)
Nov  9 21:21:01 hellboy kernel: [140072.443138] bash(31632): READ block 14156816 on md126p4 (8 sectors)
Nov  9 21:21:57 hellboy kernel: [140127.746763] gnome-shell(5073): WRITE block 120375776 on md126p4 (8 sectors)
Nov  9 21:21:57 hellboy kernel: [140127.765385] gnome-shell(5073): dirtied inode 3627285 (?) on md126p4
Nov  9 21:22:00 hellboy kernel: [140130.602614] nvidia-settings(31743): dirtied inode 689070 (exe) on proc

The output shows the timestamp, the process name, the operation being done (read/write/dirty inode), block or inode number and the device.

Just to take note, a dirty inode is an inode that has had new data written into it but it has not been flushed to disk.


Dropping Linux Memory Cache

A Linux server of my own executes from time to time an rsync script, which one it finishes up doing its magic, leaves behind a lot of stuff cached in memory.

In order to “make available” the memory again to other applications, I recommend reading the following as seen on

Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache…

 To use /proc/sys/vm/drop_caches, just echo a number to it.

 To free pagecache:

# echo 1 > /proc/sys/vm/drop_caches

To free directory entries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run “sync” first to flush them out to disk, these drop operations will tend to free more memory.


parted: the resulting partition is not properly aligned for best performance

Rather than explaining the problem the title says, I’ll point you to the link you must read to understand/fix it:

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.