Iostat

From Linuxintro
Revision as of 20:03, 25 March 2021 by ThorstenStaerk (talk | contribs) (→‎Run it)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

iostat is a program that shows how many I/O operations happen in a specified timeframe.

Install it

To install iostat, install the package sysstat. For example with SUSE Linux you open a console and enter:

yast -i sysstat

Run it

Just call IOstat plus the time interval in seconds:

# iostat 10
Linux 2.6.34.7-0.5-desktop (tweedleburg)        12/11/10        _x86_64_        (8 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.67    0.00    0.17    0.07    0.00   99.09

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sdb               1.35         5.76        28.55    1387011    6870465
sda               1.35         5.56        28.55    1337701    6870465
md126             4.26        11.32        28.38    2723674    6830024

You will get a new block every 10 seconds in this case.

Zoom in to one device, 1 second interval:
# iostat -xmt 1 -d /dev/sda
Linux 2.6.34.7-0.7-desktop (tweedleburg)        03/03/11        _x86_64_        (8 CPU)

03/03/11 08:46:33
Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.03     1.63    0.06    0.72     0.00     0.01    26.56     0.08  108.28   4.64   0.36

03/03/11 08:46:34
Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

avgrq-sz

avgrq-sz is the average request size ("blocksize") in 512 byte sectors. You can influence it with dd's iflag/oflag parameter, for example:

dd if=/dev/dm-11 of=/dev/null iflag=direct bs=64K

Note there is a max block size under /sys/block/device/queue/max_sector_kb

See also