iotop: simple top-like i/o monitor
iotop does for I/O usage what top does for CPU usage. It watches I/O usage information output by the Linux kernel (requires 2.6.20 or later) and displays a table of current I/O usage by processes on the system. This tool is written by Guillaume Chazarain and requires Python >= 2.5 and a Linux kernel >= 2.6.20 to run. This post introduces this very useful tool and shows how we can install it and use it.
iotop can be downloaded either as source package or a rpm package. Starting with lenny, debian includes iotop in the main repository and it can be installed just as simple as running:
aptitude install iotopThis is very cool indeed and kudos to the debian team to include iotop in lenny ![]()
For other distributions, we can install it from source using the following simple steps (be sure to have python2.5 before trying this); I am using git and this will download the latest trunk version 3, if this is not what you want download the tar.gz (ver 0.2.1) and use the stable version instead.
git clone git://repo.or.cz/iotop.git
cd iotop
./setup.py install
after this iotop will be installed under /usr/bin.
Let’s see what are the program parameters:
iotop -h
Usage: /usr/bin/iotop [OPTIONS]
DISK READ and DISK WRITE are the block I/O bandwidth used during the sampling
period. SWAPIN and IO are the percentages of time the thread spent respectively
while swapping in and waiting on I/O more generally. PRIO is the I/O priority at
which the thread is running (set using the ionice command).
Controls: left and right arrows to change the sorting column, r to invert the
sorting order, o to toggle the --only option, p to toggle the --processes
option, q to quit, any other key to force a refresh.
Options:
--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 threadsWe can run it interactively, just like top, by simply typing: iotop, or add some parameters like
iotop -o -d 2
We can also run it in batch mode using -b:
iotop -b -o -d 5
...
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO COMMAND
Total DISK READ: 0.00 B/s | Total DISK WRITE: 2.49 M/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO COMMAND
19215 be/1 mysql 0.00 B/s 1.24 M/s 0.00 % 2.58 % mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
11670 be/1 mysql 0.00 B/s 152.28 K/s 0.00 % 0.64 % mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
11656 be/1 mysql 0.00 B/s 1.11 M/s 0.00 % 0.00 % mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
Other similar tools are iopp (presented in a previous post) and pidstat from newer sysstat packages (>= Sysstat 8.0.0). Stay tuned for a future post on here is how you can run iotop on debian etch (that uses by default python2.4).
>

15th March 2009, 05:48
[...] another awesome top clone for Linux, this time to make monitoring disk I/O simple: iostat. This post over at MDLog has a great introduction and explanation. For me it was available with apt-get, as [...]
13th October 2009, 12:29
This should probably not be posted in the “CentOS” category – unless you can point to a CentOS package that’s available, or an easy (and safe) way to upgrade CentOS to Python 2.5.
13th October 2009, 12:48
@pgl: you are right. i just fixed that, thanks for letting me know.