Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

iostat Command Guide for Linux: 20 Practical Examples for CPU and Disk I/O Troubleshooting

The iostat command helps Linux and Unix operators quickly understand CPU usage and disk I/O behavior. If you troubleshoot slow applications, storage latency, or noisy hosts, this guide gives you practical commands and a repeatable workflow.

Originally published on 2015-12-12; fully revised and updated.

iostat command examples

What iostat reports

iostat (part of the sysstat package on Linux) reports two main categories:

  • CPU statistics (overall CPU state percentages such as user, system, idle, and iowait).
  • Device I/O statistics (throughput, operation rates, queueing, and utilization for block devices and partitions).

Linux builds usually read from kernel-provided interfaces such as /proc/stat, /proc/diskstats, /proc/partitions (older kernels), and /sys.

iostat vs related system tools

ToolBest forTypical use
iostatDisk and CPU I/O viewFind busy disks, high await, high device utilization
vmstatMemory and scheduler behaviorCheck run queue, swap activity, system pressure
mpstatPer-CPU analysisDetect imbalanced CPU load and per-core hotspots
pidstatPer-process resource usageMap host-level pressure to specific processes

Install and verify iostat on Linux

On most Linux distributions, iostat is shipped by sysstat. You usually do not need a root shell for reading stats, but package installation needs elevated privileges.

# Check whether iostat is already installed
which iostat

# Show version (sysstat version)
iostat -V

# RHEL/CentOS/Amazon Linux
sudo yum install -y sysstat

# Fedora and newer RHEL-family systems
sudo dnf install -y sysstat

# Debian/Ubuntu
sudo apt-get update && sudo apt-get install -y sysstat

# RPM-based verification
rpm -qa | grep -i sysstatCode language: PHP (php)

Workflow: triage storage bottlenecks with iostat

flowchart TD
    A[Alert high app latency] --> B[Run iostat -x 1 5]
    B --> C{High await or high util}
    C -- no --> D[Check CPU memory network with mpstat vmstat]
    C -- yes --> E[Identify busiest device]
    E --> F[Correlate with process tools]
    F --> G[Apply fix tune rebalance or scale]
    G --> H[Re-run iostat and validate]

20 practical iostat commands (Linux sysstat)

The following examples are Linux-focused. Option availability can vary by sysstat version and by Unix flavor, so confirm with man iostat on your host.

#CommandPurpose
1iostatDefault CPU and device report (first report is since boot).
2iostat -cCPU statistics only.
3iostat -dDevice statistics only.
4iostat -xExtended device statistics.
5iostat -tAdd timestamp to each report.
6iostat -mShow throughput in MB/s units.
7iostat -kShow throughput in kB/s units.
8iostat 2Refresh every 2 seconds until interrupted.
9iostat 2 3Refresh every 2 seconds, 3 reports total.
10iostat -d 1 5Device-only report every second, 5 times.
11iostat -x 1 5Extended report every second, 5 times.
12iostat -p sdaShow device and partition stats for one device.
13iostat -p ALLShow all devices and partitions.
14iostat -x sda 1 5Extended stats focused on one device over time.
15iostat -NDisplay device-mapper or LVM-friendly names (if supported).
16iostat -c -dExplicitly request CPU and device sections.
17iostat -t -x -m 2 10Timestamped extended report in MB/s every 2 seconds.
18iostat -y 1 5Skip first boot-average report (if supported).
19iostat -z 1 5Hide idle devices in output (if supported).
20iostat -VShow iostat/sysstat version information.
# Example live triage session
iostat -x -m 1 10
iostat -p ALL 1 5
mpstat 1 5
vmstat 1 5Code language: PHP (php)

How to read key extended fields

Field (common names)What it indicatesTroubleshooting hint
r/s, w/sRead/write operations per secondUseful for understanding IOPS demand pattern.
rkB/s, wkB/sRead/write throughputCompare bandwidth demand across devices.
awaitAverage time for I/O completionRising await often means latency pressure.
avgqu-sz or aqu-szAverage queue depthGrowing queue with rising await suggests contention.
%utilDevice busy time percentageSustained high values can indicate saturation.
CPU %iowaitCPU time waiting on I/OHigh iowait with high disk latency points to storage bottlenecks.

Compatibility notes across Linux and Unix variants

Older tutorials often mix Linux and non-Linux iostat options. For example, some Unix variants document flags not present in current Linux sysstat builds. Always validate command syntax with the local man page before automating.

Best practices

  • Capture repeated samples (interval count) instead of relying on one snapshot.
  • Use -x during incidents to see latency and queue behavior, not just throughput.
  • Correlate host-level metrics with process-level tools (pidstat, iotop) before changing configuration.
  • Record timestamps (-t) when comparing with application and database logs.
  • Treat field names as version-dependent; confirm on each distribution baseline.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

How to Configure HTTP/HTTPS Proxy on Linux and Windows (CLI, GUI, Registry, and APT)

Set up proxy access correctly on Windows and Linux for command-line tools, package managers, and system-level use. This guide covers quick commands, persistent configuration, and common troubleshooting steps.

Read More

Linux pmap Command Guide: Inspect Process Memory Maps with Practical Examples

Learn how to use the Linux pmap command to inspect per-process memory mappings, compare output modes, and troubleshoot high memory usage quickly. This updated guide includes workflow steps, command examples, and interpretation tips.

Read More

xargs in Linux: Practical Commands, Safe Patterns, and Pipeline Workflows

This guide explains how to use xargs effectively in Linux/Unix shells, from basic stdin handling to safe file operations and parallel execution. You’ll learn practical command patterns, portability caveats, and safer alternatives.

Read More

Linux mount and umount Commands: Practical Examples, /etc/fstab, and Safe Unmounting

Learn how to mount and unmount filesystems reliably on Linux, from one-off commands to persistent /etc/fstab entries. This guide covers common filesystem types, command comparisons, and safe troubleshooting steps.

Read More

How to Use gsh to Run Linux Commands Across Multiple Servers

gsh (Group Shell) lets you execute one command across many Linux hosts from a single terminal. This guide explains host grouping with /etc/ghosts, core options, and practical command patterns.

Read More

Linux System Administrator Responsibilities: Daily Operations, Privileges, and Best Practices

Linux system administrators are responsible for server reliability, security, access control, patching, backups, and troubleshooting. This updated guide maps those responsibilities to practical workflows and command examples.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x