How to Fix High I/O Wait on Linux (Beginner-Friendly Guide)
# Understanding High I/O Wait
Before we dive into fixes, let’s understand what “I/O wait” means.
-
I/O wait is the percentage of time your CPU spends waiting for disk input/output operations (like reading/writing to disk).
-
High I/O wait doesn’t mean your CPU is busy — it’s idle, stuck waiting for the disk.
-
Common causes:
-
Slow hard drives (HDD vs SSD)
-
Too many processes reading/writing at the same time
-
Database intensive queries
-
Log flooding or backups running
-
Swap usage due to low RAM
-
## Step 1 — Check CPU & I/O Usage
Use top or htop to check I/O wait.
Look for %wa under the CPU row. Example:
-
%wa = 80%→ CPU is mostly waiting for disk.
Or use htop and add I/O wait column.
## Step 2 — Identify Processes Causing High I/O
Use iotop (install if necessary):
Look for:
-
Processes using the most DISK READ or DISK WRITE
-
Common culprits:
mysqld,php-fpm,backup scripts,rsync,logrotate,dockercontainers
## Step 3 — Check Disk Health
If your disk is slow, everything waits.
Look for:
-
r/s(reads per second) -
w/s(writes per second) -
await(average wait per I/O) -
High
await→ disk is bottleneck
## Step 4 — Check Swap Usage
If RAM is low, Linux swaps memory to disk, increasing I/O wait.
High swap usage → server constantly reading/writing disk → CPU waits.
Fix:
-
Add RAM
-
Reduce memory-hungry processes
-
Disable unnecessary services
## Step 5 — Optimize Logs and Temporary Files
Many logs, especially for web servers, can cause constant disk writes.
Check log size:
Truncate or rotate logs:
## Step 6 — Optimize Database I/O
If MySQL/PostgreSQL is writing too much:
-
Add proper indexes to reduce full table scans
-
Tune buffer/cache size
-
Use SSD instead of HDD if possible
-
Reduce frequency of heavy queries or batch jobs
Check MySQL I/O:
## Step 7 — Reduce Heavy Disk Usage Scripts
Identify cron jobs or scripts writing lots of data.
Or check disk write rate with iotop.
Common fixes:
-
Batch data processing in smaller chunks
-
Move temporary files to faster storage (SSD or tmpfs)
-
Avoid multiple simultaneous heavy jobs
## Step 8 — Use Faster Storage (if needed)
-
Upgrade from HDD → SSD
-
Move database or logs to separate disk
-
Use RAID 10 for high write I/O
-
Consider cloud storage with better IOPS (AWS EBS io1/io2, DigitalOcean volumes)
## Step 9 — Tune Linux I/O Scheduler
Linux uses I/O schedulers like cfq, deadline, noop. For SSDs:
Recommended for SSD: deadline or noop.
Change temporarily:
## Step 10 — Monitor & Prevent Future High I/O Wait
-
Install monitoring tools: Netdata, Glances, Prometheus + Grafana
-
Check
/var/log/syslogfor repetitive errors -
Schedule heavy jobs during low-traffic hours
-
Consider caching solutions like Redis or Memcached to reduce disk access
## Beginner-Friendly Checklist
| Problem Type | Diagnosis Command | Fix |
|---|---|---|
| High CPU wait | top, %wa | Find high I/O processes |
| Disk health | smartctl, iostat | Replace failing disk |
| Swap usage | free -h | Add RAM or reduce memory usage |
| Logs filling disk | du -sh /var/log/* | Rotate/truncate logs |
| Database I/O | MySQL/PostgreSQL stats | Optimize queries/indexes |
| Disk too slow | iostat | Move to SSD, RAID, or faster storage |
| Heavy scripts | iotop, ps aux | Batch or schedule during off-hours |
| I/O scheduler | /sys/block/sda/queue/scheduler | Set to deadline/noop for SSD |
## Conclusion
High I/O wait is a sign that your server is bottlenecked by disk operations. By following this step-by-step guide, even beginners can:
-
Identify which processes or services cause high I/O
-
Check disk health and usage
-
Optimize logs, scripts, and databases
-
Upgrade storage or tune I/O scheduler
-
Monitor and prevent future issues
With these steps, your Linux server should feel responsive again, and you’ll understand the root cause instead of just rebooting blindly.