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. This tool allows you to monitor I/O statistics for each device or partition. 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 disk devices:

$ sudo iostat -xd <update interval in seconds>

The above iostat command will report per-device I/O statistics, including # of read/write requests per second (noted as r/s, w/s), average read/write speed (in KB/s), average read/write wait time (in milliseconds), average size of requests (in sectors), and percentage of CPU time spent for I/O requests. The statistics are refreshed every time interval specified.

To monitor disk I/O of individual disk partitions:

$ sudo iostat -pxd <update interval in seconds>

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.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

9 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.

    • More likely a high CPU load, I guess. "Top" to identify the most CPU-heavy processes and cpulimit to leash them might help.

    • A little off-topic, but not really since it was mentioned by Ruben looking for an answer to his Hot laptop issue.

      For those people who stumble upon this old thread with a 'Hot' Laptop ~or~ computer (with thermal sensors) and find no abnormal drive or cpu usage the following is most likely to be the cause of your overheating problem:

      Laptops as we know are very thin and therefore have Much smaller (tiny) cooling fins and fan(s).

      Think of any computer as a sort of vacuum cleaner...

      Air is usually sucked in through a grid opening directly under the laptop by each fan itself or relatively near each fan, forced through these fins and blown out the side or back depending on model much in the same way air is forced through motor vehicle radiators to cool engines.

      Over time these very Tiny radiators get plugged up with dust and hair sucked up by the fan(s) and blown into the fins.
      The same holds true for larger computers where this same debris collects in much greater quantity all over everything inside of the case and especially the cooling fins of the CPU heatsink(s).

      It is this collection of debris that will eventually stop all airflow and cooling as the debris collects not only on the fins but also the fan blades and shrouds.

      Using an air compressor with at least a 3 gallon tank and 90 PSI...
      For laptops 'short' bursts of highly compressed air IN through the Exhaust port(s) (rear or side) will expel 99% of the debris out through the inlet port(s) and everywhere else like through the keyboard leaving only trace amounts on the fan.
      Be very careful using Short bursts so not to spin up the fan too fast and damage it as it is probably on it's last leg already from all of that extra weight and heat. Not to mention that they will also become little generators and backfeed voltage into the MB.

      TIP: You may also use a paper clip or toothpick poked in to stop the blades from spinning if you really want to blast it.

      Finish blowing off the rest of the laptop ports and keys.

      Larger machines need a real good full blasting of everything inside including through the PSU (in reverse direction of normal airflow just like laptops) using the same fan trick for the other fans using your finger instead of a toothpick / paper clip.
      You will need a dust mask for desktop and server sized machines as they often contain enormous amounts of debris from never being cleaned.

      Machines that are up 24/7 should be cleaned once a month.

  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?

  4. Lots of people have found collectl very useful - sort of a swiss army knife because it can report anything most of the 'standard' tools report and do it in a much more compressed easy to read format. If you want to look at detailed disk data just run collectl -sD and you'll see similar output to iostat but in what I'd claim is much easier to read. see for just a subset of what it can do.

    Best of all you can save the data to disk and play it back as often as you like, changing switches each time.

    try it, you'll like it...

  5. Good tool for monitoring any resource is "sar" (should be part of sysstat as well). To monitor disk I/O, type "sar -d 5 5" - 5 readings every 5 seconds. Use -p for nicer view (dev to disk translation).

Leave a comment

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