Any Linux sysadmins reading this?

In FreeBSD, I can use systat to find out how busy a given disk is. It looks like this:

Disks   da0   da1 pass0 pass1   md0
KB/t  26.67 22.10  0.00  0.00  0.00
tps       1     8     0     0     0
MB/s   0.02  0.18  0.00  0.00  0.00
% busy    0     4     0     0     0
queue     0     0     0     0     0

See, disk da1 was 4% busy during that 5 second snapshot. (I ran systat -v 5).

That's very useful when diagnosing a disk-bound MySQL server that's not doing lots of I/O but ends up waiting for lots of disk seeks on a slow RPM drive.

How do I do that in Linux?

I don't want to know how much I/O it's doing--that's easy... I want to know how often it's servicing an I/O request ('cause it may spend a lot of time seeking). I need to know how busy the disk is--even if it's not doing any I/O at the moment.

vmstat will give me I/O figures (read & write) but not % busy.

On Solaris, I'll use iostat to look at the average wait time for disk requests. It turns out that Linux can do the same thing. The await value tells you this.

However, I ran iostat -d -k -x 5 but got no data--just headers. It seems that -x only works in post 2.5 kernels. Damn.


My questions are two-fold:

  1. Can I get those stats for a 2.4.xx kernel? How?
  2. Can I get something like FreeBSD's systat % busy value in Linux? How?

Thanks to any pointers you might offer.

Update: Steve tried iostat -x on his RedHat 8 box and got meaningful output. Now I'm really puzzled.

Posted by jzawodn at June 24, 2003 08:46 PM

Reader Comments
# Steve Friedl said:

The "sysstat" package works fine on my Red Hat 8.0 based 2.4 kernel, and it shows how busy the drives are.

on June 24, 2003 09:09 PM
# Charles Nadeau said:


I have sysstat 3.3.6 running on my Gentoo 1.4_rc4 box and here is what I get:

Mosix6 root # iostat -x dev3-0 5 2
Linux 2.4.20-openmosix-r6 (Mosix6) 06/25/03

avg-cpu: %user %nice %sys %idle
10.19 88.28 1.51 0.02
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util

avg-cpu: %user %nice %sys %idle
0.40 99.40 0.20 0.00
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util

Mosix6 root #

Is it possible that the results returned depend on the drive model?
Just my 2 yens.


on June 24, 2003 09:56 PM
# said:

It depends on the block device driver.

on June 24, 2003 11:22 PM
# Harmen said:

Could it be the following kernel option has something to do with it:
[ ] Per partition statistics in /proc/partitions (NEW)
which has the following help:

If you say yes here, your kernel will keep statistical information
for every partition. The information includes things as numbers of
read and write accesses, the number of merged requests etc.
This is required for the full functionality of sar(8) and interesting
if you want to do performance tuning, by tweaking the elevator, e.g.
If unsure, say N.

(at least availebla in 2.4.20)

on June 25, 2003 02:23 AM
# Ask Bjoern Hansen said:

I use `iostat -d -x /dev/sda 10` on my RedHat Network managed[1] RedHat 7.x boxes.

- ask

[1] so very stockish kernels.

on June 25, 2003 07:52 AM
# Craig said:

Using sysstat 4 on my somewhat mandrakey box works:

[craig@belphegore craig]$ uname -a
Linux 2.4.21-pre4 #2 SMP Sat Feb 15 14:37:57 PST 2003 i686 unknown unknown GNU/Linux
[craig@belphegore craig]$ rpm -q sysstat
[craig@belphegore craig]$ iostat -x
Linux 2.4.21-pre4 ( 06/25/2003

avg-cpu: %user %nice %sys %idle
0.66 0.01 0.18 99.15
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
0.84 0.87 0.09 0.09 7.45 7.66 82.78 0.14 783.98 58.56 0.11
0.84 0.87 0.09 0.07 7.46 7.52 90.96 0.13 811.01 58.22 0.10
0.65 2.94 0.34 3.48 7.89 51.34 15.52 0.15 44.77 40.32 1.54
0.65 2.94 0.34 3.48 7.89 51.34 15.52 0.17 44.77 26.68 1.02
0.01 0.01 0.00 0.00 0.09 0.09 58.06 0.21 574.34 49756.37 1.58
0.01 0.01 0.00 0.00 0.09 0.09 58.11 0.00 574.53 131.74 0.00
0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 233.33 233.33 0.00

on June 25, 2003 10:59 AM
# Chris Bolt said:

From the FAQ:
The iostat command has been updated to take advantage of Stephen Tweedie's kernel patch to display extended I/O statistics (option '-x' for iostat).
You can find Stephen's patch here:
Stephen used to maintain his patch for various kernel versions, but it is no longer the case. You will have to get one of the relevant patches (if they are still there) and update it by hand to suit your kernel. Note that some distros have this patch already applied.

on July 12, 2003 03:57 AM
# Chris Kantarjiev said:

The problem with iostat is that it shows me averages, not instantaneous values. This is the beauty of the BSD systat - I can see, at a glance, what's going on *right now*, and use that to make tuning decisions.

Bah humbug.

on March 9, 2007 01:20 PM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.


Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.