MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

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

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

Perforce Server Disk Cleanup and Repository Size Management: A Safe, Practical Playbook

Running out of storage on a Perforce (Helix Core) server can quickly become an availability risk. This guide shows a safer cleanup workflow: measure space first, compare options, then execute changes with minimal operational risk.

Read More

Top 10 Disk Partition Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, disk partitioning is crucial for maintaining an efficient and organized storage system. Disk partition tools are essential for creating, resizing, merging, splitting, and managing…

Read More

Top 10 Disk Partition Tools: Features, Pros, Cons & Comparison

Introduction Disk Partition Tools are specialized utilities that help users create, resize, move, merge, split, format, and manage disk partitions on storage devices such as HDDs, SSDs,…

Read More

AWS Tutorials: EBS – Steps to Increase the Disk Size on a Running EC2 Instance:

you can increase the disk size of an Amazon EC2 instance while it is running. Amazon allows you to modify the size of an Elastic Block Store…

Read More

What is OCFS2 Oracle Cluster File System?

OCFS2 stands for Oracle Cluster File System version 2, which is an open-source, POSIX-compliant disk-based file system developed by Oracle Corporation. It was designed to be used…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Puja kushwaha
Puja kushwaha
1 month ago

The iostat command is most useful when you compare disk activity over time rather than rely on one reading. Pay attention to device utilization, read and write rates, and I/O wait alongside CPU data. High utilization can point to a storage bottleneck, but it does not always mean the disk is overloaded. Collecting samples during normal and busy periods helps reveal useful patterns. This makes it easier to tell whether slow performance comes from storage or another system resource.

1
0
Would love your thoughts, please comment.x
()
x