Linux Commands – Monitoring I/O using iostat

Here are some helpful commands that will aid in debugging and investigating any issues.

Monitoring I/O via iostat
The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates.

iostat generates reports that can be used to change system configuration to better balance the input/output load between physical disks.

Various switches allow you to view specific statistics:

CPU Stats
$ iostat -c
Disk i/o Stats
$ iostat -d
Network Stats
$ iostat -n
Display I/O data in MB/sec
$ iostat -m
Display Stats for Specific Device
$ iostat -p sda # e.g. Shows stats for /dev/sda
$ iostat -x sda # e.g. Shows extended data for /dev/sda
Show Timestamps
By default iostat shows just the date, use the `-t` switch to view timestamps too:

$ iostat -t
Automatically Update Every n Seconds
Send an int as a parameter, this will be the number of seconds between updates.

$ iostat -n 2
To update every 2 seconds for only 10 times, you could do:

$ iostat -n 2 10

Leave a Reply

Your email address will not be published. Required fields are marked *