LinuxCommandLibrary

iostat

Report CPU and I/O statistics

TLDR

Display a report of CPU and disk statistics since system startup

$ iostat
copy

Display a report of CPU and disk statistics with units converted to megabytes
$ iostat -m
copy

Display CPU statistics
$ iostat [[-c|--compact]]
copy

Display disk statistics with disk names (including LVM)
$ iostat -N
copy

Display extended disk statistics with disk names for device "sda"
$ iostat -xN [sda]
copy

Display incremental reports of CPU and disk statistics every 2 seconds
$ iostat [2]
copy

SYNOPSIS

iostat [options] [interval] [count]

PARAMETERS

-c, --cpu
    Display CPU utilization report

-d, --comm
    Display device utilization report (default)

-g, --group
    Display statistics per group of devices

-h, --human
    Print sizes in human readable format (e.g., 1.0k)

-k
    Display statistics in kilobytes per second

-m
    Display statistics in megabytes per second

-N, --nodename
    Display device node names rather than names

-n
    Do not display device state flags

-p device[,device...]|ALL|SUMMARY
    Display statistics for specific devices/partitions

-t
    Print timestamps on each report

-V, --version
    Print version information

-x, --extended
    Display extended statistics

-y
    Do not reset statistics on first report

-z, --zero
    Omit devices with zero activity

interval
    Report repeatedly; seconds between reports

count
    Limit reports to this number

DESCRIPTION

iostat is a powerful command-line tool for monitoring system performance, particularly CPU utilization and block device I/O statistics. It provides insights into average CPU usage across user, system, I/O wait, and idle times, as well as detailed metrics for disks and partitions like transfers per second (tps), read/write kilobytes per second, and average wait/service times.

By default, iostat displays a single summary since system boot. When invoked with an interval (e.g., iostat 5), it reports statistics repeatedly every 5 seconds, making it ideal for real-time performance analysis. Extended stats (-x) reveal bottlenecks via metrics like %util (device utilization) and await (average request time).

Part of the sysstat package, it's essential for system administrators troubleshooting high I/O latency, identifying overloaded disks, or tuning workloads in servers, virtualization, or cloud environments. Output is tabular, customizable with units (KB/MB) and filters for specific devices.

CAVEATS

Requires sysstat package installation. Extended stats (-x) may need root privileges for full accuracy. Does not work on all filesystems; interval/count positional args only apply without -p.

EXAMPLE

iostat -dx 2 3
Extended device stats every 2s, 3 reports.

KEY OUTPUT FIELDS

CPU: user, sys, iowait, %idle.
Device: tkps (transfers/s), rkB/s, wkB/s, await, %util.

HISTORY

Originated in AT&T System V Unix. Integrated into Linux sysstat package by Sebastien Godard in 1999; actively maintained with support for modern filesystems and NVMe devices.

SEE ALSO

sar(1), vmstat(8), mpstat(1), pidstat(1), iotop(1)

Copied to clipboard