How to monitor disk I/O in Linux from command line

If your Linux system gets slow down due to heavy disk I/O activities, you probably want to know which processes or users (in case of multi-user systems) are the culprit for such activities. You may also wish to monitor disk I/O trending over time as part of daily Linux system administration. Here I will introduce several disk I/O monitoring tools on Linux.

Monitor disk I/O on per-process basis

If you want to monitor disk I/O activities of individual Linux processes, you can try iotop. This tool shows a sorted list of the most I/O intensive processes in real time via top-like interface.

To install iotop on Ubuntu or Debian, run the following.

$ sudo apt-get install iotop

To install iotop on Fedora, run:

$ sudo yum install iotop

To install iotop on CentOS or RHEL, first set up RepoForge repository on your system, and then use yum command.

$ sudo yum install iotop

To monitor disk I/O with iotop:

$ sudo iotop

Running iotop without any argument like above shows a list of all existing processes regardless of their disk I/O activities. If you want iotop to only show processes that are actually doing disk I/O, run the following instead.

$ sudo iotop -o

Monitor disk I/O on per-disk basis

If you are interested in monitoring disk read/write rates of individual disks, you can use iostat. To use this tool, you need to run sysstat package.

To install sysstat on Ubuntu or Debian:

$ sudo apt-get install sysstat

To install sysstat on CentOS, RHEL or Fedora:

$ sudo yum install sysstat

To monitor disk I/O of individual disks with iostat:

$ sudo iostat <update_interval_in_seconds>
Linux 3.2.0-29-generic-pae (my_host) 	04/06/2013 	_i686_	(2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2.11    0.08    3.20    3.65    0.00   90.96

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda              55.77      1403.98      2138.71    4139635    6306020

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

4 thoughts on “How to monitor disk I/O in Linux from command line

  1. My laptop is always getting so hot! I think it's actually more of a HDD problem but I still wanna try iotop.

  2. vmstat is also pretty good for that too. And there is Glance if you are willing to fork out the money for it, but it is actually an excellent tool.

  3. Thanks for this tutorial.
    How can I install this in CLOUDLINUX 6.5 x86_64 standard - server?

Leave a comment

Your email address will not be published. Required fields are marked *

Current day month ye@r *