Disk Speed Testing in Linux


Disk Speed Testing in Linux

You are here:


If you are reading and writing files on a regular basis, then there is a chance that the performance of your server could be affected by disk speeds.  In this article we are going to show you how to measure the performance of your disks, so you can compare it with manufacturer’s specification to check and see if this could be affecting the overall functioning of your machine.   

Using hdparm to test read speeds

hdparm is a useful tool, when it comes to test the read speeds. Basic performance check can be run by executing ‘hdparm’ command with the below parameters (remember to replace /dev/sda with the ID of the disk you wish to check)

You can install hdaparm by running the following:


yum install hdparm -y


yum install hdparm -y


To test the performance of the drive /dev/sda

root@ubuntu:~# hdparm -Ttv /dev/sda


 multcount     =  0 (off)

 readonly      =  0 (off)

 readahead     = 256 (on)

 geometry      = 26108/255/63, sectors = 419430400, start = 0

 Timing cached reads:   16120 MB in  1.99 seconds = 8081.76 MB/sec

 Timing buffered disk reads: 2220 MB in  3.00 seconds = 739.73 MB/sec


The -T parameter was used for testing timings of cache reads but this is not a very useful number to look at, unless you are specifically testing cache performance.

The number we want to go by is the “Timing buffered disk reads” (-t parameter). Our score here is 739.73 MB/sec.

We want to repeat this test 2-3 times when the system is not running any other extensive processes and has at least a few megabytes of free memory to be sure about the results.


Using dd to test write speeds

To test the write speeds of your disk with ‘dd’ you can run the following command:

  if=/dev/zero of=/tmp/test oflag=direct bs=128k count=16k

You might need to adjust your bs and count parameters depending on your setup.

The above command will create the ‘test’ 2GB file in /tmp directory. The output of the command should be similar to this:

16384+0 records in

16384+0 records out

2147483648 bytes (2.1 GB, 2.0 GiB) copied, 32.1541 s, 66.8 MB/s

This tells us that the write speed of our disk is 66.8 MB/s. You can repeat the test with the 4GB file to compare the results: 

dd if=/dev/zero of=/tmp/temp oflag=direct bs=128k count=32k

32768+0 records in

32768+0 records out

4294967296 bytes (4.3 GB, 4.0 GiB) copied, 66.7746 s, 64.3 MB/s

As you can see, the result is pretty much similar. 

Don’t forget to delete the file created after you’ve finished testing.

rm -rf /tmp/test

You should then compare the results with manufacturer’s specification to determine if the disk is behaving as expected. 

Previous Adaptec RAID Monitoring
Next How to change the SSH port in Linux
Table of Contents