Skip to main content

iostat — Disk I/O Statistics

iostat reports CPU and disk I/O statistics, including throughput and (with extended mode) useful latency/utilization fields. Use it when WordPress pages are slow and you suspect storage is the bottleneck (slow database writes, heavy backups, log storms). High %util and high await during the problem window are common signals of I/O saturation.

Quick Summary

Run iostat -xz 1 5 during a slow period. Look for high await and %util on the device backing /var/www or /var/lib/mysql.

Mental Model

Prerequisites

iostat is provided by the sysstat package.

Install it:

install-sysstat-apt.sh
sudo apt update
sudo apt install -y sysstat

Verify:

verify-iostat-installed.sh
which iostat
iostat -V

Core Syntax

iostat-syntax.sh
iostat [options] [interval [count]]

Key Options

OptionWhat it doesExampleWordPress / VPS use case
-xExtended stats (latency/util)iostat -xNeeded for await and %util
-zHide idle devicesiostat -xz 1 5Reduce noise
-ySkip first reportiostat -y -xz 1 5First report is since boot
-dDevice report onlyiostat -dx 1 5Focus on disks
-cCPU report onlyiostat -c 1 5CPU vs disk triage
-p ALLInclude partitionsiostat -xz -p ALL 1 5Identify a hot partition
-mMB/s unitsiostat -xm 1 5Easier throughput reading
-tAdd timestampiostat -xz -t 1 5Correlate with logs
-o JSONJSON outputiostat -o JSON 1 1Automation

Examples (Commands + Expected Output)

Output varies

Field names can vary by sysstat version and kernel.

Basic report

iostat-basic.sh
iostat

Expected output:

example-output-iostat-basic.txt
avg-cpu: %user %nice %system %iowait %steal %idle
10.00 0.00 3.00 1.00 0.00 86.00

Device tps kB_read/s kB_wrtn/s
sda 20.0 120.0 240.0

Use case: Quick split between CPU usage and disk activity.

iostat-extended-sampling.sh
iostat -xz 1 3

Expected output:

example-output-iostat-xz.txt
Device r/s w/s rkB/s wkB/s await %util
sda 5.0 15.0 120.0 240.0 8.0 60.0

Use case: Check latency (await) and saturation (%util) while WordPress is slow.

Devices only (no CPU section)

iostat-devices-only.sh
iostat -dx 1 3

Expected output:

example-output-iostat-dx.txt
Device r/s w/s rkB/s wkB/s await %util
sda 5.0 15.0 120.0 240.0 8.0 60.0

Use case: Focus on storage during disk bottleneck triage.

Include partitions

iostat-partitions.sh
iostat -xz -p ALL 1 3

Expected output:

example-output-iostat-partitions.txt
Device r/s w/s rkB/s wkB/s await %util
sda1 4.0 10.0 100.0 200.0 7.0 55.0
sda2 1.0 5.0 20.0 40.0 12.0 70.0

Use case: Identify which partition is hot (WordPress vs database vs logs).

Add timestamps

iostat-with-timestamps.sh
iostat -xz -t 1 3

Expected output:

example-output-iostat-timestamps.txt
03/01/2026 10:40:01
Device r/s w/s rkB/s wkB/s await %util
sda 5.0 15.0 120.0 240.0 8.0 60.0

Use case: Correlate I/O spikes with cron jobs and backups.

JSON output

iostat-json-output.sh
iostat -o JSON 1 1

Expected output:

example-output-iostat-json.txt
{"sysstat":{"hosts":[{"statistics":[{"disk":[{"disk_device":"sda","await":8.0,"util":60.0}]}]}]}}}

Use case: Parse in automation.

WordPress VPS Use Cases

SymptomWhat to watchCommandInterpretation
Slow page loadsHigh await and %utiliostat -xz 1 5Disk is saturated or slow
Slow DB queriesHot DB device/partitioniostat -xz -p ALL 1 5Database volume is bottleneck
Backups cause site slowdownI/O spikes during backup windowiostat -xz -t 1 20Schedule/limit backups

Troubleshooting

ProblemLikely causeFix
iostat: command not foundsysstat not installedInstall sysstat
Misleading first reportFirst output is since bootUse -y or look at later samples
High await but low %utilDevice latency or queue behaviorSample longer; correlate with workload

Best Practices

  • Sample multiple times (interval count) and focus on trends.
  • Pair iostat with findmnt -T PATH to confirm which device backs the path you're troubleshooting.
  • If %util stays near 100% during slow periods, consider faster storage or workload reduction.
Cheat Sheet
iostat-cheat-sheet.sh
iostat
iostat -xz 1 5
iostat -y -xz 1 5
iostat -dx 1 5
iostat -xz -p ALL 1 5
iostat -xz -t 1 5
iostat -o JSON 1 1

What's Next