Simple filesystem read/write tracing with /proc/sys/vm/block dump

Ever wondered what is hammering your disk so now and then, but couldn’t figure out with top / htop / iotop and similar? Annoying, but constant 100-200 kB/s writes? Or, simply blktrace was an overkill (or not supported by the kernel)?

To debug, try this one (setting block_dump to nonzero value enables block I/O debugging):

Note that it will cause massive output in dmesg, so consider stopping syslog.

Example output suggests it was postgresql:

Remember to stop this debugging output with (and possibly reenable syslog):

Citing kernel's Documentation/laptops/laptop-mode.txt: