The iotop command is top like utility for disk I/O. It watches I/O usage information output by the Linux kernel (requires v2.6.20 or later) and displays a table of current I/O usage by processes or threads on the system. This post expalins how to install and use iotop to find out what’s stressing (or program names) on your hard drives under Linux operating systems.
Install iotop
Use the yum command to install iotop under RHEL / CentOS Linux, enter:
# yum install iotop
Sample outputs:
Loaded plugins: auto-update-debuginfo, product-id, protectbase, rhnplugin, subscription-manager Updating certificate-based repositories. Unable to read consumer identity 0 packages excluded due to repository protections Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package iotop.noarch 0:0.3.2-3.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================= Installing: iotop noarch 0.3.2-3.el6 rhel-x86_64-server-6 49 k Transaction Summary ============================================================================================================================================================================================= Install 1 Package(s) Total download size: 49 k Installed size: 0 Is this ok [y/N]: y Downloading Packages: iotop-0.3.2-3.el6.noarch.rpm | 49 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : iotop-0.3.2-3.el6.noarch 1/1 Installed products updated. Verifying : iotop-0.3.2-3.el6.noarch 1/1 Installed: iotop.noarch 0:0.3.2-3.el6 Complete!
Debian / Ubuntu Linux user try apt-get command as follows to install the same:
$ sudo apt-get install iotop
Sample outputs:
[sudo] password for vivek: Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: iotop 0 upgraded, 1 newly installed, 0 to remove and 12 not upgraded. Need to get 26.5 kB of archives. After this operation, 168 kB of additional disk space will be used. Get:1 http://debian.osuosl.org/debian/ squeeze/main iotop all 0.4-2+squeeze1 [26.5 kB] Fetched 26.5 kB in 1s (17.0 kB/s) Selecting previously deselected package iotop. (Reading database ... 256274 files and directories currently installed.) Unpacking iotop (from .../iotop_0.4-2+squeeze1_all.deb) ... Processing triggers for man-db ... Setting up iotop (0.4-2+squeeze1) ... Processing triggers for python-support ...
How do I use iotop command?
iotop command displays columns for the I/O bandwidth read and written by each process/thread during the sampling period. It also displays the percentage of time the thread/process spent while swapping in and while waiting on I/O. For each process, its I/O priority (class/level) is shown. In addition, the total I/O bandwidth read and written during the sampling period is displayed at the top of the interface. Type the following command to run iotop (must run as root):
$ sudo iotop
OR
# iotop
Sample outputs:
However, I recommend that you start iotop with –only option to see only processes or threads actually doing I/O, instead of showing all processes or threads (you can set this mode dynamically too see keyboard shortcut o for more info):
# iotop --only
Sample outputs:

Other supported options by iotop command:
-o, --only Only show processes or threads actually doing I/O, instead of showing all processes or threads. This can be dynamically toggled by pressing o. -b, --batch Turn on non-interactive mode. Useful for logging I/O usage over time. -n NUM, --iter=NUM Set the number of iterations before quitting (never quit by default). This is most useful in non-interactive mode. -d SEC, --delay=SEC Set the delay between iterations in seconds (1 second by default). Accepts non-integer values such as 1.1 seconds. -p PID, --pid=PID A list of processes/threads to monitor (all by default). -u USER, --user=USER A list of users to monitor (all by default) -P, --processes Only show processes. Normally iotop shows all threads. -a, --accumulated Show accumulated I/O instead of bandwidth. In this mode, iotop shows the amount of I/O processes have done since iotop started. -k, --kilobytes Use kilobytes instead of a human friendly unit. This mode is useful when scripting the batch mode of iotop. Instead of choosing the most appropriate unit iotop will dis‐ play all sizes in kilobytes. -t, --time Add a timestamp on each line (implies --batch). Each line will be prefixed by the current time. -q, --quiet suppress some lines of header (implies --batch). This option can be specified up to three times to remove header lines. -q column names are only printed on the first iteration, -qq column names are never printed, -qqq the I/O summary is never printed.
Important keyboard shortcuts for iotop command
- Hit the left and right arrow keys to change the sorting.
- Hit r to reverse the sorting order.
- Hit o only to see processes or threads actually doing I/O, instead of showing all processes or threads.
- Hit p only show processes. Normally iotop shows all threads.
- Hit a display accumulated I/O instead of bandwidth. In this mode, iotop shows the amount of I/O processes have done since iotop started.
- Ht i to change the priority of a thread or a process’ thread(s) i.e. ionice.
- Hot q to quit iotop.
Check out related media
Recommended readings:
- How-to avoid sudden outburst of backup shell scripts / program disk I/O under Linux.
- How-to use iostat command to find out Linux Disk utilization.
- How-to use kSar and sar tool for identifying Linux bottlenecks for network, disk i/o, cpu and much more.
Thanks. This helped me a lot!
correction: (from the program itself)
iotop requires kernel-2.6.18-199.el5 or later
Seems to be an alt for FBSD: http://freebsdwiki.net/index.php/Iotop
Good one! But – here is no iotop for FreeBSD?
# whereis iotop
iotop: