Sei sulla pagina 1di 5

Linux Iotop Tool - Monitor Disk I/O Process

February 5, 2013 | By Bobbin Zachariah

Iotop tool is free open source free tool that monitor Disk Input/Output usage. Its helps system
administrator to find specific process that consume more disk usage and helps in performance
analysis. Iotop tool is supported from 2.6.20 kernel. This article explains how to install iotop and
how to use it.
What do you need before starting to use the iotop tool?
Python >= 2.7
Linux kernel 2.6.20

How to Install iotop


As root, run the following command to install iotop
# apt-get install iotop
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
iotop
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 22.2 kB of archives.
After this operation, 123 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ quantal/universe iotop i386 0.4.4-4 [22.2 kB]
Fetched 22.2 kB in 1s (17.6 kB/s)
Selecting previously unselected package iotop.
(Reading database ... 209916 files and directories currently installed.)
Unpacking iotop (from .../iotop_0.4.4-4_i386.deb) ...
Processing triggers for man-db ...
Setting up iotop (0.4.4-4) ...
Otherwise, you need to download the gzipped or bzipped file and extract it. Iotop is written in
Python, So Python is a prerequisit for iotop. Use the following commands to extract and install
iotop:
# tar -xjvf iotop-0.4.4.tar.bz2
iotop-0.4.4/
iotop-0.4.4/COPYING
iotop-0.4.4/PKG-INFO
iotop-0.4.4/NEWS
iotop-0.4.4/iotop/
iotop-0.4.4/iotop/__init__.py
iotop-0.4.4/iotop/netlink.py

iotop-0.4.4/iotop/ioprio.py
iotop-0.4.4/iotop/version.py
iotop-0.4.4/iotop/data.py
iotop-0.4.4/iotop/ui.py
iotop-0.4.4/iotop/genetlink.py
iotop-0.4.4/iotop/vmstat.py
iotop-0.4.4/.gitignore
iotop-0.4.4/iotop.py
iotop-0.4.4/ChangeLog
iotop-0.4.4/setup.py
iotop-0.4.4/README
iotop-0.4.4/iotop.1
iotop-0.4.4/setup.cfg
iotop-0.4.4/THANKS
iotop-0.4.4/bin/
iotop-0.4.4/bin/iotop
# cd iotop-0.4.4/
# ./setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/iotop
copying iotop/vmstat.py -> build/lib.linux-i686-2.7/iotop
copying iotop/genetlink.py -> build/lib.linux-i686-2.7/iotop
copying iotop/netlink.py -> build/lib.linux-i686-2.7/iotop
---Output Truncated---

iotop Usage
The iotop command must be run as root user. As normal user, when you run this command,
following error appears:
$ iotop
Netlink error: Operation not permitted (1)
iotop requires root or the NET_ADMIN capability.
By default, iotop is an interactive command like top. A sample output is
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd]
3 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0]
2052 be/4 rtkit 0.00 B/s 0.00 B/s 0.00 % 0.00 % rtkit-daemon

2053 be/4 rtkit 0.00 B/s 0.00 B/s 0.00 % 0.00 % rtkit-daemon
6 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0]
7 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0]
8 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/1]
2057 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % gconfd-2
10 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/1]
11 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/1]
12 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [cpuset]
13 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [khelper]
14 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kdevtmpfs]
15 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [netns]
17 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [sync_supers]
18 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [bdi-default]
19 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kintegrityd]
20 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kblockd]
21 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ata_sff]
22 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [khubd]
23 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [md]
25 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kworker/1:1]
26 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [khungtaskd]
27 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kswapd0]
28 be/5 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksmd]
29 be/7 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [khugepaged]
30 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [fsnotify_mark]
31 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ecryptfs-kthrea]
32 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [crypto]
In this output, at the very top, the first line is divided into two columns. The first column shows
the total DISK READ and the second column shows total DISK WRITE per second. Lines
following this line correspond to each process performing I/O. It lists the process ID, user
ownership, disk read, disk write, process name etc. for each process.
If you want to list only active processes, which are actually performing any disk I/O operation,
press o while iotop is running (to toggle), or alternatively, run iotop with -o option.
Total DISK READ: 124.51 K/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
2919 be/4 raghu 19.45 K/s 0.00 B/s 0.00 % 0.00 % transmission-gtk
5567 be/4 raghu 124.51 K/s 0.00 B/s 0.00 % 0.00 % totem /home/raghu/Downloads/01 Harjinder Singh - Mere Ram Rai.mp3
You can quit from iotop like top by pressing 'q'.
Following output is when running any io intense process, such as iozone
Total DISK READ: 123.96 K/s | Total DISK WRITE: 14.16 M/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
468 be/3 root 0.00 B/s 104.59 K/s 0.00 % 56.66 % [jbd2/sda8-8]

7083 be/4 root 0.00 B/s 13.80 M/s 0.00 % 36.45 % ./iozone -a
5568 be/4 raghu 123.96 K/s 0.00 B/s 0.00 % 0.00 % totem /home/raghu/Downloads/01 Harjinder Singh - Mere Ram Rai.mp3

Options for iotop


As stated above, the -o option lists the processes actually performing disk I/O.
The -b option runs iotop in non-interactive, batch mode. It can be used for logging purposes.
The -n options tells the number of iterations to be performed for batch mode:
# iotop -b -n1
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO COMMAND
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd]
3 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0]
2052 be/4 rtkit 0.00 B/s 0.00 B/s 0.00 % 0.00 % rtkit-daemon
2053 be/4 rtkit 0.00 B/s 0.00 B/s 0.00 % 0.00 % rtkit-daemon
6 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0]
7 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0]
8 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/1]
2057 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % gconfd-2
10 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/1]
11 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/1]
---Output Truncated--The -u option shows processes for a particular user.
# iotop -u raghu
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
2057 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % gconfd-2
2081 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % gvfs-afc-volume-monitor
2082 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % caja
2139 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % clock-applet
2084 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % matecomponent-activation-server --ac-activate
--ior-output-fd=18
2087 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % mate-bluetooth-applet
2088 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % mate-volume-control-applet
7247 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % chromium-browser --disable-new-tab-first-run
--enable-user-scripts
2055 be/4 raghu 0.00 B/s 0.00 B/s 0.00 % 0.00 % gconf-helper
-d option sets the delay between iterations.
# iotop -d 3
Total DISK READ: 0.00 B/s | Total DISK WRITE: 13.14 K/s

TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
350 be/3 root 0.00 B/s 0.00 B/s 0.00 % 0.01 % [jbd2/sda7-8]
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd]
3 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0]
2052 be/4 rtkit 0.00 B/s 0.00 B/s 0.00 % 0.00 % rtkit-daemon
2053 be/4 rtkit 0.00 B/s 0.00 B/s 0.00 % 0.00 % rtkit-daemon
6 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0]
Finally, the --version option prints the version number for iotop
# iotop --version
iotop 0.4.4

Some useful iotop command options


Move left or right arrow key to change the sorting.
-h :- option to see information of usage.
-r :- option to reverse the sorting order.
-o :- option to check processes or thread.
-b :- option to Turn On non-interactive mode to enable logging I/O usage.
-p :- PID to list all processes/threads to monitor.
-u :- USER option to list all the users to monitor.
-P :- option to list only processes. Normally iotop displays all threads.
-a :- option to check accumulated I/O instead of bandwidth.

You might also like

Potrebbero piacerti anche