System and processes

The iostat command

Disk and CPU input/output statistics, reported at intervals you choose.

Syntax

iostat [opciones] [intervalo [cuenta]] [dispositivo...]Try it in the terminal →

Most useful options

-cShows only the CPU utilization report.
-dShows only the device report.
-xExtended statistics: r_await, w_await, %util, queues and average request sizes.
-k, -mShows rates in kilobytes per second (-k) or megabytes per second (-m).
-tPrints the time of each report.
-yOmits the first report, the one covering all the time since boot.
-zDoes not show devices with no activity during the interval.
-p [dispositivo | ALL]Includes the partitions of each disk.

Copy-ready examples

$ iostat -d 2 3three device reports, two seconds apart.
$ iostat -x sda 2 3extended statistics for disk sda. Replace sda with your disk name.
$ iostat -c -t 1 5CPU usage with the time of each report, five times, every second.
$ iostat -y -z -d -k 2 3reports from now on, without idle disks, in kilobytes per second.
$ iostat -p sda 2 3sda and all its partitions, in three reports.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
Usage: iostat [ options ] [ <interval> [ <count> ] ]You wrote an option that does not exist, or -H without -g. The list of options appears right below.Remove the extra option or check that the interval and count are whole numbers, such as iostat -d 2 3.
Invalid type of persistent device nameYou used -j with a device name type that does not exist.Use a type such as ID, LABEL, PATH or UUID, for example -j UUID.

Typical mistakes

  • The first line covers all the time since boot, not the last interval. With -y it is omitted.
  • %util near 100 suggests a saturated disk; also check r_await and w_await to see how long each request waits.
  • Without devices it shows those with activity. ALL also includes the ones never used.

Differences from similar commands

  • vmstat: gives memory, process and I/O figures for the whole system, not per disk.
  • top: shows which processes use the CPU. iostat shows CPU usage and each disk.
  • df: measures free and used space. iostat measures activity, not space.

Related commands

FAQ

Why does a report from boot appear?

Because the first report summarizes all the time since the system booted. Use -y to skip it.

What are r_await and w_await?

The average time, in milliseconds, a read or a write takes to be served, including the time it waits in the queue. Depending on the output format you will see await, which covers any request.

What is the difference between -k and -m?

Both change the unit: -k gives kilobytes per second and -m gives megabytes per second.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course