Is there any way to find some process which is periodically writing to disk (according to hdd led) on FreeBSD 10 with ZFS (maybe turn ZFS into verbose logging mode)?

lsof and other instantly aggregating statistics utilities seems not able to catch anything due to a short time of a moment of a disk access.

  • What about using the io display of top to look for the proc that is eating your disk i/o? : top -m io -o total : freebsd.org/cgi/… – nwildner May 13 '14 at 20:53
  • its probably useful for a heavy-load processes which are mostly on top but not for those ones which activity is not coinciding with top schedule. e.g. if hdd led is constantly blinking once in a couple of seconds there is almost no chance to see smth in top as far as i tried – o_0 May 15 '14 at 12:49
up vote 9 down vote accepted

DTrace is able to report on vfs information in FreeBSD (as well as a raft of other probes). DTrace is enabled by default in the 10 kernel so all you need to do is load the module then run the dtrace script.

Load the DTrace module

kldload dtraceall

Get the vfssnoop.d script from the FreeBSD forums. The whole thread is a treasure trove for disk monitoring.

Run it:

./vfssnoop.d

Watch the output for what is accessed:

# ./vfssnoop.d 
cc1: warning:  is shorter than expected
TIMESTAMP           UID    PID PROCESS          CALL             SIZE PATH/FILE
1555479476691083      0   1225 nfsd             vop_getattr         - /share/netboot
1555479478601010      0   1225 nfsd             vop_inactive        - /share/netboot
1555479482457241      0   1225 nfsd             vop_getattr         - /share/wpad.dat
1555480557262388      0   1432 cron             vop_getattr         - /var/cron/tabs
1555480557302178      0   1432 cron             vop_inactive        - /var/cron/tabs
1555480557336414      0   1432 cron             vop_inactive        - /etc
1555480557346224      0   1432 cron             vop_getattr         - /etc/crontab
  • Holy macaroni! Thank you very much, my googling rush has finally ended) – o_0 May 14 '14 at 9:23

run: top -m io -o write -s 1

This will print out the list of processes, sorted by how much they are writing to the disk, updated every 1 second

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.