Linux Laptop Mode and /proc block_dump

Over at the
top-like command for disk io thread on GLLUG Kostas Georgiou mentioned
a Linux /proc file entry I’d never heard of before, and after
some digging it looks like it could be useful when debugging certain IO
problems. Assuming you have 2.6.6 or above - or a vendor patched kernel.

When you activate the option with a echo 1 >
/proc/sys/vm/block_dump as root (read the article and consider
turning syslog off first) the kernel starts to log which processes are
accessing which disk blocks and inodes. Below is a small chunk of its
output on my test VMWare system:

The short version is, ‘dirtied’ means changed but not written to disk, pdflush
will write the rows out later, and READs are what you’d expect. A brute
force way to trace an inode to a file path is with find: find / -inum
num. The longer explanation can be found at LJs Extending Battery
Life with Laptop Mode under the “Spinup Debugging” heading.

It’s no DTrace (and no, SystemTap isn’t as good as DTrace) but it is
neat and a decent addition to the debugging toolbox.