Tools for monitoring disk I/O usage
iotop command is a top tool used to monitor disk I/O usage. iotop has a UI similar to top, including PID, user, I/O, process and other related information. Most of the IO statistics tools under Linux, such as iostat and nmon, can only count the reading and writing of the per device. If you want to know how each process uses IO, it will be troublesome. You can use the iotop command to check it easily.
iotop is written in Python language and requires Python2.5 (and above) and Linux kernel2.6.20 (and above). iotop provides source code and rpm packages, which can be downloaded from its official homepage.
Ubuntu
apt-get install iotop
CentOS
yum install iotop
Compile and install
wget http://guichaz.free.fr/iotop/files/iotop-0.4.4.tar.gz
tar zxf iotop-0.4.4.tar.gz
python setup.py build
python setup.py install
iotop (option)
-o: Only show processes with io operations
-b: Batch display, no interaction, mainly used for recording to files.
-n NUM: Display NUM times, mainly used in non-interactive mode.
-d SEC: Display every SEC seconds.
-p PID: monitored process pid.
-u USER: Monitored process user.
Commonly used shortcut keys for iotop:
You can see the effect by executing iotop directly:
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 [3]
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd]
3 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0]
4 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0]
5 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0]
6 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/1]
7 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/1]
8 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/1]
9 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [events/0]
10 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [events/1]
11 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [khhelper]
2572 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [bluetooth]