≡ Menu

Linux iotop: Check What’s Stressing And Increasing Load On Your Hard Disks

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

  iotop.noarch 0:0.3.2-3.el6                                                                                                                                                                 


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:
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
# iotop
Sample outputs:

iotop: Linux Disk I/O Monitor Command

Fig.01: iotop: Linux Disk I/O Monitor Command in Action

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:

iotop: Linux Disk I/O Tools To See Process Eating Disk I/O

Fig.02: Only See Process Eating Your Disk I/O

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

  1. Hit the left and right arrow keys to change the sorting.
  2. Hit r to reverse the sorting order.
  3. Hit o only to see processes or threads actually doing I/O, instead of showing all processes or threads.
  4. Hit p only show processes. Normally iotop shows all threads.
  5. 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.
  6. Ht i to change the priority of a thread or a process’ thread(s) i.e. ionice.
  7. Hot q to quit iotop.

Check out related media

Recommended readings:
Share this on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 4 comments… add one }
  • DDR Host February 3, 2015, 8:16 pm

    Thanks. This helped me a lot!

  • Nick July 23, 2012, 8:52 am

    correction: (from the program itself)

    iotop requires kernel-2.6.18-199.el5 or later

  • Prof. I Pee Freely July 22, 2012, 3:51 am

    Seems to be an alt for FBSD: http://freebsdwiki.net/index.php/Iotop

  • Arseny July 21, 2012, 4:36 am

    Good one! But – here is no iotop for FreeBSD?

    # whereis iotop

Security: Are you a robot or human?

Leave a Comment