Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How to check the performance of a hard drive (Either via terminal or GUI). The write speed. The read speed. Cache size and speed. Random speed.

share|improve this question
add comment

5 Answers 5

up vote 77 down vote accepted

Terminal method

hdparm is a good place to start.

sudo hdparm -Tt /dev/sda

Timing cached reads:   12540 MB in  2.00 seconds = 6277.67 MB/sec
Timing buffered disk reads: 234 MB in  3.00 seconds =  77.98 MB/sec

sudo hdparm -v /dev/sda will give information as well.

dd will give you information on write speed. If the drive doesn't have a file system use of=/dev/sda. Otherwise, mount it on /tmp and write then delete the test output file.

dd if=/dev/zero of=/tmp/output bs=8k count=10k; rm -f /tmp/output

10240+0 records in
10240+0 records out
83886080 bytes (84 MB) copied, 1.08009 s, 77.7 MB/s

Graphical method

  1. Go to System -> Administration -> Disk Utility.
    • Alternatively, launch the Gnome disk utility from the command line by running gnome-disks
  2. Select your hard disk at left pane.
  3. Now click “Benchmark – Measure Drive Performance” button in right pane.
  4. A new window with charts opens.You will find and two buttons. One is for “Start Read Only Benchmark” and another one is “Start Read/Write Benchmark”. When you click on anyone button it starts benchmarking of hard disk.


Is there something more you want?

share|improve this answer
Nice input about DD. +1 –  Luis Alvarado Dec 12 '11 at 1:17
glad you liked the dd trick =) –  bodhi.zazen Dec 12 '11 at 1:20
Seeing as the question is tagged for 11.10, I just thought I'd point out the Disk Utility can also be searched for easily in the Unity dash, or located under the Accessories category of the Applications lens using the provided filter. –  WarriorIng64 Dec 12 '11 at 1:25
There is no such "System ->" on my Ubuntu 12.04 Unity. Or at least I haven't found it. And I do not see that disk tool neither within System Settings... O_o But I finallly managed to run it: /usr/bin/palimpsest –  Fran Nov 30 '12 at 22:00
Note that since 12.10 it's simply called Disks and can be found through Unity. –  Paul Lammertsma Feb 14 at 11:18
show 4 more comments

Suominen is right, we should use some kind of sync; but there is a simpler method, conv=fdatasync will do the job:

dd if=/dev/zero of=/tmp/output conv=fdatasync bs=384k count=1k; rm -f /tmp/output
1024+0records in
1024+0 records out
402653184 bytes (403 MB) copied, 3.19232 s, 126 MB/s
share|improve this answer
This is a valuable comment, not really an answer on its own. –  gertvdijk Aug 18 '13 at 18:32
I have just registered here, I can not add comments, (except to my own answer), that requires 50 reputation. –  Tele Aug 18 '13 at 18:38
It's an answer using a different command/option than the others. I see it's an answer worthy of a post of its own. –  Alaa Aug 18 '13 at 19:01
Why have you used 384k as block size? –  Diego F. Durán Jun 2 at 14:39
add comment

I would not recommend using /dev/urandom because it's software based and slow as pig. Better to take chunk of random data on ramdisk. On hard disk testing random doesn't matter, because every byte is written as is (also on ssd with dd). But if we test dedupped zfs pool with pure zero or random data, there is huge performance difference.

Another point of view must be the sync time inclusion; all modern filesystems use caching on file operations.

To really measure disk speed and not memory, we must sync the filesystem to get rid of the caching effect. That can be easily done by:

time sh -c "dd if=/dev/zero of=testfile bs=100k count=1k && sync"

with that method you get output:

sync ; time sh -c "dd if=/dev/zero of=testfile bs=100k count=1k  && sync" ; rm testfile 
1024+0 records in
1024+0 records out
104857600 bytes (105 MB) copied, 0.270684 s, 387 MB/s

real    0m0.441s
user    0m0.004s
sys 0m0.124s

so the disk datarate is just 104857600 / 0.441 = 237772335 B/s --> 237MB/s

That is over 100MB/s lower than with caching.

Happy benchmarking,

share|improve this answer
add comment

If you want to monitor the disk read and write speed real-time you can use the iotop tool.

This is useful to get exact information about how a disk performs for a particular application or task. The output will show you read/write speed per process, and total read/write speed for the server, much similar to top.

To install iotop Install iotop:

sudo apt-get install iotop  

Or click the button below:

Install via the software center

To run it:

sudo iotop
share|improve this answer
add comment

bonnie++ is the ultimate benchmark utility I know for linux.

(I'm currently preparing a linux livecd at work with bonnie++ on it to test our windows-based machine with it!)

It takes care of the caching, syncing, random data, random location on disk, small size updates, large updates, reads, writes, etc. Comparing a usbkey, a harddisk (rotary), a solid-state drive and a ram-based filesystem can be very informative for the newbie.

I have no idea if it is included in Ubuntu, but you can compile it from source easily.



share|improve this answer
add comment

protected by Community Feb 12 at 16: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.