10

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.

2
  • 1
    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/…
    – user34720
    May 13, 2014 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, 2014 at 12:49

2 Answers 2

9

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
1
  • Holy macaroni! Thank you very much, my googling rush has finally ended)
    – o_0
    May 14, 2014 at 9:23
8

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .