Linux iotop Check What’s Stressing Increasing Load On Hard Disks nixCraft Updated Tutorials/Posts

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
--versionshow program’s version number and exit
-h, --helpshow this help message and exit
-o, --onlyonly show processes or threads actually doing I/O
-b, --batchnon-interactive mode
-n NUM, --iter=NUMnumber of iterations before ending [infinite]
-d SEC, --delay=SECdelay between iterations [1 second]
-p PID, --pid=PIDprocesses/threads to monitor [all]
-u USER, --user=USERusers to monitor [all]
-P, --processesonly show processes, not all threads
-a, --accumulatedshow accumulated I/O instead of bandwidth
-k, --kilobytesuse kilobytes instead of a human friendly unit
-t, --timeadd a timestamp on each line (implies –batch)
-q, --quietsuppress 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.

Facebook Comments

More Stuff

Get started with IoT: How to build a DIY Blynk Board This tutorial is for those with some DIY hardware experience, though advanced beginners may find it a fun challenge. Also, experienced users might fin...
Living on the command line: Why mistakes are a good thing Failure = Freedom. Is that really true? For many organizations, it is. These groups of developers... or marketers or educators... are applying the bel...
Ubuntu -bash: do-release-upgrade: command not found nixCraft I am using Ubuntu Linux 16.04 LTS cloud server. I followed this page to upgrade Ubuntu 16.04 to 18.04 but, I am getting an error that read as ‘ -bash...
Linux Delete All Files In Directory Using Command Line nixCraft Up... I want to remove all files from a directory. Can you tell me Linux command to delete all files in a directory?Introduction: You can remove all files ...
Spread the love

Posted by News Monkey