Iotop and iostat, monitor disk I / O performance

about iotop and iostat

In the next article we are going to take a quick look at how we can monitor disk I / O performance in Ubuntu using iotop and iostat tools. As a general rule, users can use the command top to know the execution processes of the system (and more things) in real time and identify potential problems. But if we don't find any performance issues regarding the resource utilizationEspecially with CPU and memory, it is interesting to move on to checking other fields to identify bottlenecks.

In the command output top there are fields we can use to find out if there are high I / O read and write operations on storage devices and partitions. If disk I / O operation is high, it may be the cause of performance lag, so the disk I / O statistics in the system should be verified, and this is where the iotop and iostat tools can help us.

Iotop and iostat to verify I / O statistics

To check the I / O statistics in detail, users can use the iotop and iostat commands. These commands are used to identify performance problems with storage devicesincluding local disks or the network file system.

What is iotop?

This utility It is similar to the top command, but it shows the disk activity in real time. This utility looks at the kernel I / O usage information and displays a table of the current I / O usage through processes or threads on the system. It also shows the bandwidth and the read and write I / O time of each process or thread.

Install Iotop

This utility we can install easily with the help of apt package manager. For Debian / Ubuntu systems, we will only have to open a terminal (Ctrl + Alt + T) and execute the command:

install iotop

sudo apt install iotop

Monitor disk I / O activity using iotop

There are many options available in the iotop command to check the various statistics about disk I / O. We will only have to execute the iotop command without any argument, even though we will have to run it with superuser privileges, to see each process or thread about the current I / O usage:

iotop working

sudo iotop

For check which processes are actually using disk I / O, we will have to add to the iotop command the -oo –only option:

iotop shows only processes

sudo iotop --only

For see more options applicable to iotop, in a terminal we can consult your help with the command:

iotop help

iotop --help

uninstall

For remove iotop from our team, in a terminal (Ctrl + Alt + T) we will only have to execute:

uninstall iotop

sudo apt remove iotop

What is iostat?

The command iostat is used to monitor the load of the input / output device of the system, looking at how long devices are active in relation to their average transfer rates. It can also be used to compare activity between disks.

This command generates reports that can be used to change the system configuration to better balance the input / output load between the physical disks. The iostat command generates two types of reports; CPU utilization y use of the device.

In multiprocessor systems, CPU statistics are calculated across the system as an average across all processors.

Install iostat

The tool iostat is part of the sysstat package, which can be installed from the official repository. We will only need to open a terminal (Ctrl + Alt + T) and execute the command in it:

install sysstat package

sudo apt install sysstat

Measuring disk I / O performance with the iostat command

There are many options available in the iostat command to check various CPU and disk I / O statistics. If we execute the iostat command without any argument we can view full system statistics:

iostat working

iostat

If we add the -d option to the iostat command, we can view I / O statistics for all devices:

iostat -d

On the other hand, if we add the -p option to the iostat command, we will show I / O statistics of all devices and their partitions.

iostat -p

If what interests us is view detailed I / O statistics for all devices, we will only need to add the -x option to the iostat command:

iostat -x

If we are interested know the I / O statistics of block devices and all their partitions used by the system, we just need to add the -p option followed by the device name:

iostat device

iostat -p sda

uninstall

For remove iostat from our team, we just need to open a terminal (Ctrl + Alt + T) and execute in it:

uninstall iostat

sudo apt remove sysstat

We have just seen two more tools that can help a system administrator to detect disk performance problems using commands iotop e iostat. For more information, the user who wants can consult the source of this article.


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.