Linux iotop Check What’s Stressing & Increasing Load On Hard Disks

last updated in Categories Hardware, Storage

The iotop command is top like utility for disk I/O. It watches I/O usage information output by the Linux kernel. It displays a table of current I/O usage by processes or threads on the Linux system. This post explains how to install and use iotop command to find out what’s stressing (or program names) on your hard drives under Linux operating systems.

Install iotop on Linux to see current I/O usage by processes or threads

You need to iotop as per your Linux distribution.

RHEL/CentOS install iotop

Use the yum command as follows:
# yum install iotop
Install iotop on a CentOS or RHEL using yum command

Debian/Ubuntu Linux install iotop

Debian / Ubuntu Linux user try the apt command or apt-get command as follows to install the same:
$ sudo apt-get install iotop
How to install iotop on a Debian Ubuntu Linux using apt-get

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

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

Linux iotop Check What’s Stressing & Increasing Load On Hard Disks

I recommend that you start the iotop command 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:

OptionsDescription
--version show program’s version number and exit
-h, --help show this help message and exit
-o, --only only show processes or threads actually doing I/O
-b, --batch non-interactive mode
-n NUM, --iter=NUM number of iterations before ending [infinite]
-d SEC, --delay=SEC delay between iterations [1 second]
-p PID, --pid=PID processes/threads to monitor [all]
-u USER, --user=USER users to monitor [all]
-P, --processes only show processes, not all threads
-a, --accumulated show accumulated I/O instead of bandwidth
-k, --kilobytes use kilobytes instead of a human friendly unit
-t, --time add a timestamp on each line (implies –batch)
-q, --quiet suppress some lines of header (implies –batch)

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:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Join the discussion at www.nixcraft.com

Historical Comment Archive

4 comment

Comments are closed.