Hard drive speed test using Linux command line and hdparm

Hard drive speed test using Linux command line and hdparm

 

Login as the root and enter the following command:
$ sudo hdparm -tT /dev/sda
OR
$ sudo hdparm -tT /dev/hda
Sample outputs:

/dev/sda:
 Timing cached reads:   7864 MB in  2.00 seconds = 3935.41 MB/sec
 Timing buffered disk reads:  204 MB in  3.00 seconds =  67.98 MB/sec

For meaningful results, this operation should be repeated 2-3 times. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test. Here is a for loop example, to run test 3 time in a row:
for i in 1 2 3; do hdparm -tT /dev/hda; done

Where,

  • -t :perform device read timings
  • -T : perform cache read timings
  • /dev/sda : Hard disk device file

First and most basic test is transfer speed test. Please note that all tests should be run multiple times and average time should be calculated to get more accurate result.

# hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 104 MB in  3.04 seconds =  34.25 MB/sec

The next test you want to perform is data transfer rate but this time bypassing hard drive’s buffer cache memory thus reading directly from the disk.

# hdparm -t --direct /dev/sda

/dev/sda:
 Timing O_DIRECT disk reads: 100 MB in  3.00 seconds =  33.31 MB/sec

In the next example we will instruct hdparm to read data from the second half of the disk that is if the hard drive size is 100GB.

hdparm --offset 50 -t /dev/sda
/dev/sda:
 Timing buffered disk reads (offset 50 GB):  72 MB in  3.05 seconds =  23.61 MB/sec

To obtain cached reads run the following command:

# hdparm --offset 50 -T /dev/sda

/dev/sda:
 Timing cached reads:   4484 MB in  2.00 seconds = 2246.69 MB/sec
Categories: Hard Drive, linux

Comments are closed.