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
Debian/Ubuntu Linux install iotop
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
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
Other supported options by iotop command:
|--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
- 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
- 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.