Viewing Disk Current Read and Write Speeds Using iotop Command in Linux System

Publish: 2019-11-27 | Modify: 2019-11-27

iotop command is a top-like tool for monitoring disk I/O usage. It has a similar UI to top, including information such as PID, user, I/O, and processes. Most IO statistics tools for Linux, such as iostat and nmon, can only track read and write operations per device. If you want to know how each process is using IO, it can be tricky. Using the iotop command, you can easily view this information.

Installing iotop command

Copy the following command according to your system:

# Ubuntu/Debian
apt-get install iotop
# CentOS
yum install -y iotop

iotop parameters

Enter iotop -h to view the usage help.

-o: Show only processes with IO activity.
-b: Batch mode, no interaction, mainly used for logging to a file.
-n NUM: Display NUM times, mainly used for non-interactive mode.
-d SEC: Display every SEC seconds.
-p PID: Monitor the process with the specified PID.
-u USER: Monitor processes owned by the specified user.
-k: Use kilobytes instead of human-readable units.

Using iotop

Enter the command iotop -k in the terminal to see the result as shown in the following image.

  • Total DISK READ: Total disk read.
  • Actual DISK READ: Actual disk read.
  • Total DISK WRITE: Total disk write.
  • Actual DISK WRITE: Actual disk write.
  • TID column: Process PID.
  • USER: User associated with the process.

iotop shortcuts

  • Left and right arrows: Change the sorting method, default is sorting by IO.
  • r: Change the sorting order.
  • o: Show only processes with IO output.
  • p: Toggle between process/thread display.
  • a: Display cumulative usage.
  • q: Quit.

Summary

The iotop command is very useful for identifying which process is using IO when troubleshooting disk read/write bottlenecks on a server. I recommend bookmarking it.

This article partially references: iotop command


Comments