← All posts
Guides· 6 min read

How to Monitor Disk I/O Latency on a Linux Server and Find the Bottleneck

Measure disk I/O latency on Linux, find the offending process, and track I/O across every server before users notice slowness.

By , Director of Softuvo Solutions (LinkedIn) · Published · Updated

Your app feels sluggish, queries are timing out, and htop shows CPU is fine. Nine times out of ten the culprit is disk I/O — but knowing that does not tell you which disk, which process, or whether it is a hardware problem or just one runaway job hammering the filesystem. This guide walks through exactly how to measure I/O latency on a Linux server, narrow it down to the real bottleneck, and keep an eye on disk usage across every server you run.

Start with iostat — your first view into disk performance

The fastest way to get a snapshot of disk activity is iostat, part of the sysstat package. If it is not installed, run: sudo apt install sysstat (Debian/Ubuntu) or sudo yum install sysstat (RHEL/CentOS).

Run it with extended stats and a refresh interval:

iostat -xz 2 10

That gives you extended metrics, hides idle devices, refreshes every 2 seconds, and runs 10 times. The columns that matter most for latency are:

  • await — average time (ms) for I/O requests to complete, including queue wait. This is your headline latency number.
  • r_await / w_await — separate read and write latency, so you can tell if it is reads or writes causing pain.
  • svctm — deprecated, ignore it.
  • %util — how busy the device is. Near 100% means it is saturated, but on SSDs and NVMe drives this can be misleading because they handle parallel I/O.

A healthy NVMe SSD should show await below 1 ms. A SATA SSD might run 1–5 ms. A spinning disk is acceptable around 5–20 ms, but anything above that consistently signals a problem. If you see await spiking to 100 ms or more, something is seriously wrong.

A quick way to watch a single device continuously and capture the output for later comparison:

# Watch /dev/sda, refresh every 2 s, run for 5 minutes, save to a file
iostat -xz 2 150 -d /dev/sda | tee iostat-$(date +%F-%H%M).txt

Use iotop to find the offending process

Once you know which disk is struggling, the next question is: who is hammering it? iotop shows per-process I/O in real time, similar to htop for CPU. Install it with sudo apt install iotop, then run:

sudo iotop -o

The -o flag shows only processes that are actively doing I/O, keeping the output clean. Look for the DISK READ and DISK WRITE columns. A process reading or writing hundreds of megabytes per second when it should not be is your bottleneck. Note the PID, then cross-reference:

# See what files the process has open
sudo lsof -p <PID>

# Or check its command line and working directory
ps -p <PID> -o pid,comm,args
ls -l /proc/<PID>/fd | head -20
If iotop shows I/O spread evenly across many processes rather than one dominant culprit, the problem is likely at the storage layer itself — a failing drive, a full disk cache, or a RAID controller under pressure.

Go deeper with blktrace and biolatency

If iostat and iotop point to a disk but not a clear cause, you need to look at the I/O stack more granularly. Two tools are especially useful here.

blktrace captures every block I/O event on a device. Run it for 10–15 seconds, stop it with Ctrl+C, then analyse with blkparse:

sudo blktrace -d /dev/sda -o trace
# ... Ctrl+C after ~15 seconds ...
blkparse -i trace.blktrace.0 | tail -50

You will see queue times vs. service times broken down by I/O type. This is verbose but reveals whether latency is happening in the kernel queue or at the hardware level.

If you are running a modern kernel (4.7+) with BPF tools installed, biolatency from the BCC toolkit is far more ergonomic:

# Install BCC tools (Debian/Ubuntu)
sudo apt install bpfcc-tools

# Print an I/O latency histogram for /dev/sda, 1-second intervals, 10 counts
sudo biolatency-bpfcc -d /dev/sda 1 10

It prints a histogram of I/O completion times, showing you the distribution rather than just averages. Averages hide bimodal latency — where most I/Os complete fast but a small percentage take seconds and drag down your p99 response times. Example output:

usecs           : count     distribution
         0 -> 1      : 0        |                    |
         2 -> 3      : 12       |**                  |
         4 -> 7      : 384      |********************|
         8 -> 15     : 291      |***************     |
        16 -> 31     : 18       |*                   |
       256 -> 511    : 3        |                    |
      1024 -> 2047   : 1        |                    |

That lone entry at 1024–2047 usecs (1–2 ms) is the kind of outlier that averages mask but that p99 latency in your app will feel.

Check for filesystem and mount-level issues

Sometimes the disk hardware is fine but the filesystem is the bottleneck. A few things to check:

  • Disk fullness — run df -h. Linux filesystems degrade badly above roughly 90% capacity. Inodes can also be exhausted separately: df -i. If you are not sure what is consuming space, see how to check disk space and find what is filling it up for a step-by-step walkthrough using df, du and ncdu.
  • Dirty page writeback — cat /proc/meminfo | grep -i dirty. If dirty pages are consistently high (gigabytes), the kernel is accumulating writes faster than it can flush them. Tune vm.dirty_ratio and vm.dirty_background_ratio in /etc/sysctl.conf.
  • Mount options — check /proc/mounts. If a database volume is mounted without noatime, every read triggers a metadata write. Add noatime to the mount options in /etc/fstab and remount.
  • Filesystem errors — sudo dmesg | grep -iE 'error|EXT4|XFS|I/O error'. Hardware errors show up here before drives fully fail.
  • Scheduler — cat /sys/block/sda/queue/scheduler. For NVMe drives, none (no scheduler) is correct. For SSDs on older kernels, mq-deadline or bfq is usually better than cfq.
# All-in-one filesystem health check
df -h          # capacity by mount point
df -i          # inode usage
cat /proc/meminfo | grep -i dirty
cat /proc/mounts
sudo dmesg | grep -iE 'error|EXT4|XFS|I/O error' | tail -20
cat /sys/block/sda/queue/scheduler

How to monitor disk usage across multiple servers (not just one)

Checking one server by hand is straightforward. Keeping track of I/O latency and disk usage across a fleet is a different problem. The naive approach is a cron job that runs df and iostat on each host and emails you the output, but that quickly becomes noise you stop reading.

A more practical approach is to collect the numbers centrally so you can compare servers side by side and spot the outlier. Here is a minimal script you can drop onto each server as a cron job that pushes await and disk usage to a central endpoint:

#!/bin/bash
# /usr/local/bin/disk-report.sh — run every 5 minutes via cron
HOSTNAME=$(hostname -s)
AWAIT=$(iostat -xz 1 3 | awk '/^sd|^nvme|^vd/ {sum+=$10; n++} END {if(n>0) printf "%.1f", sum/n}')
DISK_PCT=$(df / | awk 'NR==2 {print $5}' | tr -d '%')

curl -s -X POST https://your-central-collector/metrics \
  -H 'Content-Type: application/json' \
  -d "{\"host\":\"$HOSTNAME\",\"await_ms\":$AWAIT,\"disk_pct\":$DISK_PCT}"

# Alert locally if await > 20 ms or disk > 85%
if (( $(echo "$AWAIT > 20" | bc -l) )) || (( DISK_PCT > 85 )); then
  logger -t disk-alert "await=${AWAIT}ms disk=${DISK_PCT}% on $HOSTNAME"
fi

That gives you a single log line per server and a hook for central collection. The thresholds (20 ms await, 85% disk) are reasonable starting points for most production servers; adjust them after you have a few days of baseline data.

The bigger challenge across a fleet is that each server has different normal behaviour. A database server will naturally run higher I/O than a static web server. Comparing raw numbers across all endpoints misses that context. What you actually want to know is: is this server behaving unusually compared to its own recent history? That requires per-server baselines, which manual scripts do not give you. If you want to understand the wider picture of running production servers without a dedicated SRE, this overview covers the monitoring and alerting fundamentals that apply across your whole fleet.

Build a baseline and set alerts before it gets bad

Reactive troubleshooting is fine, but the real goal is catching latency before it becomes an outage. Run the following during normal operating hours and save the output:

iostat -xz 1 60 > baseline-$(date +%F).txt

Now you have a reference for what normal looks like, which makes future spikes obvious rather than ambiguous. Repeat this on the same day each week and diff the files:

diff baseline-2025-01-13.txt baseline-2025-01-20.txt | grep '^[<>]' | grep -E 'sda|nvme'

For something more automatic across multiple servers, Opservo tracks I/O metrics and disk usage continuously, surfaces latency anomalies in plain English, and can correlate a slow-disk event with the specific process responsible. Its learned baselines adjust per server and per time of day, so you are alerted when something is unusual for that host, not just when it crosses a fixed number.

Whether you script your own monitoring or use a tool, the habit is the same: do not wait for users to report slowness. Disk latency tends to creep up gradually — a drive entering the early stages of failure, a cron job that gets bigger every week, a log directory nobody ever cleans up. Measure it regularly and you will almost always see the problem coming.

Read next in the server health and monitoring series: How do you monitor a Linux server without an SRE? and How to check disk space on Linux and find what is filling it up (df, du, ncdu). The whole series is at Server health and monitoring.

Invite the reader to connect their server to Opservo's free 2-server plan so I/O latency and process-level disk activity are tracked automatically without keeping a cron script alive. — one command installs a read-only agent and your first findings arrive in five minutes: start free. Related: guides why is my server slow.