iotop is an interactive, top-like Linux monitoring utility that displays per-process and per-thread disk I/O in real time, showing how many bytes each task reads and writes per second and how much of its time it spends waiting on I/O. Where iostat reports load per device, iotop answers the more practical question an administrator asks during an incident: which process is hammering the disk right now.
The tool reads kernel task I/O accounting data, refreshes the display every second by default and sorts tasks by activity. It typically requires root privileges or the CAP_NET_ADMIN capability, because the data comes from a privileged kernel interface rather than from ordinary files in procfs.
How iotop collects per-task I/O data
iotop obtains its numbers from the taskstats interface, a Netlink-based channel through which the kernel exports per-task accounting. The kernel must be built with CONFIG_TASK_IO_ACCOUNTING, CONFIG_TASK_DELAY_ACCT and CONFIG_TASKSTATS, which mainstream distribution kernels enable. On each refresh, iotop queries every task, subtracts the previous counters and divides by the interval to produce rates.
Two different kinds of measurement appear on screen. Byte counters record how much data a task caused to be read from or written to the storage layer. Delay accounting records how long a task waited for block I/O completion and for swap-in, which iotop expresses as a percentage of wall-clock time. Since kernel 5.14, delay accounting is disabled by default and must be enabled with the delayacct boot parameter or the kernel.task_delayacct sysctl; otherwise the IO and SWAPIN columns stay empty or show a warning.
The following table lists the kernel prerequisites and what happens when each one is missing.
| Kernel feature | Provides | Symptom if missing |
|---|---|---|
| CONFIG_TASKSTATS | Netlink channel for task statistics | iotop refuses to start |
| CONFIG_TASK_IO_ACCOUNTING | Per-task read and write byte counters | Bandwidth columns stay at zero |
| CONFIG_TASK_DELAY_ACCT | Block I/O and swap-in wait times | IO and SWAPIN columns unavailable |
| kernel.task_delayacct = 1 | Runtime activation of delay accounting | Warning about disabled delay accounting |
Reading the iotop display
The iotop screen has a summary header and a task list. The header shows Total DISK READ and Total DISK WRITE, the sum of what tasks requested, and Actual DISK READ and Actual DISK WRITE, the traffic that the block layer actually sent to devices. The two pairs differ because of the page cache and write-back: a task can write many megabytes into cache that the kernel flushes later, or a single flush can combine writes from many tasks.
The task list contains one row per thread or process, with the columns described below.
| Column | Meaning | Interpretation tip |
|---|---|---|
| TID or PID | Thread or process identifier | Press p to switch to processes |
| PRIO | I/O scheduling class and level | be/4 is the default best-effort level |
| DISK READ | Read rate requested by the task | Cache hits do not count as disk reads |
| DISK WRITE | Write rate attributed to the task | Often charged at write-back time |
| SWAPIN | Share of time waiting for swap-in | High values signal memory pressure |
| IO | Share of time waiting for block I/O | Near 99% means the task is I/O bound |
| COMMAND | Command line of the task | Kernel threads appear in brackets |
Interactive keys control the view: o shows only tasks currently doing I/O, a switches to accumulated totals since iotop started, p groups threads into processes, the left and right arrows change the sort column, and i changes the I/O priority of a selected task through the same mechanism as ionice.
Useful command-line options
iotop also runs non-interactively, which makes it suitable for scripts, cron jobs and incident logs. Batch mode prints plain text that can be redirected to a file, and combining it with a fixed iteration count produces a short, reproducible snapshot.
| Option | Effect | Typical use |
|---|---|---|
| -o | Show only tasks doing I/O | Reduce noise on busy servers |
| -b | Batch mode without curses | Logging to a file |
| -n NUM | Stop after NUM iterations | Bounded snapshots in scripts |
| -d SEC | Set the refresh delay | Smooth out short bursts |
| -a | Show accumulated I/O | Find the largest total writer |
| -P | Show processes, not threads | Readable output for multithreaded daemons |
| -t | Prefix each line with a timestamp | Correlating with application logs |
A typical capture during an incident is sudo iotop -botqqq -d 5 -n 12, which records one minute of activity in five-second steps, shows only active tasks with timestamps and suppresses repeated headers.
iotop compared with related monitoring tools
iotop is one instrument among several in the Linux monitoring toolbox, and each answers a different question. The decisive distinction is between per-device metrics, which show whether storage is saturated, and per-task metrics, which show who is responsible.
| Tool | Granularity | Main question answered |
|---|---|---|
| iotop | Per process or thread | Who is generating disk I/O |
| iostat | Per block device | Is the device saturated or slow |
| top and htop | Per process, CPU and memory | Who consumes CPU and memory |
| vmstat | System-wide | Is the system waiting on I/O or swap |
| pidstat -d | Per process | Same question with sar-style history |
| Pressure stall information | System or cgroup | How much work stalls on I/O |
A sound workflow starts broad and narrows down: vmstat or pressure stall information reveals high I/O wait, iostat identifies the saturated device, and iotop then names the responsible process. Once the process is known, lsof shows which files it has open and strace shows the system calls behind the traffic.
Limitations and common mistakes
iotop numbers are accurate within their model, but the model has blind spots that cause frequent misdiagnosis. Most problems come from the gap between what a task requests and what reaches the device.
- Write-back attribution: buffered writes are often flushed by kernel worker threads, so the real writer may look idle while a
kworkerthread appears busy. - Page cache hits are invisible, so a process reading heavily from cached files shows little or no disk read.
- Network and FUSE file systems may not account traffic as block I/O, which hides NFS or SSHFS activity.
- Short-lived processes can start and exit between refreshes and never appear on screen.
- Containers share the host kernel, so iotop on the host sees container tasks, while iotop inside an unprivileged container usually cannot run.
- Overhead grows with the number of threads, because iotop queries each task on every refresh.
Two implementations exist: the original Python iotop and a newer C implementation, often packaged as iotop-c, which is lighter and handles disabled delay accounting more gracefully. For historical analysis, neither replaces a recorder such as sar or an eBPF tool like biotop, because iotop keeps no history once it exits.
In everyday language
Think of a computer disk as a single checkout lane in a busy store. When the line gets long, everything slows down. The manager cannot tell who is holding things up just by looking at the lane. iotop is like a camera above the checkout. It labels every customer and shows how much each one puts on the belt.
The key takeaway is simple. When a Linux machine feels slow because the disk is overloaded, iotop shows which program is responsible. The administrator can then pause it, slow it down or fix it instead of guessing.
Seen in the real world
An operations engineer at an online retailer receives alerts that the product database responds in two seconds instead of the usual fifty milliseconds. vmstat shows I/O wait above 40 percent, and iostat reports the data volume at nearly full utilization, yet the database itself is not running unusual queries.
The engineer runs sudo iotop -oP and sees a log compression job writing about 180 MB/s with an IO wait of 95 percent, while the database processes sit in the IO column waiting their turn. The nightly job had been moved to business hours by a configuration change.
The engineer lowers the job priority with ionice -c3, which places it in the idle I/O class, and database latency returns to normal within a minute. The team then reschedules the job and adds a cgroup I/O limit, so the root cause was found in minutes rather than through hours of query tuning.