Is there a good command line utility to monitor hard disk load on linux? Something like top but then monitoring disk activity i.s.o. cpu usage.

More specifically, I suspect that for some (heavy load) servers after several optimizations on various parts of the program(s) that run on it, right now the bottleneck is simply the logging to files on the disk. But I find it very difficult to assess how much traffic the servers can handle.

My ideal tool would be something that prints "You're using 35% of your disk bandwidth right now". Any ideas?

link|improve this question

80% accept rate
Perfect question, is exactly what I was looking for =) – Castanho Mar 2 '11 at 14:04
feedback

6 Answers

up vote 22 down vote accepted

You can get a pretty good measure of this using the iostat tool.

% iostat -dx /dev/sda 5

Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.78    11.03    1.19    2.82    72.98   111.07    45.80     0.13   32.78   1.60   0.64

The disk utilisation is listed in the last column. This is defined as

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

link|improve this answer
feedback

iotop is a version of top that looks at how much IO each process is using. It's in the standard ubuntu repositories; I don't know if it's in RHEL or Fedora, but it should be.

enter image description here

link|improve this answer
Indeed, it isn't installed by default in Ubuntu, so one could issue: sudo apt-get install iotop to get it – Moshe May 18 '09 at 15:05
1  
iotop requires a kernel higher than 2.6.20, which unfortunately rules out both RedHat el4 and el5. – Dave Cheney May 19 '09 at 1:58
1  
As of RedHat 5.4, the bits required to make iotop work have been backported. Enjoy! – Dave Cheney Feb 22 '10 at 8:27
feedback

to find out what your total bandwidth is you might use hdparm -T /dev/sda to test the buffer cache (fileio) performance hdparm -t /dev/sda to test the device read performance

examples: my laptop gets 82MB/sec from the SATA disk and 2GB/sec from the cache. My dekstop gets 12GB/sec from the cache and 500MB/sec from the HW RAID array. I suspect those last numbers could be double on server class hardware.

set readahead higher than 256, 4096 works best for me

for i in 128 256 512 1024 2048 4096 8192 16384 32768  
do  
hdparm --setra $i  
  for j in 1 2 4 8 16 32  
  do  
  time dd if=/dev/sda of=/dev/null bs="$j"k  count=<fixthis> 1GB / blocksize  
  done  
done  

times reading 1GB at different block sizes and different read-aheads

link|improve this answer
Welcome to SF. You can use code highlighting in your posts by putting backquotes around strings or indenting paragraphs. – Raphink Feb 22 at 10:00
feedback

The standard tool for showing hard disk load is iostat.

It won't tell you how much %age disk bandwidth you're using, since it doesn't know how much bandwidth your disk has. In any case, your disk only has the manufacturer's quoted figure for large transfers of contiguous data.

link|improve this answer
feedback

I think RRDtool should do what you want here it uses a daemon to dump system data and then allows you to process it however you like. I have often used it to produce graphs etc. to measure system load.

link|improve this answer
feedback

I would recommend taking a look at the nmon tool. It will show you live load on a number of system parameters as well as recording data to a file for later perusal. It's a free tool available here:

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.