Disk I/O iostat Command iotop Command Linux Linux Commands Linux Disk Monitoring Linux IO Statistics Linux Performance Monitoring Monitor Disk IO monitoring-tools sysstat Command

How To Monitor Disk I/O Activity Using iotop And iostat Commands In Linux?

Have you learnt what are the tools we will use for troubleshooting or monitoring real-time disk activity in Linux?

If Linux system performance gets slow down we might use prime command to see the system efficiency.

It is used to verify what are the processes are consuming high utilization on server.

It’s widespread for a lot of the Linux administrator.

It’s extensively used by Linux administrator in the actual world.

When you don’t see much distinction within the process output still you’ve an option to verify other issues.

I want to advise you to examine wa standing in the prime output as a result of most of the time the server performance can be degraded as a consequence of excessive I/O Read and Write on exhausting disk.

If it’s high or fluctuation, it could possibly be a cause. So, we have to verify I/O activity on exhausting drive.

We will monitory disk I/O statistics for all disks and file system in Linux system utilizing iotop and iostat commands.

What Is iotop?

iotop is a top-like utility for displaying real-time disk exercise.

iotop watches I/O usage info output by the Linux kernel and displays a desk of present I/O usage by processes or threads on the system.

It displays the I/O bandwidth read and written by every course of/thread. It additionally displays the share of time the thread/process spent while swapping in and whereas waiting on I/O.

Complete DISK READ and Complete DISK WRITE values characterize complete learn and write bandwidth between processes and kernel threads on the one aspect and kernel block system subsystem on the opposite.

Actual DISK READ and Actual DISK WRITE values symbolize corresponding bandwidths for precise disk I/O between kernel block system subsystem and underlying hardware (HDD, SSD, and so on.).

How To Install iotop In Linux?

We will easily set up it with help of package deal manager because the package deal is on the market in all the Linux distributions repository.

For Fedora system, use DNF Command to put in iotop.

$ sudo dnf set up iotop

For Debian/Ubuntu techniques, use APT-GET Command or APT Command to install iotop.

$ sudo apt set up iotop

For Arch Linux based mostly methods, use Pacman Command to put in iotop.

$ sudo pacman -S iotop

For RHEL/CentOS methods, use YUM Command to install iotop.

$ sudo yum install iotop

For openSUSE Leap system, use Zypper Command to put in iotop.

$ sudo zypper set up iotop

How To Monitor Disk I/O Activity/Statistics In Linux Using iotop Command?

There are numerous options are available in iotop command to examine varies statistics about disk I/O.

Run the iotop command without any arguments to see every process or thread present I/O utilization.

# iotop

If you need to verify which process are literally doing IO then run the iotop command with -o or –solely choice.

# iotop –solely

Particulars:

  • IO: It exhibits I/O utilization for every course of, which includes disk and swap.
  • SWAPIN: It exhibits only the swap utilization of each process.

What Is iostat?

iostat is used to report Central Processing Unit (CPU) statistics and enter/output statistics for units and partitions.

The iostat command is used for monitoring system input/output gadget loading by observing the time the units are lively in relation to their common switch rates.

The iostat command generates stories that can be used to vary system configuration to raised stability the enter/output load between bodily disks.

All statistics are reported each time the iostat command is run. The report consists of a CPU header row adopted by a row of CPU statistics.

On multiprocessor methods, CPU statistics are calculated system-wide as averages amongst all processors. A device header row is displayed followed by a line of statistics for every gadget that’s configured.

The iostat command generates two kinds of reviews, the CPU Utilization report and the System Utilization report.

How To Set up iostat In Linux?

iostat software is part of sysstat package deal so, We will simply set up it with assist of package deal supervisor because the package deal is out there in all of the Linux distributions repository.

For Fedora system, use DNF Command to install sysstat.

$ sudo dnf set up sysstat

For Debian/Ubuntu methods, use APT-GET Command or APT Command to install sysstat.

$ sudo apt install sysstat

For Arch Linux based mostly techniques, use Pacman Command to install sysstat.

$ sudo pacman -S sysstat

For RHEL/CentOS methods, use YUM Command to put in sysstat.

$ sudo yum install sysstat

For openSUSE Leap system, use Zypper Command to install sysstat.

$ sudo zypper set up sysstat

How To Monitor Disk I/O Activity/Statistics In Linux Using sysstat Command?

There are numerous choices can be found in iostat command to verify varies statistics about disk I/O and CPU.

Run the iostat command without any arguments to see complete statistics of the system.

# iostat

Linux 4.19.32-1-MANJARO (daygeek-Y700) Thursday 18 April 2019 _x86_64_ (8 CPU)

avg-cpu: %consumer %nice %system %iowait %steal %idle
29.45 Zero.02 16.47 0.12 0.00 53.94

System tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
nvme0n1 6.68 126.95 124.97 Zero.00 58420014 57507206 0
sda 0.18 6.77 80.24 0.00 3115036 36924764 0
loop0 Zero.00 Zero.00 Zero.00 Zero.00 2160 0 Zero
loop1 0.00 Zero.00 0.00 Zero.00 1093 Zero 0
loop2 0.00 0.00 0.00 0.00 1077 Zero 0

Run the iostat command with -d choice to see I/O statistics for all the units

# iostat -d

Linux 4.19.32-1-MANJARO (daygeek-Y700) Thursday 18 April 2019 _x86_64_ (eight CPU)

Gadget tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
nvme0n1 6.68 126.95 124.97 Zero.00 58420030 57509090 Zero
sda Zero.18 6.77 80.24 0.00 3115292 36924764 0
loop0 Zero.00 Zero.00 Zero.00 0.00 2160 0 0
loop1 Zero.00 0.00 0.00 0.00 1093 Zero 0
loop2 Zero.00 Zero.00 0.00 0.00 1077 0 0

Run the iostat command with -p option to see I/O statistics for all the units and their partitions.

# iostat -p

Linux four.19.32-1-MANJARO (daygeek-Y700) Thursday 18 April 2019 _x86_64_ (eight CPU)

avg-cpu: %consumer %good %system %iowait %steal %idle
29.42 0.02 16.45 Zero.12 Zero.00 53.99

System tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
nvme0n1 6.68 126.94 124.96 Zero.00 58420062 57512278 0
nvme0n1p1 6.40 124.46 118.36 0.00 57279753 54474898 Zero
nvme0n1p2 0.27 2.47 6.60 0.00 1138069 3037380 0
sda 0.18 6.77 80.23 0.00 3116060 36924764 Zero
sda1 0.00 Zero.01 Zero.00 0.00 3224 Zero 0
sda2 0.18 6.76 80.23 Zero.00 3111508 36924764 0
loop0 0.00 Zero.00 0.00 0.00 2160 0 0
loop1 0.00 Zero.00 Zero.00 Zero.00 1093 Zero 0
loop2 0.00 Zero.00 0.00 Zero.00 1077 0 0

Run the iostat command with -x option to see detailed I/O statistics for all of the units.

# iostat -x

Linux four.19.32-1-MANJARO (daygeek-Y700) Thursday 18 April 2019 _x86_64_ (8 CPU)

avg-cpu: %consumer %good %system %iowait %steal %idle
29.41 Zero.02 16.45 Zero.12 Zero.00 54.00

System r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz aqu-sz %util
nvme0n1 2.45 126.93 Zero.60 19.74 0.40 51.74 four.23 124.96 5.12 54.76 3.16 29.54 0.00 Zero.00 0.00 Zero.00 0.00 Zero.00 0.31 30.28
sda 0.06 6.77 0.00 0.00 8.34 119.20 Zero.12 80.23 19.94 99.40 31.84 670.73 Zero.00 Zero.00 0.00 Zero.00 Zero.00 0.00 0.00 Zero.13
loop0 Zero.00 0.00 Zero.00 Zero.00 Zero.08 19.64 Zero.00 0.00 0.00 Zero.00 0.00 0.00 0.00 Zero.00 Zero.00 Zero.00 Zero.00 0.00 Zero.00 Zero.00
loop1 Zero.00 Zero.00 0.00 Zero.00 0.40 12.86 Zero.00 Zero.00 0.00 Zero.00 Zero.00 0.00 Zero.00 Zero.00 0.00 0.00 0.00 Zero.00 Zero.00 Zero.00
loop2 0.00 Zero.00 Zero.00 0.00 Zero.38 19.58 Zero.00 0.00 0.00 Zero.00 0.00 Zero.00 Zero.00 Zero.00 0.00 0.00 Zero.00 0.00 Zero.00 0.00

Run the iostat command with -d [Device_Name] choice to see I/O statistics of specific system and their partitions.

# iostat -p [Device_Name]

# iostat -p sda

Linux four.19.32-1-MANJARO (daygeek-Y700) Thursday 18 April 2019 _x86_64_ (8 CPU)

avg-cpu: %consumer %nice %system %iowait %steal %idle
29.38 0.02 16.43 Zero.12 Zero.00 54.05

System tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sda Zero.18 6.77 80.21 Zero.00 3117468 36924764 Zero
sda2 Zero.18 6.76 80.21 0.00 3112916 36924764 Zero
sda1 0.00 Zero.01 Zero.00 Zero.00 3224 0 Zero

Run the iostat command with -m option to see I/O statistics with MB for all the units as an alternative of KB. By default it exhibits the output with KB.

# iostat -m

Linux four.19.32-1-MANJARO (daygeek-Y700) Thursday 18 April 2019 _x86_64_ (8 CPU)

avg-cpu: %consumer %nice %system %iowait %steal %idle
29.36 0.02 16.41 Zero.12 0.00 54.09

System tps MB_read/s MB_wrtn/s MB_dscd/s MB_read MB_wrtn MB_dscd
nvme0n1 6.68 0.12 0.12 0.00 57050 56176 0
sda Zero.18 0.01 0.08 0.00 3045 36059 0
loop0 Zero.00 Zero.00 Zero.00 0.00 2 Zero Zero
loop1 0.00 0.00 0.00 Zero.00 1 0 Zero
loop2 Zero.00 Zero.00 Zero.00 0.00 1 0 Zero

Run the iostat command with sure interval then use the next format. In this instance, we’re going to capture totally two reviews at 5 seconds interval.

# iostat [Interval] [Number Of Reports]

# iostat 5 2

Linux 4.19.32-1-MANJARO (daygeek-Y700) Thursday 18 April 2019 _x86_64_ (8 CPU)

avg-cpu: %consumer %nice %system %iowait %steal %idle
29.35 0.02 16.41 Zero.12 Zero.00 54.10

Gadget tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
nvme0n1 6.68 126.89 124.95 0.00 58420116 57525344 Zero
sda Zero.18 6.77 80.20 0.00 3118492 36924764 Zero
loop0 Zero.00 Zero.00 0.00 0.00 2160 Zero 0
loop1 Zero.00 0.00 0.00 0.00 1093 Zero Zero
loop2 Zero.00 Zero.00 0.00 0.00 1077 Zero 0

avg-cpu: %consumer %nice %system %iowait %steal %idle
three.71 Zero.00 2.51 Zero.05 0.00 93.73

Gadget tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
nvme0n1 19.00 0.20 311.40 0.00 1 1557 0
sda 0.20 25.60 Zero.00 Zero.00 128 Zero 0
loop0 Zero.00 Zero.00 0.00 0.00 Zero Zero Zero
loop1 0.00 Zero.00 0.00 Zero.00 0 0 0
loop2 0.00 Zero.00 0.00 Zero.00 0 Zero 0

Run the iostat command with -N choice to see the LVM disk I/O statistics report.

# iostat -N

Linux 4.15.Zero-47-generic (Ubuntu18.2daygeek.com) Thursday 18 April 2019 _x86_64_ (2 CPU)

avg-cpu: %consumer %nice %system %iowait %steal %idle
Zero.38 Zero.07 Zero.18 0.26 Zero.00 99.12

System tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 3.60 57.07 69.06 968729 1172340
sdb Zero.02 0.33 Zero.00 5680 Zero
sdc 0.01 0.12 Zero.00 2108 0
2g-2gvol1 Zero.00 Zero.07 0.00 1204 Zero

Run the nfsiostat command to see the I/O statistics for Network File System(NFS).

# nfsiostat