# iostat — Report CPU and Disk I/O Statistics

> Practical guide to iostat — measure CPU usage and disk I/O, spot bottlenecks via await, %util and aqu-sz. Part of the sysstat package.

Source: https://www.jpkc.com/db/en/cheatsheets/shell-system/iostat/

<!-- PROSE:intro -->
iostat gives you a single-glance view of how hard your CPU and storage devices are working – perfect for spotting I/O bottlenecks before they slow your applications down. The tool ships with the `sysstat` package and often has to be installed first. One thing to remember: the very first report is always an average since the last boot, so for current values you measure with an interval, e.g. `iostat -xz 2`. This guide takes you from the basics to the extended metrics such as `%util`, `await` and `aqu-sz`.
<!-- PROSE:intro:end -->

## Basic Usage

`iostat` — Show CPU and disk I/O statistics since boot.

```bash
iostat
```

`iostat INTERVAL` — Show statistics every INTERVAL seconds, continuously.

```bash
iostat 2
```

`iostat INTERVAL COUNT` — Show statistics every INTERVAL seconds, COUNT times.

```bash
iostat 2 10
```

`iostat -h` — Human-readable output with unit suffixes.

```bash
iostat -h
```

## CPU Statistics

`iostat -c` — Show only CPU statistics.

```bash
iostat -c 1
```

`iostat -c 1 5` — Quick CPU utilization snapshot (five reports, one per second).

```bash
iostat -c 1 5
```

## Disk Statistics

`iostat -d` — Show only disk I/O statistics.

```bash
iostat -d
```

`iostat -d DEVICE` — Show statistics for a specific device.

```bash
iostat -d sda
```

`iostat -d DEVICE1 DEVICE2` — Show statistics for multiple devices.

```bash
iostat -d sda nvme0n1
```

`iostat -p DEVICE` — Show statistics for a device and all its partitions.

```bash
iostat -p sda
```

`iostat -p ALL` — Show statistics for all devices and partitions.

```bash
iostat -p ALL
```

## Extended Statistics

`iostat -x` — Show extended statistics: `await`, `%util`, queue sizes and more.

```bash
iostat -x
```

`iostat -xd INTERVAL` — Extended disk statistics at regular intervals. Most common usage.

```bash
iostat -xd 1
```

`iostat -xd DEVICE INTERVAL` — Extended stats for a specific device.

```bash
iostat -xd sda 2
```

`iostat -x -t` — Extended stats with timestamps.

```bash
iostat -x -t 1
```

## Output Options

`iostat -k` — Show statistics in kilobytes per second.

```bash
iostat -k
```

`iostat -m` — Show statistics in megabytes per second.

```bash
iostat -m
```

`iostat -t` — Print timestamps with each report.

```bash
iostat -t 1
```

`iostat -y INTERVAL` — Skip the first (since-boot) report. Show only interval data.

```bash
iostat -y 1
```

`iostat -z` — Omit inactive devices from output.

```bash
iostat -z 1
```

`iostat -o JSON` — Output in JSON format.

```bash
iostat -o JSON 1 3
```

`iostat -N` — Show device mapper names for LVM volumes.

```bash
iostat -N
```

## Key Metrics Explained

`tps` — Transfers per second (I/O requests). Combined read + write operations.

`kB_read/s, kB_wrtn/s` — Kilobytes read/written per second.

`r/s, w/s` — Read/write requests per second (extended mode).

`rkB/s, wkB/s` — Kilobytes read/written per second (extended mode).

`await` — Average time (ms) for I/O requests. Includes queue time + service time.

`r_await, w_await` — Average time (ms) for read/write requests separately.

`aqu-sz` — Average queue size. High values indicate I/O saturation.

`%util` — Percentage of time the device was busy serving I/O requests. 100% = saturated.

`rareq-sz, wareq-sz` — Average read/write request size in kilobytes.

## Common Patterns

`iostat -xdm 1` — Real-time extended disk monitoring in MB/s. The go-to command for I/O analysis.

```bash
iostat -xdm 1
```

`iostat -xd 1 | awk '$NF > 80'` — Watch for disks with utilization above 80%.

```bash
iostat -xd 1 | awk '$NF > 80'
```

`iostat -xdm -y 1 60 > iostat.log` — Log 60 seconds of I/O stats (skip boot average).

```bash
iostat -xdm -y 1 60 > iostat.log
```

<!-- PROSE:outro -->
## Conclusion

iostat is a read-only command – it changes nothing on your system, so you can run it safely on production servers. For everyday work, the one pattern worth memorising is `iostat -xz 2`: it hides inactive devices, prints the extended metrics and measures real interval values instead of the since-boot average. Watch `%util` (device saturation), `await` (response time including queueing) plus `r/s`/`w/s` and `aqu-sz`. Note that on modern SSDs and NVMe drives a high `%util` alone doesn't necessarily mean a bottleneck – they handle many requests in parallel, so always read `await` and `aqu-sz` alongside it.

## Further Reading

- [iostat(1) man page](https://man7.org/linux/man-pages/man1/iostat.1.html) – official reference for all options and metrics
- [sysstat project](https://github.com/sysstat/sysstat) – source and documentation for the sysstat package
<!-- PROSE:outro:end -->

## Related Commands

- [vmstat](https://www.jpkc.com/db/en/cheatsheets/shell-system/vmstat/) – overview of memory, process and I/O statistics
- [top](https://www.jpkc.com/db/en/cheatsheets/shell-system/top/) – watch processes and system load in real time
- [free](https://www.jpkc.com/db/en/cheatsheets/shell-system/free/) – show free and used memory

