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?
You can get a pretty good measure of this using the
iostat
tool.The disk utilisation is listed in the last column. This is defined as
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.
For older kernels (say CentOS 5.x or RHEL 5.x) that do not support iotop, use topio instead (documented here: http://yong321.freeshell.org/freeware/pio.html#linux. It relies on /proc//io for io statistics and provides similar functionality as iotop. See link for further details.
As suggested by sastanin in comments, you can process directly values given in
/sys/block/sda/stat
or/proc/diskstats
. This may be helpful when none of the other mentioned tools are available and you can't install them easily.For instance (IIUC) something like this (in bash) should give the number of reads per second :
See https://www.kernel.org/doc/Documentation/iostats.txt and https://www.kernel.org/doc/Documentation/block/stat.txt for documentation.
You should take a look at atop, which combines the power of iotop/top/iftop, all in one place, and highlights the critical parts on your system.
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:
to find out what your total bandwidth is you might use
hdparm -T /dev/sda
to test the buffer cache (fileio) performancehdparm -t /dev/sda
to test the device read performanceexamples: 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
times reading 1GB at different block sizes and different read-aheads
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.
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.
htop is a nice tool to check process information. You can add or remove columns and among them are read and write speeds of processes.