iotop - display top disk I/O events by process. .

iotop [-C] [-D|-o|-P] [-j|-Z] [-d device] [-f filename] [-m mount_point] [-t top] [interval [count]]

tracks disk I/O by process, and outputs a summary refreshed every interval. disk events that have made it past system caches.

-C don't clear the screen
-D delta times - elapsed, us
-o disk delta times, us
-P %I/O (disk delta times)
-j project ID
-Z zone ID
-d device instance name to snoop (eg, dad0)
-f filename full pathname of file to snoop
-m mount_point mountpoint for filesystem to snoop
-t top print top number only

Examples

   iotop       # Default output, summary every 5 seconds

2014 May 25 19:40:35,  load: 1.06,  disk_r:   5224 KB,  disk_w:    596 KB

  UID    PID   PPID CMD              DEVICE  MAJ MIN D            BYTES
  501    215    208 cfprefsd         ??        1   4 W            20480
    0    442      1 systemstatsd     ??        1   9 R            24576
    0    442      1 systemstatsd     ??        1   9 W           589824
  501   3328   3198 find             ??        1   4 R          5332992


-D
2014 May 25 19:52:11,  load: 1.44,  disk_r:     16 KB,  disk_w:      8 KB

  UID    PID   PPID CMD              DEVICE  MAJ MIN D          ELAPSED
  501    790    208 thunderbird      ??        1   4 W              905
    0     12      1 kextd            ??        1   9 R            11666
  501   3382    208 mdworker         ??        1   4 R            21453



-o
2014 May 25 19:55:34,  load: 1.26,  disk_r:   2524 KB,  disk_w:   1476 KB

  UID    PID   PPID CMD              DEVICE  MAJ MIN D         DISKTIME
    0     22      1 warmd            ??        1   9 W                2
  501   3419    208 mdworker         ??        1   2 R              136
  501    215    208 cfprefsd         ??        1   4 W             1429
    0      0      0                  ??        1   4               5509
  501   3412    208 Calendar         ??        1   4 W             5998
  501   3415      1 com.apple.iClou  ??        1   4 W            10674
  501   3417    208 mdworker         ??        1   2 R            13257
  501    229    208 CalendarAgent    ??        1   4 R            17903
  501    229    208 CalendarAgent    ??        1   4 W            33139
  501    231      1 com.apple.inter  ??        1   4 W            36681
    0     22      1 warmd            ??        1   9 R            49233
  501   3415      1 com.apple.iClou  ??        1   4 R           140859
  501   3418    208 mdworker         ??        1   9 R           160039
  501   3412    208 Calendar         ??        1   4 R           161921
  501   3382    208 mdworker         ??        1   2 R           206170
  501    231      1 com.apple.inter  ??        1   4 R           271523




   iotop 1          # One second samples,

   iotop -P      # %I/O (time based), 

   iotop -m /      # Snoop events on the root filesystem only,

   iotop -t 20     # top 20 lines only,

   iotop -C 5 12   #12 x 5 second samples, scrolling,

FIELDS

D direction, Read or Write
BYTES total size of operations, bytes
ELAPSED total elapsed times from request to completion, us (this is the elapsed time from the disk request (strategy) to the disk completion (iodone))
DISKTIME total times for disk to complete request, us (this is the time for the disk to complete that event since it's last event (time between iodones), or, the time to the strategy if the disk had been idle)
%I/O percent disk I/O, based on time (DISKTIME)
load 1 minute load average
disk_r read Kb for sample
disk_w write Kb for sample
UID user ID
PID process ID
PPID parent process ID
PROJ project ID
ZONE zone ID
CMD command name for the process
DEVICE device name
MAJ device major number
MIN device minor number

uses DTrace, root privileges

expect STDERR to contain: dtrace: nnn dynamic variable drops with non-empty dirty list