OnCallReadyStart learning

iostat: Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions

iostat [ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -p [ device[,...] | ALL ] ] [ -s ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] [ --compact ] [ --dec={ 0 | 1 | 2 } ] [ { -f | +f } directory ] [ -j { ID | LABEL | PATH | UUID | ... } ] [ -o JSON ] [ [ -H ] -g group_name ] [ --human ] [ --pretty ] [ device [...] | ALL ] [ interval [ count ] ]

What it does

iostat reports the CPU summary and per-device I/O. The extended report (-x) is the one for latency: r/s rkB/s rrqm/s %rrqm r_await rareq-sz, the same for writes (w_), discards (d_) and flushes (f_), then aqu-sz and %util.

Options you will use

-x
extended statistics: r_await / w_await (average ms per request, queueing included), aqu-sz (average queue length), %util (share of time the device was busy).
-z
omit devices with no activity in the interval.
-y
omit the first report (the since-boot averages).
-c
the CPU report only.
-d
the device report only.
-p [ device | ALL ]
also the partitions.
-N
device-mapper names (ubuntu--vg-ubuntu--lv) instead of dm-0.
-t
print the time of each report.
-k | -m
kilobytes / megabytes per second.
-h
human-readable sizes (--human) and a pretty layout.
-s
a short (narrow) version of the report.
-o JSON
JSON output.
-V
print version number then exit.
interval [count]
report every INTERVAL seconds, COUNT times (no count = until Ctrl+C). The first report covers the time since boot (iostat: unless -y).

Examples

$ iostat -xz 1

extended, busy devices only, every second

$ iostat -xz -N 1

with LVM names

$ iostat -c 2 3

CPU only

Gotchas

On the blog

Try iostat in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.