iostat
Overview
The iostat
command reports CPU statistics and input/output statistics for devices and partitions. It’s useful for monitoring system input/output device loading.
Syntax
iostat [options] [interval [count]]
Common Options
Option | Description |
---|---|
-c |
CPU utilization |
-d |
Device utilization |
-h |
Human readable |
-k |
In kilobytes |
-m |
In megabytes |
-N |
Device mapper names |
-p |
Partition stats |
-t |
Print time |
-x |
Extended stats |
-y |
Since boot |
-z |
Omit idle |
Output Fields
Field | Description |
---|---|
tps | Transfers per second |
kB_read/s | Kilobytes read per second |
kB_wrtn/s | Kilobytes written per second |
kB_read | Total kilobytes read |
kB_wrtn | Total kilobytes written |
await | Average wait time |
svctm | Service time |
%util | Utilization |
Key Use Cases
- IO monitoring
- Disk performance
- System analysis
- Capacity planning
- Troubleshooting
Examples with Explanations
Example 1: Basic Usage
iostat
Basic statistics
Example 2: Extended Stats
iostat -x
Detailed information
Example 3: Continuous
iostat 2 10
Every 2s, 10 times
Common Usage Patterns
Device monitoring:
iostat -d
Extended info:
iostat -xz
Specific device:
iostat -p sda
Performance Metrics
- Throughput
- Response time
- Queue length
- Utilization
- Service time
Additional Resources
Best Practices
- Regular monitoring
- Check trends
- Use intervals
- Document baselines
- Compare devices
Performance Analysis
- IO patterns
- Device load
- Queue depth
- Response times
- Bandwidth usage
Troubleshooting
- IO bottlenecks
- Device saturation
- Queue buildup
- High latency
- Low throughput
Common Issues
- Disk contention
- Queue saturation
- High wait times
- Device overload
- Poor performance