Enhancing Skills

iostat: System I/O statistics, disk, and processor activity

Command: iostat

The iostat command provides detailed information about system input/output (I/O) statistics, including disk usage and CPU load. It’s useful for monitoring system performance and identifying potential bottlenecks related to I/O operations.


Sample Commands and Outputs:

  • Command: iostat Sample Command:
  $ iostat

Sample Output:

  [iostat output starts]
      avg-cpu:  %user   %nice %system %iowait  %steal   %idle
                10.53    0.00    5.14    0.30    0.00   84.03

     Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
      sda              12.34       1234.56       789.12    1234567    987654
  [iostat output ends]

Description:

  • avg-cpu: CPU usage statistics
    • %user: Percentage of CPU time spent in user space
    • %nice: Percentage of CPU time spent on processes with a positive nice value
    • %system: Percentage of CPU time spent in kernel space
    • %iowait: Percentage of CPU time spent waiting for I/O operations to complete
    • %steal: Percentage of CPU time stolen by the hypervisor from the virtual machine
    • %idle: Percentage of CPU time when the CPU is idle
  • Device: Disk I/O statistics
    • tps: Number of transfers per second
    • kB_read/s: Kilobytes read per second
    • kB_wrtn/s: Kilobytes written per second
    • kB_read: Total kilobytes read
    • kB_wrtn: Total kilobytes written

Options:

  • -d [seconds]: Set the delay between updates (e.g., iostat -d 5 updates every 5 seconds).
  • -x: Show extended statistics for devices, including I/O wait and utilization percentages.
  • -c [count]: Number of times to repeat the output (e.g., iostat -c 3).

Example with Options:

  • Command: iostat -x Sample Command:
  $ iostat -x

Sample Output:

  [iostat -x output starts]
      avg-cpu:  %user   %nice %system %iowait  %steal   %idle
                10.53    0.00    5.14    0.30    0.00   84.03

     Device:            r/s    w/s    rKB/s  wKB/s  avgrq-sz  avgqu-sz   await  svctm  %util
      sda              1.23   3.45    123.4  234.5     56.78     0.02    10.5   1.2   12.3
  [iostat -x output ends]

Description:

  • r/s: Number of read requests per second
  • w/s: Number of write requests per second
  • rKB/s: Kilobytes read per second
  • wKB/s: Kilobytes written per second
  • avgrq-sz: Average request size (in kilobytes)
  • avgqu-sz: Average queue size of the requests
  • await: Average time (in milliseconds) for I/O requests to complete
  • svctm: Average service time (in milliseconds) for I/O requests
  • %util: Percentage of time the device was busy processing I/O requests

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.