1The following are demonstrations of the iotop program,
2
3
4Here we run iotop with the -C option to not clear the screen, but instead
5provide a scrolling output,
6
7   # iotop -C
8   Tracing... Please wait.
9   2005 Jul 16 00:34:40,  load: 1.21,  disk_r:  12891 KB,  disk_w:   1087 KB
10   
11     UID    PID   PPID CMD              DEVICE  MAJ MIN D            BYTES
12       0      3      0 fsflush          cmdk0   102   4 W              512
13       0      3      0 fsflush          cmdk0   102   0 W            11776
14       0  27751  20320 tar              cmdk0   102  16 W            23040
15       0      3      0 fsflush          cmdk0   102   0 R            73728
16       0      0      0 sched            cmdk0   102   0 R           548864
17       0      0      0 sched            cmdk0   102   0 W          1078272
18       0  27751  20320 tar              cmdk0   102  16 R          1514496
19       0  27751  20320 tar              cmdk0   102   3 R         11767808
20   
21   2005 Jul 16 00:34:45,  load: 1.23,  disk_r:  83849 KB,  disk_w:    488 KB
22   
23     UID    PID   PPID CMD              DEVICE  MAJ MIN D            BYTES
24       0      0      0 sched            cmdk0   102   4 W             1536
25       0      0      0 sched            cmdk0   102   0 R           131072
26       0  27752  20320 find             cmdk0   102   0 R           262144
27       0      0      0 sched            cmdk0   102   0 W           498176
28       0  27751  20320 tar              cmdk0   102   3 R         11780096
29       0  27751  20320 tar              cmdk0   102   5 R         29745152
30       0  27751  20320 tar              cmdk0   102   4 R         47203328
31   
32   2005 Jul 16 00:34:50,  load: 1.25,  disk_r:  22394 KB,  disk_w:      2 KB
33   
34     UID    PID   PPID CMD              DEVICE  MAJ MIN D            BYTES
35       0  27752  20320 find             cmdk0   102   0 W             2048
36       0      0      0 sched            cmdk0   102   0 R            16384
37       0    321      1 automountd       cmdk0   102   0 R            22528
38       0  27752  20320 find             cmdk0   102   0 R          1462272
39       0  27751  20320 tar              cmdk0   102   5 R         17465344
40
41In the above output, we can see a tar command is reading from the cmdk0 
42disk, from several different slices (different minor numbers), on the last
43report focusing on 102,5 (an "ls -lL" in /dev/dsk can explain the number to
44slice mappings).
45
46The disk_r and disk_w values give a summary of the overall activity in 
47bytes.
48
49
50
51Bytes can be used as a yardstick to determine which process is keeping the
52disks busy, however either of the delta times available from iotop would 
53be more accurate (as they take into account whether the activity is random 
54or sequential).  
55
56   # iotop -Co
57   Tracing... Please wait.
58   2005 Jul 16 00:39:03,  load: 1.10,  disk_r:   5302 KB,  disk_w:     20 KB
59   
60     UID    PID   PPID CMD              DEVICE  MAJ MIN D         DISKTIME
61       0      0      0 sched            cmdk0   102   0 W              532
62       0      0      0 sched            cmdk0   102   0 R           245398
63       0  27758  20320 find             cmdk0   102   0 R          3094794
64   
65   2005 Jul 16 00:39:08,  load: 1.14,  disk_r:   5268 KB,  disk_w:    273 KB
66   
67     UID    PID   PPID CMD              DEVICE  MAJ MIN D         DISKTIME
68       0      3      0 fsflush          cmdk0   102   0 W             2834
69       0      0      0 sched            cmdk0   102   0 W           263527
70       0      0      0 sched            cmdk0   102   0 R           285015
71       0      3      0 fsflush          cmdk0   102   0 R           519187
72       0  27758  20320 find             cmdk0   102   0 R          2429232
73   
74   2005 Jul 16 00:39:13,  load: 1.16,  disk_r:    602 KB,  disk_w:   1238 KB
75   
76     UID    PID   PPID CMD              DEVICE  MAJ MIN D         DISKTIME
77       0      3      0 fsflush          cmdk0   102   4 W              200
78       0      3      0 fsflush          cmdk0   102   6 W              260
79       0      3      0 fsflush          cmdk0   102   0 W              883
80       0  27758  20320 find             cmdk0   102   0 R            55686
81       0      3      0 fsflush          cmdk0   102   0 R           317508
82       0      0      0 sched            cmdk0   102   0 R           320195
83       0      0      0 sched            cmdk0   102   0 W           571084
84   [...]
85
86The disk time is in microseconds. In the first sample, we can see the find
87command caused a total of 3.094 seconds of disk time - the duration of the
88samples here is 5 seconds (the default), so it would be fair to say that
89the find command is keeping the disk 60% busy.
90
91
92
93A new option for iotop is to print percents "-P" which are based on disk
94I/O times, and hense are a fair measurementt of what is keeping the disks
95busy.
96
97   # iotop -PC 1
98   Tracing... Please wait.
99   2005 Nov 18 15:26:14,  load: 0.24,  disk_r:  13176 KB,  disk_w:      0 KB
100   
101     UID    PID   PPID CMD              DEVICE  MAJ MIN D   %I/O
102       0   2215   1663 bart             cmdk0   102   0 R     85
103   
104   2005 Nov 18 15:26:15,  load: 0.25,  disk_r:   5263 KB,  disk_w:      0 KB
105   
106     UID    PID   PPID CMD              DEVICE  MAJ MIN D   %I/O
107       0   2214   1663 find             cmdk0   102   0 R     15
108       0   2215   1663 bart             cmdk0   102   0 R     67
109   
110   2005 Nov 18 15:26:16,  load: 0.25,  disk_r:   8724 KB,  disk_w:      0 KB
111   
112     UID    PID   PPID CMD              DEVICE  MAJ MIN D   %I/O
113       0   2214   1663 find             cmdk0   102   0 R     10
114       0   2215   1663 bart             cmdk0   102   0 R     71
115   
116   2005 Nov 18 15:26:17,  load: 0.25,  disk_r:   7528 KB,  disk_w:      0 KB
117   
118     UID    PID   PPID CMD              DEVICE  MAJ MIN D   %I/O
119       0   2214   1663 find             cmdk0   102   0 R      0
120       0   2215   1663 bart             cmdk0   102   0 R     85
121   
122   2005 Nov 18 15:26:18,  load: 0.26,  disk_r:  11389 KB,  disk_w:      0 KB
123   
124     UID    PID   PPID CMD              DEVICE  MAJ MIN D   %I/O
125       0   2214   1663 find             cmdk0   102   0 R      2
126       0   2215   1663 bart             cmdk0   102   0 R     80
127   
128   2005 Nov 18 15:26:19,  load: 0.26,  disk_r:  22109 KB,  disk_w:      0 KB
129   
130     UID    PID   PPID CMD              DEVICE  MAJ MIN D   %I/O
131       0   2215   1663 bart             cmdk0   102   0 R     76
132   
133   ^C
134
135In the above output, bart and find jostle for disk access as they create
136a database of file checksums. The command was,
137
138	find / | bart create -I > /dev/null
139
140Note that the %I/O is in terms of 1 disk. A %I/O of say 200 is allowed - it
141would mean that effectively 2 disks were at 100%, or 4 disks at 50%, etc.
142
143