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:

Mar 14 19:16:44 localhost kernel: sshd(2659): dirtied inode 388836 (sshd) on sda1
Mar 14 19:16:44 localhost kernel: sshd(2659): dirtied inode 533395 ( on sda1
Mar 14 19:17:23 localhost kernel: cat(2672): dirtied inode 888805 (.bash_history) on sda1
Mar 14 19:17:46 localhost kernel: kjournald(913): WRITE block 14016 on sda1
Mar 14 19:17:48 localhost kernel: pdflush(104): WRITE block 12487672 on sda1

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.