iostat: A Tool for Monitoring System I/O Statistics

Functionality:
iostat is a utility used to gather and report system I/O statistics, commonly employed for analyzing disk performance.

Syntax:
iostat [options]

Overview:
In addition to I/O statistics, iostat can also display CPU usage information.

Common Options:

  • -c: Display CPU usage only.
  • -d: Show device utilization statistics only.
  • -k: Display statistics in kilobytes per second instead of blocks per second.
  • -m: Display statistics in megabytes per second.
  • -p: Display statistics for block devices and all utilized partitions.
  • -t: Display the time each report is generated.
  • -V: Display version information and exit.
  • -x: Display extended I/O statistics.

Examples:

To display the usage of all devices at the current time:

$ iostat -x
Linux 6.8.0-45-generic (Ubuntu22-VirtualBox)  2024年10月18日  _x86_64_  (2 CPU)

avg-cpu:  %user  %nice  %system  %iowait  %steal  %idle
           0.10   0.02    0.27     0.01    0.00   99.60

Device      r/s  rkB/s  rrqm/s  %rrqm  r_await  rareq-sz  w/s  wkB/s  wrqm/s  %wrqm  w_await  wareq-sz  %util
loop0      0.00   0.00    0.00   0.00    0.00     1.21   0.00    0.00   0.00   0.00    0.00     0.00    0.00
...
sda        0.30  10.96    0.10  24.42    0.35    36.60   0.51   23.23   0.64  55.59    0.41    45.13    0.02

Field Descriptions:

  • Device: Device name.
  • 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.
  • %util: Percentage of time the device was busy with I/O requests.

To display statistics for the device sda:

$ iostat -x /dev/sda
Linux 6.8.0-45-generic (Ubuntu22-VirtualBox)  2024年10月18日  _x86_64_  (2 CPU)

avg-cpu:  %user  %nice  %system  %iowait  %steal  %idle
           0.10   0.02    0.27     0.01    0.00   99.60

Device      r/s  rkB/s  rrqm/s  %rrqm  r_await  rareq-sz  w/s  wkB/s  wrqm/s  %wrqm  w_await  wareq-sz  %util
sda        0.30  10.95    0.10  24.42    0.35    36.60   0.51   23.21   0.64  55.57    0.41    45.09    0.02

To display only device usage without CPU statistics:

$ iostat -xd /dev/sda

For overall system I/O status:

$ iostat
Linux 6.8.0-45-generic (Ubuntu22-VirtualBox)  2024年10月18日  _x86_64_  (2 CPU)

avg-cpu:  %user  %nice  %system  %iowait  %steal  %idle
           0.10   0.02    0.27     0.01    0.00   99.60

Device     tps  kB_read/s  kB_wrtn/s  kB_dscd/s  kB_read  kB_wrtn  kB_dscd
loop0      0.00      0.00      0.00      0.00        17        0        0
...
sda        0.81     10.95     23.21      0.00   4791860  10157237       0

To display CPU I/O statistics only:

$ iostat -c

To display statistics in megabytes per second:

$ iostat -m

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注