How to measure disk throughput?

I want to know how many bytes per second can I write to the disk and read from it.

How can I do that on linux machine?


Use a benchmark tool like bonnie(++). It's easy to install on about every distribution, and since it measures different aspects, you get quite a good picture how the system performs in a given situation.

If you just want to use basic tools, you could use dd:

For write speed:

dd if=/dev/zero of=outputfile bs=512 count=32M

(The product of bs and count should be at least twice your RAM size)

For read speed:

dd if=outputfile of=/dev/null

Remember that this is a very rough estimate and measures a situation that is unlikely to occur in normal operations.


I would just use hdparm to measure the read speeds of the drives:

hdparm -t /dev/sda

you can test read speeds on formatted drives with data on it but be careful with writing as if wrongly used can corrupt data.

Hope that helps, RayQUang


Iozone, bonnie++, nmon (realtime) - they all work.


Josh Berkus gave a pretty detailed talk at pgCon 2009 on performance tuning; the first half or so is just dedicated to measuring disk I/O and solutions. It's big and long, but you only need to watch it once to get an idea of what sorts of things to think about.

Also take a look at the benchmarking video, which covers much of the same content.


iometer has also been around for a while.