iotop
I/O monitor showing disk read/write by process.
Official WebsiteFeatures
Installation
apt install iotoppacman -S iotopdnf install iotopWhy Use iotop?
Per-Process I/O Tracking
See exactly which processes are reading from and writing to disk, including real-time rates and accumulated totals.
Real-Time Performance Insight
Monitor disk I/O performance in real-time to identify processes causing I/O bottlenecks and performance issues.
Simple and Focused
Specialized tool dedicated to disk I/O monitoring. Lightweight and easy to use with minimal overhead.
Interactive Filtering & Sorting
Filter by process, sort by different metrics, and focus on high I/O consumers to quickly identify problem processes.
Installation
# Ubuntu/Debian
sudo apt install iotop
# Fedora/RHEL
sudo dnf install iotop
# Arch Linux
sudo pacman -S iotop
# CentOS
sudo yum install iotop
# Verify installation
iotop --version
# Note: iotop requires root/sudo privileges to runBasic Usage
# Start iotop (requires root)
sudo iotop
# Run in batch mode (non-interactive, outputs once)
sudo iotop -b
# Run in batch mode for 5 iterations with 1-second delay
sudo iotop -b -n 5 -d 1
# Monitor for a specific duration
sudo iotop -b -n 10 -d 2 > iotop_output.txt
# Only show processes with I/O activity
sudo iotop -o
# Show accumulated I/O instead of bandwidth
sudo iotop -a
# Get help
iotop -hKey Options & Interactive Commands
Command Line Options
| Option | Description |
|---|---|
-b, --batch | Non-interactive batch mode |
-o, --only | Only show processes with I/O activity |
-a, --accumulated | Show accumulated I/O instead of bandwidth |
-n NUM, --iter NUM | Number of iterations in batch mode |
-d SEC, --delay SEC | Delay between iterations (in seconds) |
-p PID, --pid PID | Monitor specific process by PID |
-u USER, --user USER | Show only processes for specific user |
Interactive Mode Shortcuts
| Key | Function |
|---|---|
o | Toggle showing processes with only I/O activity |
a | Toggle between accumulated I/O and bandwidth |
r | Reverse sorting order |
p | Sort by PRIO (I/O priority) |
q | Quit iotop |
Practical Examples
1. Find High I/O Processes
# Start interactive monitoring
sudo iotop
# Key tips:
# - Processes are sorted by I/O bandwidth by default
# - Top processes are the heaviest I/O consumers
# - Press 'o' to show only processes with I/O
# - Press 'r' to reverse sort order2. Monitor Specific Process
# Monitor specific process by PID
sudo iotop -p 1234
# Monitor processes owned by specific user
sudo iotop -u www-data
# Monitor multiple processes
sudo iotop -p 1234,56783. Batch Mode for Logging
# Capture I/O data for analysis
sudo iotop -b -n 100 -d 5 > iotop_log.txt
# Background collection every minute
nohup bash -c 'while true; do echo "=== $(date) ===" >> iotop.log; sudo iotop -b -n 1 -d 1 >> iotop.log; sleep 60; done' &
# Capture only active processes
sudo iotop -b -n 60 -d 1 -o > active_io.txt4. Find Disk Hogs
# Show accumulated I/O (total data transferred)
sudo iotop -a
# Show only processes with I/O + accumulated view
sudo iotop -o -a
# Find top 10 I/O processes and save to file
sudo iotop -b -n 5 -d 2 | head -20 > top_io.txt5. Troubleshooting High Load
# Monitor during high load periods
watch -n 1 'sudo iotop -b -n 1 | head -20'
# Run continuously and log with timestamps
sudo bash -c 'while true; do echo "[$(date '+%Y-%m-%d %H:%M:%S')]" >> io_analysis.log; iotop -b -n 1 -d 1 | head -15 >> io_analysis.log; echo "---" >> io_analysis.log; sleep 60; done' &Understanding the Output
Column Meanings
TID
Thread ID - identifies the thread/process
PRIO
I/O Priority (be* prefix means best-effort, rt* means real-time)
USER
User who owns the process
DISK READ
Current disk read rate (bandwidth mode) or total read (accumulated mode)
DISK WRITE
Current disk write rate (bandwidth mode) or total write (accumulated mode)
SWAPIN
Percentage of memory swapped to disk
IO
Percentage of time the process spent doing I/O
COMMAND
Command name and arguments
Example Output
Total DISK READ: 10.25 M/s | Total DISK WRITE: 5.13 M/s
Current DISK READ: 8.50 M/s | Current DISK WRITE: 3.25 M/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
1234 be/4 mysql 8.50 M/s 2.30 M/s 0.00% 95.23% mysqld
5678 be/4 postgres 0.00 B/s 0.95 M/s 0.00% 45.67% postgres
9012 be/4 root 0.00 B/s 0.00 B/s 0.00% 0.00% kernelTips
1. Root Privileges Required
iotop requires root access to read kernel I/O data. Always use 'sudo iotop' or add it to sudoers for passwordless access if needed.
2. Combine with watch for Continuous Monitoring
Use 'watch -n 1 "sudo iotop -b -n 1"' to continuously monitor I/O in a terminal without running iotop interactively.
3. Pipe Output for Analysis
Use batch mode with piping: 'sudo iotop -b -n 1 | grep mysql' to filter specific processes or integrate with monitoring scripts.
4. Monitor During Peak Hours
Use iotop during times when system is experiencing performance issues to identify I/O-related problems quickly.
5. Check I/O Priority Classes
The PRIO column shows I/O priority classes. Lower priority processes don't monopolize disk access. Use ionice to adjust priorities if needed.
6. Use Accumulated Mode for Long-Term Trends
Switch to accumulated mode (-a) to see total I/O since process start, helping identify which processes transfer the most data over time.