iostat Command Examples

Input/Output Statistics and Performance Monitoring

About iostat Command

The iostat command is a powerful system monitoring tool that reports CPU statistics and input/output statistics for block devices and partitions. Part of the sysstat package, iostat is essential for system administrators and performance analysts to identify I/O bottlenecks, monitor disk performance, and optimize system resource utilization.

Originally developed in the 1980s for Unix systems, iostat provides real-time and historical views of how your storage devices are performing. It displays metrics like read/write operations per second, throughput in KB/s or MB/s, average wait times, and device utilization percentages. This information is crucial for diagnosing slow system performance, identifying overloaded disks, and planning capacity upgrades. iostat is indispensable for database servers, file servers, and any system where disk I/O performance is critical.

Installation Note

iostat is part of the sysstat package. If not installed:

Debian/Ubuntu: sudo apt install sysstat
RHEL/CentOS/Fedora: sudo yum install sysstat or sudo dnf install sysstat
Arch Linux: sudo pacman -S sysstat

Example 1: Basic iostat Output
Running iostat without options provides a snapshot of CPU and disk I/O statistics since system boot. This gives you an overview of average system performance.
iostat
Linux 5.15.0-91-generic (webserver) 11/06/2024 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 8.45 0.02 2.31 0.87 0.00 88.35 Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd sda 12.45 145.23 287.56 0.00 5234567 10378942 0 sdb 3.21 45.67 12.34 0.00 1645892 445123 0 nvme0n1 25.78 456.89 891.23 0.00 16478923 32145678 0

Understanding Basic Output:

  • avg-cpu section: CPU utilization breakdown since boot
  • %user: Time spent running user applications (non-kernel code)
  • %nice: Time spent on low-priority (nice'd) processes
  • %system: Time spent in kernel space
  • %iowait: Time CPU was idle waiting for I/O (HIGH values indicate disk bottleneck)
  • %steal: Time "stolen" by hypervisor for other VMs (virtualization overhead)
  • %idle: Time CPU spent idle with no I/O wait
  • tps: Transfers (I/O operations) per second
  • kB_read/s: Kilobytes read per second
  • kB_wrtn/s: Kilobytes written per second
  • kB_dscd/s: Kilobytes discarded per second (SSD TRIM operations)
  • Total counters: Cumulative KB read/written/discarded since boot
Performance Alert: High %iowait (>20%) suggests disk I/O bottleneck. Check which processes with iotop and which disks with iostat -x.
Example 2: Extended Statistics (-x)
The -x option displays extended statistics including service times, queue lengths, and utilization percentages - critical metrics for performance analysis.
iostat -x
Linux 5.15.0-91-generic (webserver) 11/06/2024 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 8.45 0.02 2.31 0.87 0.00 88.35 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 8.23 4.22 145.23 287.56 0.45 2.34 5.19 35.67 2.45 5.67 0.05 17.65 68.12 1.23 1.52 sdb 2.15 1.06 45.67 12.34 0.12 0.34 5.29 24.29 1.87 3.45 0.01 21.24 11.64 0.89 0.29 nvme0n1 18.34 7.44 456.89 891.23 1.23 3.45 6.28 31.68 0.45 1.23 0.02 24.91 119.79 0.34 0.87

Extended Metrics Explained:

  • r/s, w/s: Read/write requests per second (IOPS)
  • rkB/s, wkB/s: Kilobytes read/written per second (throughput)
  • rrqm/s, wrqm/s: Read/write requests merged per second (I/O scheduler efficiency)
  • %rrqm, %wrqm: Percentage of requests merged before dispatch to device
  • r_await, w_await: Average time (ms) for read/write requests (includes queue + service time)
  • aqu-sz: Average queue size (requests waiting for device)
  • rareq-sz, wareq-sz: Average request size in kilobytes
  • svctm: Average service time in milliseconds (DEPRECATED metric)
  • %util: Device utilization percentage (>80% suggests saturation)
Bottleneck Detection: High %util (>80%) + high await (>20ms) = saturated disk. NVMe shows excellent performance: 0.45ms read, 1.23ms write awaits vs SATA's 2.45ms/5.67ms.
Example 3: Continuous Monitoring with Interval
Adding an interval argument makes iostat display statistics continuously, refreshing at the specified interval. Essential for real-time monitoring.
iostat -x 2
Linux 5.15.0-91-generic (webserver) 11/06/2024 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 8.45 0.02 2.31 0.87 0.00 88.35 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 8.23 4.22 145.23 287.56 0.45 2.34 5.19 35.67 2.45 5.67 0.05 17.65 68.12 1.23 1.52 avg-cpu: %user %nice %system %iowait %steal %idle 12.34 0.00 3.45 1.23 0.00 82.98 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 15.50 8.00 234.50 512.00 0.50 4.50 3.13 36.00 3.20 7.80 0.12 15.13 64.00 1.45 3.42 avg-cpu: %user %nice %system %iowait %steal %idle 10.23 0.00 2.89 0.45 0.00 86.43 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 7.00 3.50 112.00 224.00 0.25 1.75 3.45 33.33 2.10 4.20 0.03 16.00 64.00 1.15 1.21
iostat -x 5 3
(Displays extended stats every 5 seconds, 3 times total, then exits)

Interval Monitoring:

  • Syntax: iostat [options] interval [count]
  • First report: Shows averages since boot (historical baseline)
  • Subsequent reports: Show statistics for just that interval (current activity)
  • Interval only: Runs continuously until Ctrl+C
  • Interval + count: Runs specified number of times then exits
  • Real-time analysis: Watch %util, await, and IOPS during load tests
  • Performance testing: Start iostat before running benchmarks
  • Pattern detection: Identify periodic spikes or sustained high load
Load Testing: Run iostat -x 2 in one terminal while running benchmarks in another. Watch for %util spikes and increased await times indicating bottlenecks.
Example 4: Specific Device Monitoring
You can monitor specific devices by listing them after the interval. This focuses output on devices of interest, reducing clutter.
iostat -x sda nvme0n1 2
Linux 5.15.0-91-generic (webserver) 11/06/2024 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 8.45 0.02 2.31 0.87 0.00 88.35 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 8.23 4.22 145.23 287.56 0.45 2.34 5.19 35.67 2.45 5.67 0.05 17.65 68.12 1.23 1.52 nvme0n1 18.34 7.44 456.89 891.23 1.23 3.45 6.28 31.68 0.45 1.23 0.02 24.91 119.79 0.34 0.87
iostat -x -p sda 2
Linux 5.15.0-91-generic (webserver) 11/06/2024 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 8.45 0.02 2.31 0.87 0.00 88.35 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 8.23 4.22 145.23 287.56 0.45 2.34 5.19 35.67 2.45 5.67 0.05 17.65 68.12 1.23 1.52 sda1 1.23 0.45 18.34 12.45 0.05 0.12 3.90 21.05 1.87 3.21 0.01 14.91 27.67 0.98 0.18 sda2 6.89 3.67 125.67 273.89 0.39 2.19 5.36 37.37 2.56 5.89 0.04 18.23 74.66 1.28 1.32 sda3 0.11 0.10 1.22 1.22 0.01 0.03 8.33 23.08 3.45 8.90 0.00 11.09 12.20 2.10 0.02

Device-Specific Monitoring:

  • Specific devices: List device names (sda, sdb, nvme0n1) after options
  • -p flag: Show partition statistics in addition to whole device
  • Partition detail: See which partitions are most active on a disk
  • Focus monitoring: Eliminate noise from unused devices
  • Database optimization: Monitor partition where database files reside
  • Multi-disk systems: Compare performance across different storage tiers
  • Performance comparison: SATA (sda) vs NVMe side-by-side
  • Troubleshooting: Identify which specific partition causing I/O issues
Database Servers: Monitor only the partition with database files: iostat -x -p sda 5. Focus on sda2 if that's where /var/lib/mysql or /var/lib/postgresql resides.
Example 5: Human-Readable Output (-h)
The -h flag displays statistics in human-readable format using K, M, G units instead of raw kilobytes, making output easier to interpret quickly.
iostat -xh
Linux 5.15.0-91-generic (dbserver) 11/06/2024 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 15.23 0.00 4.56 3.21 0.00 77.00 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 45.23 32.45 2.5M 8.3M 2.34 12.45 4.92 27.72 3.45 8.90 0.35 56.6k 261.9k 2.34 18.23 nvme0n1 234.56 156.78 18.9M 45.6M 15.67 45.23 6.26 22.39 0.67 1.89 0.12 82.5k 297.8k 0.45 17.89
iostat -xhm
Linux 5.15.0-91-generic (dbserver) 11/06/2024 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 15.23 0.00 4.56 3.21 0.00 77.00 Device r/s w/s rMB/s wMB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 45.23 32.45 2.45 8.12 2.34 12.45 4.92 27.72 3.45 8.90 0.35 55.3k 255.8k 2.34 18.23 nvme0n1 234.56 156.78 18.45 44.53 15.67 45.23 6.26 22.39 0.67 1.89 0.12 80.5k 291.0k 0.45 17.89

Human-Readable Format:

  • -h flag: Automatic unit scaling (k, M, G) for easy reading
  • -m flag: Force megabytes per second (MB/s) instead of kilobytes
  • -k flag: Force kilobytes (default, useful to override -m)
  • Throughput clarity: "18.9M" much clearer than "18,900 kB/s"
  • Quick assessment: Instantly see if you're doing MB/s or GB/s
  • Reports and dashboards: More presentation-friendly output
  • Request sizes: Also shown in human-readable format (56.6k vs 56,600 bytes)
  • Comparison: Easier to spot differences between devices
Performance Baseline: Modern SSDs: 500+ MB/s typical. NVMe: 1-7 GB/s. HDDs: 100-200 MB/s. Use -h to quickly verify you're getting expected throughput.
Example 6: CPU-Only Statistics (-c)
The -c option displays only CPU statistics, omitting device I/O data. Useful when you're solely interested in CPU utilization patterns.
iostat -c 2 5
Linux 5.15.0-91-generic (webserver) 11/06/2024 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 8.45 0.02 2.31 0.87 0.00 88.35 avg-cpu: %user %nice %system %iowait %steal %idle 12.34 0.00 3.45 1.23 0.00 82.98 avg-cpu: %user %nice %system %iowait %steal %idle 15.67 0.00 4.23 2.45 0.00 77.65 avg-cpu: %user %nice %system %iowait %steal %idle 18.23 0.00 5.12 3.56 0.00 73.09 avg-cpu: %user %nice %system %iowait %steal %idle 14.56 0.00 3.89 1.89 0.00 79.66

CPU Statistics Focus:

  • Clean output: No device statistics, only CPU utilization
  • iowait tracking: Watch %iowait rise during I/O-intensive operations
  • System vs user: High %system suggests kernel overhead (I/O, context switches)
  • Pattern recognition: Track CPU load patterns over time
  • Combine with top: Use iostat -c for overview, top for process detail
  • Virtualization: Monitor %steal to detect resource contention in VMs
  • Baseline establishment: Run during known-good times to establish normal ranges
  • Correlation: Rising %iowait correlates with disk bottlenecks
Quick CPU Check: iostat -c 1 10 gives 10-second snapshot of CPU behavior. Look for sustained high %iowait (>20%) indicating I/O bottleneck, or high %system (>30%) suggesting kernel pressure.
Example 7: Device-Only Statistics (-d)
The -d option displays only device statistics, omitting CPU data. Perfect for focused disk performance monitoring.
iostat -dx 2
Linux 5.15.0-91-generic (fileserver) 11/06/2024 _x86_64_ (4 CPU) Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 8.23 4.22 145.23 287.56 0.45 2.34 5.19 35.67 2.45 5.67 0.05 17.65 68.12 1.23 1.52 sdb 45.67 23.45 678.90 1234.56 3.45 8.90 7.02 27.51 4.56 12.34 0.42 14.87 52.64 3.12 21.34 sdc 123.45 78.90 2345.67 4567.89 12.34 34.56 9.09 30.46 8.90 18.45 1.23 19.00 57.88 4.56 67.89 sdd 12.34 5.67 234.56 345.67 1.23 2.34 9.07 29.20 2.34 6.78 0.08 19.01 60.99 1.89 3.45 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 6.50 3.50 102.40 224.00 0.25 1.75 3.70 33.33 2.10 4.85 0.03 15.75 64.00 1.10 1.10 sdb 78.50 45.00 1024.00 2048.00 5.50 15.00 6.54 25.00 6.20 15.30 0.89 13.04 45.51 4.20 51.95 sdc 289.50 198.00 5120.00 9216.00 28.50 78.00 8.96 28.26 15.60 28.90 4.56 17.68 46.55 6.89 99.85 sdd 8.00 4.00 128.00 256.00 0.75 1.50 8.57 27.27 1.95 5.45 0.05 16.00 64.00 1.75 2.10

Device-Focused Monitoring:

  • No CPU data: Screen real estate dedicated to disk statistics
  • Multi-disk comparison: Easily compare performance across drives
  • Bottleneck identification: sdc shows 99.85% utilization - saturated!
  • Performance tiers: See which disks handle which loads
  • Storage arrays: Monitor all disks in RAID or storage pool
  • Capacity planning: Identify which disks need upgrade/replacement
  • Load distribution: Check if load is balanced across disks
  • -dx combination: Extended device statistics without CPU clutter
File Server Monitoring: Use iostat -dxh 5 to watch all disks. Look for: 1) Unbalanced load (one disk at 90%, others at 10%), 2) High await times (>20ms), 3) %util approaching 100%.
Example 8: Timestamps for Log Correlation (-t)
The -t flag adds timestamps to each report, essential for correlating iostat data with other logs and events.
iostat -xth 5
11/06/2024 02:15:30 PM Linux 5.15.0-91-generic (dbserver) 11/06/2024 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 15.23 0.00 4.56 3.21 0.00 77.00 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util nvme0n1 234.56 156.78 18.9M 45.6M 15.67 45.23 6.26 22.39 0.67 1.89 0.12 82.5k 297.8k 0.45 17.89 11/06/2024 02:15:35 PM avg-cpu: %user %nice %system %iowait %steal %idle 18.45 0.00 5.23 4.67 0.00 71.65 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util nvme0n1 456.78 289.34 34.5M 87.9M 28.90 67.45 5.95 18.89 1.23 3.45 0.45 77.3k 310.5k 0.78 35.67 11/06/2024 02:15:40 PM avg-cpu: %user %nice %system %iowait %steal %idle 21.34 0.00 6.78 7.89 0.00 63.99 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util nvme0n1 678.90 445.67 56.7M 145.3M 45.67 98.23 6.30 18.06 2.34 5.67 1.23 85.5k 333.7k 1.23 67.89

Timestamped Monitoring:

  • -t flag: Adds timestamp to each report iteration
  • Format: MM/DD/YYYY HH:MM:SS AM/PM
  • Log correlation: Match iostat spikes with application logs, database logs
  • Incident investigation: "At 2:15:40 PM, %util jumped to 67.89%"
  • Historical analysis: Review saved iostat logs with timestamps
  • Performance patterns: Identify time-of-day patterns (backups at 2 AM, etc.)
  • Scheduled tasks: Correlate cron jobs with I/O spikes
  • Multi-system analysis: Compare timestamps across different servers
Long-Term Monitoring: iostat -xth 300 >> /var/log/iostat.log & logs every 5 minutes. Add to cron or systemd service for continuous monitoring. Timestamps make analysis possible weeks later.
Example 9: NFS and Network Filesystem Statistics (-n)
The -n flag displays statistics for network filesystems like NFS. Essential for monitoring networked storage performance.
iostat -xn 5
Linux 5.15.0-91-generic (nfs-client) 11/06/2024 _x86_64_ (4 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 5.23 0.00 2.45 8.90 0.00 83.42 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util sda 2.34 1.23 45.67 23.45 0.12 0.34 4.88 21.65 2.10 3.45 0.01 19.51 19.07 1.10 0.39 192.168.1.100:/export/data 45.67 23.45 678.90 456.78 0.00 0.00 0.00 0.00 12.34 18.90 0.67 14.87 19.48 0.00 0.00 nfs01:/backup 12.34 6.78 234.56 123.45 0.00 0.00 0.00 0.00 23.45 34.56 0.89 19.01 18.20 0.00 0.00

Network Filesystem Monitoring:

  • -n flag: Shows NFS mounts in addition to local devices
  • NFS naming: Displays as server:/export/path or hostname:/path
  • High await: Network latency causes higher r_await and w_await values
  • No merging: rrqm/s and wrqm/s are zero (merging happens on NFS server)
  • Network bottleneck: If await values high (>50ms), check network performance
  • Server vs network: Compare multiple NFS mounts to isolate issues
  • Client-side view: These stats are from client perspective, not server
  • Troubleshooting: High IOPS + high await = either slow server or network congestion
NFS Performance: Typical NFS await: 5-15ms on good networks. If seeing >50ms, check: 1) Network connectivity (ping server), 2) Server load (ssh server iostat -x), 3) Switch/router issues.
Example 10: JSON Output for Parsing (-o JSON)
Modern iostat versions support JSON output, making it easy to parse data programmatically for monitoring systems, dashboards, and automation.
iostat -x -o JSON 2 1
{ "sysstat": { "hosts": [ { "nodename": "webserver", "sysname": "Linux", "release": "5.15.0-91-generic", "machine": "x86_64", "number-of-cpus": 4, "date": "11/06/2024", "statistics": [ { "timestamp": "14:30:15", "avg-cpu": { "user": 8.45, "nice": 0.02, "system": 2.31, "iowait": 0.87, "steal": 0.00, "idle": 88.35 }, "disk": [ { "disk_device": "sda", "r/s": 8.23, "w/s": 4.22, "rkB/s": 145.23, "wkB/s": 287.56, "rrqm/s": 0.45, "wrqm/s": 2.34, "%rrqm": 5.19, "%wrqm": 35.67, "r_await": 2.45, "w_await": 5.67, "aqu-sz": 0.05, "rareq-sz": 17.65, "wareq-sz": 68.12, "svctm": 1.23, "%util": 1.52 }, { "disk_device": "nvme0n1", "r/s": 18.34, "w/s": 7.44, "rkB/s": 456.89, "wkB/s": 891.23, "rrqm/s": 1.23, "wrqm/s": 3.45, "%rrqm": 6.28, "%wrqm": 31.68, "r_await": 0.45, "w_await": 1.23, "aqu-sz": 0.02, "rareq-sz": 24.91, "wareq-sz": 119.79, "svctm": 0.34, "%util": 0.87 } ] } ] } ] } }

JSON Output Benefits:

  • Machine-readable: Easy parsing with jq, Python, or any language
  • Monitoring systems: Feed directly to Prometheus, Grafana, Datadog, etc.
  • Structured data: No regex parsing needed, proper data types (numbers not strings)
  • Automation-friendly: Scripts can easily extract specific metrics
  • Historical storage: Store in time-series databases for long-term analysis
  • API integration: Easy to incorporate into REST APIs or microservices
  • Dashboard creation: Parse and visualize with web frontends
  • Alerting: Extract %util or await values to trigger alerts
Parse with jq: iostat -x -o JSON 1 1 | jq '.sysstat.hosts[0].statistics[0].disk[] | select(."%util" > 80)' extracts only disks with >80% utilization. Perfect for automated monitoring!

Additional iostat Information

📊 Key Metrics Reference

Metric Meaning Good Range Warning Signs
%iowait CPU time waiting for I/O < 10% > 20% indicates I/O bottleneck
%util Device utilization < 80% > 90% = saturated device
r_await Average read latency (ms) < 10ms (SSD/NVMe) > 20ms needs investigation
w_await Average write latency (ms) < 10ms (SSD/NVMe) > 20ms needs investigation
aqu-sz Average queue size < 5 > 10 = requests queuing
r/s + w/s IOPS (operations/sec) Varies by drive Compare to drive specs
rkB/s + wkB/s Throughput HDD: <200 MB/s
SSD: <600 MB/s
NVMe: <7 GB/s
Much lower than spec

🔧 Complete iostat Options

Option Description
-c Display CPU statistics only
-d Display device statistics only
-h Human-readable output (K, M, G units)
-k Display in kilobytes per second
-m Display in megabytes per second
-N Display registered device mapper names
-n Display NFS statistics
-p [device] Display partition statistics
-t Print timestamps
-x Display extended statistics
-y Omit first report (since boot statistics)
-z Omit devices with no activity
-o JSON Output in JSON format
-g group Display stats for device group
-H Display stats for aggregate devices only

💡 Performance Troubleshooting Guide

Symptom: High %iowait (>20%)

  • Check which device: iostat -x 2 and look at %util
  • Identify processes: iotop shows which processes doing I/O
  • Check await times: >20ms suggests slow device or heavy load
  • Solution: Optimize queries, add indexes, upgrade storage, or add caching

Symptom: %util at 100%

  • Device is saturated - at maximum capacity
  • Check if reads or writes dominant: compare r/s vs w/s
  • Look at queue size (aqu-sz): >10 means requests backing up
  • Solution: Reduce load, add faster storage, or distribute load across multiple disks

Symptom: High await but low %util

  • Suggests slow device (old HDD) or firmware issues
  • Each operation taking long time even with low IOPS
  • Check SMART data: smartctl -a /dev/sda
  • Solution: Replace aging drive or check for hardware problems

Symptom: Sudden performance drop

  • Compare current iostat to baseline: iostat -xh 1
  • Check for backup jobs or maintenance tasks
  • Look for new applications or increased traffic
  • Verify no hardware degradation (cable issues, controller problems)

📚 Related Commands

  • iotop: Real-time I/O monitoring by process (like top for I/O)
  • vmstat: Virtual memory and system statistics
  • sar: System activity reporter (historical data from sysstat)
  • dstat: Versatile resource statistics tool (combines vmstat, iostat, netstat)
  • nmon: Performance monitoring with nice TUI interface
  • atop: Advanced system and process monitor
  • blktrace: Block layer I/O tracing (very detailed)
  • smartctl: Check disk health and SMART attributes
  • hdparm: Get/set disk parameters and test speed
  • fio: Flexible I/O tester for benchmarking

🎯 Use Cases by Role

Database Administrators:

  • Monitor data and log partitions separately: iostat -xp sda 5
  • Correlate query performance with I/O metrics
  • Identify if slow queries due to disk or other factors
  • Optimize checkpoint and WAL settings based on write patterns

System Administrators:

  • Baseline system: Run iostat during normal operations, save output
  • Capacity planning: Track %util trends over time
  • Troubleshooting: First tool to check when users report "slow system"
  • Monitor backups: Watch I/O during scheduled backup windows

Web Server Administrators:

  • Monitor during traffic spikes: iostat -xth 2
  • Verify caching effectiveness (low disk I/O = good caching)
  • Identify if static content serving causing I/O load
  • Check log write performance (async logging vs sync)

DevOps Engineers:

  • JSON output for monitoring: iostat -xo JSON 60
  • Automate alerting on %util or await thresholds
  • Historical trending in time-series databases
  • Pre/post deployment performance comparison

🔍 Best Practices

  • Establish baselines: Run iostat during normal operations and save output for future comparison
  • Use extended stats: Always use -x flag for detailed metrics
  • Monitor intervals: 2-5 second intervals for troubleshooting, 60-300 seconds for logging
  • Skip first report: Add -y flag to omit since-boot stats when only current activity matters
  • Combine tools: Use with iotop to identify which processes causing I/O
  • Watch trends: Single snapshot less useful than watching over time
  • Correlate data: Use -t for timestamps to match with application logs
  • Document findings: Save iostat output when investigating issues
  • Know your hardware: Compare metrics against drive specifications
  • Test changes: Run iostat before/after system changes to verify impact

⚡ Quick Reference - Common Commands

  • Basic overview: iostat
  • Extended stats: iostat -x
  • Human-readable: iostat -xh 2
  • Continuous monitoring: iostat -xth 5
  • Specific device: iostat -x sda 2
  • With partitions: iostat -xp sda 2
  • CPU only: iostat -c 2
  • Devices only: iostat -d 2
  • Skip inactive: iostat -xz 2
  • JSON for scripting: iostat -xo JSON 2 1