Introduction
Most of the IO statistics tools under Linux, such as Iostat, Nmon, and so on, are only counted to the Per Device's read and write situations, and if you want to know how each process uses IO, it's a bit cumbersome.
Iotop is a top class tool used to monitor disk I/O usage. Iotop has a UI similar to top, which includes information about PID, user, I/O, process, and so on.
Example
Just run it straight.
Iotop
The output is as follows
Total DISK READ: 6.01/s | Total DISK write: 3.85 k/s TID PRIO USER DISK READ disk write swapin io> COMMAND 20074 be/4 hadoop 6.01 m /s 0.00 B/S 0.00% 4.54 java-dproc_datanode-xmx8192m- Server org.apache.hadoop.hdfs.server.datanode.DataNode 6371 be/4 Hadoop 0.00 B/S 3.25/M 0.00 0.00% Java-dproc_datanode-xmx8192m-server org.apache.hadoop.hdfs.server.datanode.DataNode 8497 BE/4 Hadoop 0.00 B/S 3.67 m/s 0.00% 0.00% Java-dproc_datanode-xmx8192m-server Org.apache.hadoop.hdfs.server.datanode.DataNode 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]
by outputting The result, we can clearly know what program is reading and writing disk, speed and command line, PID and other information.
Linux process Real-time IO monitoring iotop command detailed