how to use iostat command with its examples

  • About iostat : Report CPU statistics and input/output statistics for devices
  • It comes from “sysstat-9.0.4” package.
  • Configuration Files:
           /proc/stat – It contains system statistics.
           /proc/uptime – It contains system uptime.
           /proc/partitions – It contains disk statistics (for pre 2.5 kernels that have been patched).
           /proc/diskstats – It contains disks statistics (for post 2.5 kernels).
           /sys – It contains statistics for block devices (post 2.5 kernels).
           /proc/self/mountstats – It contains statistics for network filesystems.

iostat generates three types of reports,

  • CPU Utilization report
  • Device Utilization report
  • Network File system report.

Examples:

To get the CPU utilization

$ iostat -c
$ iostat -c 2 10         (With delay of 2 seconds and 10 iterations)

 To get the device utilization

$ iostat -d
$ iostat -d 2 10         (With delay of 2 seconds and 10 iterations) 

 To display the human readable NFS IO stats

$ iostat -nh
$ iostat -n -h 2 10         (With delay of 2 seconds and 10 iterations)

To display the stats in kilo bytes instead of bytes/second

$ iostat -k 
$ iostat -k 2 10         (With delay of 2 seconds and 10 iterations)

To display the stats in mega bytes instead of bytes/second

$ iostat -m 
$ iostat -m 2 10         (With delay of 2 seconds and 10 iterations)

To display the registered device mapper names

$ iostat -N 
$ iostat -N 2 10         (With delay of 2 seconds and 10 iterations)

To display the NFS reports

$ iostat -n 
$ iostat -n 2 10         (With delay of 2 seconds and 10 iterations)

To display the stats for block devices and their partitions

$ iostat -p 
$ iostat -p 2 10         (With delay of 2 seconds and 10 iterations)

 To get the time for each report displayed

$ iostat -t 
$ iostat -t 2 10         (With delay of 2 seconds and 10 iterations)

To get the version number

$ iostat -V 
$ iostat -V 2 10         (With delay of 2 seconds and 10 iterations)

To display the extended statistics

$ iostat -x
$ iostat -x sda
$ iostat -x sda 2 5         (With delay of 2 seconds and 10 iterations)

To tell iostat to omit the output

$ iostat -z 
$ iostat -z 2 10         (With delay of 2 seconds and 10 iterations)

Related Commands: sar, pidstat, mpstat, vmstat 

Leave a Reply

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