Advertisement
linuxserver High I/O wait on a Linux server slows everything down, from SSH access to website response. This happens when your CPU is idle but waiting for disk operations to complete. In this tutorial, you’ll learn how to identify the cause of high I/O wait, diagnose the culprit processes, and apply practical fixes

How to Fix High I/O Wait on Linux (Beginner-Friendly Guide)

5 Min Read Verified Content

# 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.

top

Look for %wa under the CPU row. Example:

Cpu(s): 10.0%us, 5.0%sy, 80.0%wa, 0.0%id
  • %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):

sudo apt install iotop -y # Debian/Ubuntu sudo yum install iotop -y # CentOS/RHEL sudo iotop -ao

Look for:

  • Processes using the most DISK READ or DISK WRITE

  • Common culprits: mysqld, php-fpm, backup scripts, rsync, logrotate, docker containers




## Step 3 — Check Disk Health


If your disk is slow, everything waits.

sudo smartctl -a /dev/sda # check disk health (SMART) sudo iostat -dx 1 # shows I/O stats per device

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.

free -h swapon --show

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:

du -sh /var/log/*

Truncate or rotate logs:

sudo truncate -s 0 /var/log/syslog sudo truncate -s 0 /var/log/mysql/error.log sudo logrotate -f /etc/logrotate.conf


## 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:

SHOW GLOBAL STATUS LIKE 'Innodb_data_%';


## Step 7 — Reduce Heavy Disk Usage Scripts


Identify cron jobs or scripts writing lots of data.

ps aux --sort=-%mem | head -n 10

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:

cat /sys/block/sda/queue/scheduler

Recommended for SSD: deadline or noop.

Change temporarily:

echo deadline | sudo tee /sys/block/sda/queue/scheduler


## Step 10 — Monitor & Prevent Future High I/O Wait


  • Install monitoring tools: Netdata, Glances, Prometheus + Grafana

  • Check /var/log/syslog for repetitive errors

  • Schedule heavy jobs during low-traffic hours

  • Consider caching solutions like Redis or Memcached to reduce disk access




## Beginner-Friendly Checklist


Problem TypeDiagnosis CommandFix
High CPU waittop, %waFind high I/O processes
Disk healthsmartctl, iostatReplace failing disk
Swap usagefree -hAdd RAM or reduce memory usage
Logs filling diskdu -sh /var/log/*Rotate/truncate logs
Database I/OMySQL/PostgreSQL statsOptimize queries/indexes
Disk too slowiostatMove to SSD, RAID, or faster storage
Heavy scriptsiotop, ps auxBatch or schedule during off-hours
I/O scheduler/sys/block/sda/queue/schedulerSet 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.

Advertisement
Back to Linuxserver