Linux commands for measuring disk activity

Spread the love

Linux systems provide a handy suite of commands for helping you see how busy your disks are, not just how full. In this post, we’re going to examine five very useful commands for looking into disk activity. Two of the commands (iostat and ioping) may have to be added to your system and these same two commands require you to use sudo privileges, but all five commands provide useful ways to view disk activity.

Probably one of the easiest and most obvious of these commands is dstat.

dtstat

In spite of the fact that the dstat command begins with the letter “d”, it provides stats on a lot more than just disk activity. If you want to view just disk activity, you can use the -d option. As shown below, you’ll get a continuous list of disk read/write measurements until you stop the display with a ^c. Note that, after the first report, each subsequent row in the display will report disk activity in the following time interval and the default is only one second.

$ dstat -d
-dsk/total-
 read  writ
 949B   73k
  65k     0    <== first second
   0    24k    <== second second
   0    16k
   0	0 ^C

Including a number after the -d option will set the interval to that number of seconds.

$ dstat -d 10
-dsk/total-
 read  writ
 949B   73k
  65k   81M    <== first five seconds
   0    21k    <== second five second
   0  9011B ^C

Notice that the reported data may be shown in a number of different units — e.g., M (megabytes), k (kilobytes) and B (bytes).

Without options, the dstat command is going to show you a lot of other information as well — indicating how the CPU is spending its time, displaying network and paging activity, and reporting on interrupts and context switches.

Source link