Tuesday, February 28, 2012

How to Benchmark Hard Drive Read Speeds in Linux

First as root clear the buffer-cache to accurately measure read speeds directly from the device:
echo 3 > /proc/sys/vm/drop_caches
Next run the test:

sudo hdparm -Tt /dev/sda

NOTE: In the code above "/dev/sda" is the hard drive I wanted to benchmark you will have to change the hard drive identifier "/dev/sxx" to whatever hard drive you would like to benchmark.

Sample Output: (Crucial m4 128gb SATA III SSD)

/dev/sda:
Timing cached reads: 26764 MB in 2.00 seconds = 13397.24 MB/sec
Timing buffered disk reads: 1216 MB in 3.01 seconds = 404.64 MB/sec
root@ubuntu rizzo # sudo hdparm -Tt /dev/sda

/dev/sda:
Timing cached reads: 26976 MB in 2.00 seconds = 13503.76 MB/sec
Timing buffered disk reads: 1356 MB in 3.00 seconds = 451.66 MB/sec
root@ubuntu rizzo # sudo hdparm -Tt /dev/sda

/dev/sda:
Timing cached reads: 27148 MB in 2.00 seconds = 13589.38 MB/sec
Timing buffered disk reads: 1358 MB in 3.00 seconds = 452.58 MB/sec
root@ubuntu rizzo # sudo hdparm -Tt /dev/sda

/dev/sda:
Timing cached reads: 26458 MB in 2.00 seconds = 13243.58 MB/sec
Timing buffered disk reads: 1352 MB in 3.00 seconds = 450.17 MB/sec

Sample Output: (Seagate 1Tb 7200rpm Mechanical Drive)

/dev/sdb:
 Timing cached reads:   27010 MB in  2.00 seconds = 13520.18 MB/sec
 Timing buffered disk reads: 352 MB in  3.00 seconds = 117.33 MB/sec
rizzo@ubuntu ~ $ sudo hdparm -Tt /dev/sdb

/dev/sdb:
 Timing cached reads:   27248 MB in  2.00 seconds = 13639.73 MB/sec
 Timing buffered disk reads: 354 MB in  3.02 seconds = 117.41 MB/sec
rizzo@ubuntu ~ $ sudo hdparm -Tt /dev/sdb

/dev/sdb:
 Timing cached reads:   27700 MB in  2.00 seconds = 13866.26 MB/sec
 Timing buffered disk reads: 352 MB in  3.00 seconds = 117.33 MB/sec
rizzo@ubuntu ~ $ sudo hdparm -Tt /dev/sdb

/dev/sdb:
 Timing cached reads:   26386 MB in  2.00 seconds = 13208.40 MB/sec
 Timing buffered disk reads: 354 MB in  3.01 seconds = 117.42 MB/sec


NOTEThis test should be run at least three or four times to get an accurate average reading.


2 comments:

  1. Thanks a lot, my results:

    WD Caviar Black 1TB 7200RPM Sata II:
    /dev/sda:
    Timing cached reads: 17256 MB in 1.99 seconds = 8659.88 MB/sec
    Timing buffered disk reads: 292 MB in 3.01 seconds = 96.96 MB/sec

    /dev/sda:
    Timing cached reads: 14626 MB in 1.99 seconds = 7344.46 MB/sec
    Timing buffered disk reads: 306 MB in 3.02 seconds = 101.42 MB/sec

    /dev/sda:
    Timing cached reads: 14126 MB in 1.99 seconds = 7093.33 MB/sec
    Timing buffered disk reads: 306 MB in 3.01 seconds = 101.55 MB/sec

    /dev/sda:
    Timing cached reads: 14132 MB in 1.99 seconds = 7087.26 MB/sec
    Timing buffered disk reads: 190 MB in 5.89 seconds = 32.26 MB/sec

    Samsung 250GB 5400RPM 2.5" laptop harddisk
    I have used a partition due to my disk have bad sectors at first

    /dev/sdb1:
    Timing cached reads: 18410 MB in 1.99 seconds = 9240.21 MB/sec
    Timing buffered disk reads: 176 MB in 3.02 seconds = 58.18 MB/sec

    /dev/sdb1:
    Timing cached reads: 17734 MB in 1.99 seconds = 8898.51 MB/sec
    Timing buffered disk reads: 176 MB in 3.03 seconds = 58.16 MB/sec

    /dev/sdb1:
    Timing cached reads: 18352 MB in 1.99 seconds = 9212.13 MB/sec
    Timing buffered disk reads: 176 MB in 3.01 seconds = 58.46 MB/sec

    /dev/sdb1:
    Timing cached reads: 18400 MB in 1.99 seconds = 9235.10 MB/sec
    Timing buffered disk reads: 176 MB in 3.01 seconds = 58.41 MB/sec

    ReplyDelete
    Replies
    1. IBM thinkpad X41 kingspec 1.8' IDE 32GB Solid State
      /dev/sda:
      Timing cached reads: 1316 MB in 2.00 seconds = 657.65 MB/sec
      Timing buffered disk reads: 222 MB in 3.00 seconds = 73.98 MB/sec

      /dev/sda:
      Timing cached reads: 1312 MB in 2.00 seconds = 655.64 MB/sec
      Timing buffered disk reads: 224 MB in 3.01 seconds = 74.41 MB/

      /dev/sda:
      Timing cached reads: 1302 MB in 2.00 seconds = 651.02 MB/sec
      Timing buffered disk reads: 222 MB in 3.02 seconds = 73.62 MB/sec

      Delete