Using Linux Iotop to check disk IO usage Per process
Updated: Jul 30
Iotop is an interactive real-time I/O usage monitoring tool to check disk read and write bandwidth usage for each running process on Linux. Iotop is very useful to troubleshoot disk performance issues on Linux.
We can easily find out which process is generating workload to our disks. Let us check out how to use iotop.
Install iotop on CentOS/Redhat Linux
iotop is available in the official package repository of CentOS/Redhat. We can easily install it with the YUM package manager as follows:
$ sudo yum install iotop -y
Install iotop on Ubuntu Linux
$ sudo apt update
$ sudo apt install iotop
How to use iotop on Linux
We can use the following useful 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.
Hit i to change the priority of a thread or a process’ thread(s) i.e. ionice.
Hit q to quit iotop.
The “total” values show the amount of data read from or written to the disk block device driver, and the “actual” values show the numbers for the actual hardware disk I/O. File system caching is one of the reasons for the difference in the values.
Check Total IO Usage Per Process
$ sudo iotop -ao
Check Process ID instead of TID in iotop
$ sudo iotop -P
Filter by Process id or username in iotop
$ sudo iotop -P -p 110 -p 112
$ sudo iotop -P -u howtouselinux1 -u howtouselinux2