Linux

Monitor Disk I/O Activity In Linux With Iotop Command

Monitor Disk I/O Activity In Linux With Iotop Command
Written by itsubuntu

Insight: Monitor Disk I/O Activity In Linux With Iotop Command

Similar like htop, iotop is a tool to monitor disk I/O  activity in Linux based operating systems. System administrators can used this tool to monitor process causing high disk I/O read/writes.

Iotop displays columns for the I/O bandwidth read and written by each process/thread during the sampling period. It also displays the percentage of time the thread/process spent while swapping in and while waiting on I/O. For each process, its I/O priority (class/level) is shown.

In addition, the total I/O bandwidth read and written during the sampling period is displayed at the top of the interface.

Monitor Disk I/O Activity In Linux With Iotop Command

How To Install iotop In Linux

You can install iotop using Package Manager. Go through the following command to install using package manager.

On CentOS, RHEL and Fedora

# yum install iotop -y

On Ubuntu, Linux Mint and Debian based operating system 
# apt-get install iotop

To install most recent version, you can install iotop from Source

# wget http://guichaz.free.fr/iotop/files/iotop-0.6.tar.bz2
# tar -xjvf iotop-0.6.tar.bz2
# cd iotop-0.6/
# ./setup.py install

Basic Usage of iotop:

Run the following command to monitor the disk usage of each running processes:

$ sudo iotop

You can also run iotop with -o or –only option to see current processes or threads and their disk usage.

$ sudo iotop --only

To monitor the disk I/O of the processes running following iotop command as the user itsubuntu.

$ sudo iotop -P -u itsubuntu

To display PID column instead of TID column:

$ sudo iotop -P

To monitor the disk I/O of the processes with the PID 1230 and 5555 only, you would run iotop as follows:

$ sudo iotop -P -p 1230 -p 5555

Displaying Total I/O Usage Per Process:

Run the following iotop command to display the total I/O per process:

$ sudo iotop -ao

More usage and options of iotop:

–version

Show the version number and exit
-h, –help
Show usage information and exit
-o, –only
Only show processes or threads actually doing I/O, instead of showing all processes or threads. This can be dynamically toggled by pressing o.
-b, –batch
Turn on non-interactive mode. Useful for logging I/O usage over time.
-n NUM, –iter=NUM
Set the number of iterations before quitting (never quit by default). This is most useful in non-interactive mode.
-d SEC, –delay=SEC
Set the delay between iterations in seconds (1 second by default). Accepts non-integer values such as 1.1 seconds.
-p PID, –pid=PID
A list of processes/threads to monitor (all by default).
-u USER, –user=USER
A list of users to monitor (all by default)
-P, –processes
Only show processes. Normally iotop shows all threads.
-a, –accumulated
Show accumulated I/O instead of bandwidth. In this mode, iotop shows the amount of I/O processes have done since iotop started.
-k, –kilobytes
Use kilobytes instead of a human friendly unit. This mode is useful when scripting the batch mode of iotop. Instead of choosing the most appropriate unit iotop will display all sizes in kilobytes.
-t, –time
Add a timestamp on each line (implies –batch). Each line will be prefixed by the current time.
-q, –quiet
suppress some lines of header (implies –batch). This option can be specified up to three times to remove header lines.
-qcolumn names are only printed on the first iteration,

-qq

column names are never printed,

-qqq

the I/O summary is never printed.

 



About the author

itsubuntu

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Dear lovely people, Welcome to itsubuntu.com

Join our mailing list to receive the freebies, tutorials, latest news and updates from our team.

You have Successfully Subscribed!