Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
For a noob friendly version of this you can find it at vpstip.com/how-to-check-disk-speed-easily-in-linux –  user204691 Jan 8 at 3:10

5 Answers 5

up vote 7 down vote accepted

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.

share|improve this answer
    
Can I measure the necessary info just with linux commands? –  Roman Dec 14 '10 at 14:09
1  
+1 You might want to pick a block size larger than 1 sector unless your after a specific performance metric. I normally use bs=1m and count=1k (the 512 and 32m will fit in RAM and any raid controller's cache easily.). Same goes for read operations. Note that dd will give you pretty synthetic numbers unless you know your IO load very well and use very specific numbers. –  Chris S Dec 14 '10 at 15:50
    
You should also use oflag=direct to bypass the filesystem cache. This obviates the need to write out twice as much data as your available ram as well, which means your tests are quicker to run –  Daniel Lawson Dec 17 '10 at 3:08

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

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

iometer has also been around for a while.

share|improve this answer

protected by Chris S Jan 8 at 3:23

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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