iostat


The iostat command is another tool for looking at disk throughput. Just like sar, iostat can be given the interval and count arguments. The output for the first interval contains metrics for the entire time Linux has been running. This is probably the most unique feature of iostat compared to other performance commands. The following output, from a system that is mostly idle, is a good example. You can see that the hda device has read about 9158MB (18755572*512/1024/1024) since boot up. The Blk columns are 512-byte blocks.

# iostat 5 3 Linux 2.4.21-27.EL (fisher)     04/24/2005 avg-cpu:  %user   %nice    %sys %iowait    %idle            0.47   12.72    2.18    1.16    83.47 Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read    Blk_wrtn hda               6.61        93.98       238.64   18755572    47627302 hda1              0.00         0.06         0.00      11394          78 hda2              6.60        93.83       238.53   18726682    47604696 hda3              0.01         0.09         0.11      17176       22528 hdb               0.65        66.86         0.22   13344250       44336 hdb1              0.65        66.86         0.22   13344130       44336 avg-cpu:  %user   %nice    %sys %iowait    %idle            0.00    0.00    0.20    0.00    99.80 Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read    Blk_wrtn hda               0.40         0.00        20.80          0         104 hda1              0.00         0.00         0.00          0           0 hda2              0.40         0.00        20.80          0         104 hda3              0.00         0.00         0.00          0           0 hdb               0.00         0.00         0.00          0           0 hdb1              0.00         0.00         0.00          0           0 avg-cpu:  %user   %nice    %sys %iowait    %idle            0.00    0.00    0.00     0.00  100.00 Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read    Blk_wrtn hda               0.40         0.00         8.00          0          40 hda1              0.00         0.00         0.00          0           0 hda2              0.40         0.00         8.00          0          40 hda3              0.00         0.00         0.00          0           0 hdb               0.00         0.00         0.00          0           0 hdb1              0.00         0.00         0.00          0           0


With no options, iostat only shows one set of metrics that cover the entire time since boot up.

The CPU information contains basically the same fields as top. The iostat CPU output shows the percentage of time the CPU was executing in user mode, executing niced processes, executing in kernel (system) mode, idle with processes waiting for an I/O to complete, and idle with no processes waiting. The CPU line is a summary for all CPUs.

The disk information is similar to what sar -d provides. The output contains the number of transfers per second (tps), 512-byte block reads per second (Blk_read/s), 512-byte block writes per second (Blk_wrtn/s), and the total number of 512-byte blocks read (Blk_read) and written (Blk_wrtn).

iostat offers several switches to tailor output. Some of the most useful are:

-c Display only CPU line

-d Display disk lines

-k Display disk output in kilobytes

-t Include timestamp in output

-x Include extended disk metrics in output

These options can be combined. The output from iostat -tk 5 2 is:

# iostat -tk 5 2 Linux 2.4.21-27.EL (fisher)     04/24/2005 Time: 04:34:19 PM avg-cpu:  %user   %nice    %sys %iowait    %idle            0.46   12.67    2.17    1.16    83.53 Device:            tps    kB_read/s    kB_wrtn/s    kB_read     kB_wrtn hda               6.59        46.81       118.90    9377806    23822991 hda1              0.00         0.03         0.00       5697          39 hda2              6.58        46.73       118.85    9363361    23811688 hda3              0.01         0.04         0.06       8588       11264 hdb               0.65        33.30         0.11    6672125       22168 hdb1              0.65        33.30         0.11    6672065       22168 Time: 04:34:24 PM avg-cpu:  %user   %nice    %sys %iowait    %idle            0.00    0.00    0.20    0.00    99.80 Device:            tps    kB_read/s       kB_wrtn/s    kB_read     kB_wrtn hda               0.40         0.00           10.40          0          52 hda1              0.00         0.00            0.00          0           0 hda2              0.40         0.00           10.40          0          52 hda3              0.00         0.00            0.00          0           0 hdb               0.00         0.00            0.00          0           0 hdb1              0.00         0.00            0.00          0           0




Linux Troubleshooting for System Administrators and Power Users
Real World Mac Maintenance and Backups
ISBN: 131855158
EAN: 2147483647
Year: 2004
Pages: 129
Authors: Joe Kissell

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net