Skip to Content

How to Check if a Disk is Busy in Linux

This article is part of the following series.

 

Disk utilization in iostat command is a key metric to check if a disk is busy or not in Linux. It is used to calculate the time percent that a disk was busy actively performing work during an interval.

Hope you can find out which disk is busy.

  • What is disk utilization in iostat?
  • How to Check Disk is Busy In Linux?
  • Understanding Disk Utilization For Shared Disks

 

What is disk utilization in iostat command?

In the iostat command, disk utilization refers to the percentage of time that a disk is actively performing I/O operations compared to the total time. It provides information about how effectively the disk is being utilized.

When you run the iostat command with disk statistics enabled, it displays various metrics related to disk utilization, including:

  • %util: The percentage of time the disk was busy handling I/O requests. It represents the overall utilization of the disk and indicates how heavily it is being utilized. Higher values indicate a higher load on the disk.

 

It is calculated by the OS as the time that disk was doing something.

When a disk at 90% utilization may be able to accept much more than an extra 10% of workload. But this disk is pretty busy now.

How to Check if a Disk is Busy In Linux?

We can use iostat command to monitor system input/output device loading. It can be executed by any user, and is typically the first command used to investigate disk I/O issues at the command line.

We can use iostat -xk interval to get the io status for our disks. The command output includes disk IOPS, bandwidth, latency etc. From the last column %util, we can see the disk utilization.

For example, iostat -xk 3 will print out the disk io status every 3 seconds. If the disk utilization is consistently high, that means this disk is busy.

The following is the official definition of disk utilization.

  • %util : Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.

 

Here’s an example of using the iostat command with high disk utilization.

Linux 5.4.0-74-generic (hostname) 06/18/2023 _x86_64_ (4 CPU)

Device rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util
sda 0.03 0.30 2501.06 40.28 100.53 5.76 536.44 1.87 23.10 2.35 95.12
sdb 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

In this example, the %util column for the sda device shows a value of 95.12. This indicates that the disk is highly utilized, with a significant amount of I/O operations being performed. A high %util value like this suggests that the disk is busy handling a heavy workload, and it may be a potential performance bottleneck.

It’s important to note that the threshold for what is considered a “high” %util value can vary depending on the specific system configuration and disk capabilities. However, generally speaking, values above 80% or 90% are often considered indicative of a busy disk.

Understanding Disk Utilization For Shared Disks

In a SAN environment, multiple servers or hosts can share a single disk, typically referred to as a Logical Unit Number (LUN) on the storage side. Each server sees the LUN as a separate disk and can perform I/O operations on it independently.

When it comes to disk utilization, it is important to consider that the metric is calculated from the perspective of each individual server or host. Each server has its own workload and can generate varying levels of I/O traffic to the shared disk. As a result, the disk utilization observed on each server may differ, even though they are accessing the same LUN on the storage side.

For example, Server A might be heavily utilizing the shared disk, resulting in high disk utilization from its perspective. Meanwhile, Server B might have a lighter workload and exhibit lower disk utilization for the same shared disk.

This distinction is essential to understand when monitoring and analyzing disk utilization in a SAN environment. It highlights that disk utilization metrics are specific to each server and can vary based on their individual I/O patterns and workload characteristics, even though they are accessing the same underlying disk resource.

Note that disk utilization is an interval summary. Disk I/O can occur in bursts, especially due to write flushing, which can be disguised when summarizing over longer intervals.

 

Related post:

Linux Performance: High IOwait on Linux