Home Linux Tips & Tricks How To Find Hard Disk Data Transfer Speed In Linux

How To Find Hard Disk Data Transfer Speed In Linux

By sk

This guide will teach you how to find hard disk data transfer speed in Linux. In other words, we are going to identify how fast your hard drive delivers data in Linux and Unix-like operating systems.

We are also going to talk about other useful things like how many sectors can a HDD read at once, read ahead feature, acoustic mode, write-back caching and bench-marking hdd etc.

For the purpose of this guide, we will be using hdparm command line utility to check the read, write speed of the hard drive and test the performance of the hard disk.

Just in case you've missed it, we already used the hdparm utility to find Hard disk drive details in Linux. Now we will use the same hdparm utility to measure the hard disk transmission speed.

A word of caution

Even though hdparm offers significant advantages to increase disk performance, it is also EXTREMELY DANGEROUS. It will very likely lead to massive data loss when some parameters are misused. The hdparm documentation suggests that YOU SHOULD NOT USE SOME COMMANDS AT ANY CIRCUMSTANCES. So I’ve excluded such dangerous commands in this guide. More importantly, it is always recommended to backup your hard drive before testing your hdd with hdparm on your Linux system.

Find Hard Disk Data Transfer Speed In Linux

To check the HDD data transfer speed in Linux, run "hdparm" command with -t flag like below:

$ sudo hdparm -t /dev/sda

Sample output:

 Timing buffered disk reads: 246 MB in  3.00 seconds =  81.97 MB/sec
Check hard disk drive speed with hdparm command in Linux
Check hard disk drive speed with hdparm command in Linux

As you can see, the data transfer rate is 81.97 MB per second. Make sure no other programs are running in the background.

Run hdparm command at least two or three times and calculate the average data transfer speed of your drive from the results.

As you can see in the above output, the Linux kernel puts the data retrieved from HDD into a buffer when transferring data. If you want to measure more accurate data transfer rate, use:

$ sudo hdparm -t --direct /dev/sda

Sample output:

 Timing O_DIRECT disk reads: 242 MB in  3.02 seconds =  80.21 MB/sec

Now, the hdparm program will not use buffer and will read the data directly from the hdd. As you noticed in the above output, the transfer rate has decreased without the buffer.

Hdparm will always read the data from the beginning of the storage devices. If you want hdparm to read data from other area of the storage device, you can use the "offset" parameter like below.

$ sudo hdparm -t --direct --offset 10 /dev/sda

Here, 10 stands for number of Gigabytes to skip. As per the above command, the first 10 GB will be skipped while reading data from the disk. On a 20GB disk, the above command would deliver data from the middle of the disk.

Sample output:

 Timing O_DIRECT disk reads (offset 10 GB): 244 MB in  3.01 seconds =  81.15 MB/sec
Find Hard Disk Data Transfer Speed In Linux
Find Hard Disk Data Transfer Speed In Linux

Compare the hdd transfer rate with and without offset values. When we used the "offset" parameter in the second command, the transfer rate has decreased. Hence, It seems that hard disks delivers data little bit slower from outer areas of the disks.

Find how many sectors a hard disk reads

Usually, a hard disk will read several sectors at the same time to speed up the data transmission. You can find this value by running:

$ sudo hdparm -I /dev/sda

Under the "Capabilities" section, you will see an output like below.

    LBA, IORDY(can be disabled)
    Queue depth: 32
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 16    Current = 16
    Advanced power management level: 254
    Recommended acoustic management value: 208, current value: 208
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 

As per the above output, my hdd reads 16 sectors at a time.

Some modern HDDs can retrieve sectors in advance. This feature is called "read ahead". You can find this value using "-a" flag like below:

$ sudo hdparm -a /dev/sda

Sample output:

readahead     = 256 (on)

As you see in the above output, the hdd can read 256 sectors in advance.

Put HDD in quiet mode to increase access time

We can slow down the head movement in some modern hard disks. Slowing down head movement will decrease the noise level and increase access times.

To check if your HDD supports this "acoustic mode" feature, run:

$ sudo hdparm -M /dev/sda

If your drive supports acoustic mode, you should an output like below.

acoustic      = 208 (128=quiet ... 254=fast)
check if Hard disk supports acoustic mode
check if Hard disk supports acoustic mode

The current acoustic mode value is 208 in my system. The acoustic mode values can be set between 128 to 254.

To put the HDD in quiet mode, run:

$ sudo hdparm -M 128 /dev/sda

To put the head movement in high speed, run:

$ sudo hdparm -M 254 /dev/sda

Please note that your operating system should support this feature.

If doesn't support this feature, you will see this:

 acoustic      = not supported

Write-back caching

When the Write-back caching mode is enabled, the hdd will put the data to be written in a buffer. This way the hdd can able to write faster.

To verify if write-back caching mode is enabled, use "-W" flag.

$ sudo hdparm -W /dev/sda

Sample output:

write-caching =  1 (on)

If the output value is 1, the write-back caching feature is enabled. If it is 0, the write-back caching is disabled. You can enable it using command:

$ sudo hdparm -W1 /dev/sda

If hdparm can not enable this feature, make sure the write-back caching feature is enabled in your BIOS.

To disable it, simply use:

$ sudo hdparm -W0 /dev/sda

Even though write-caching increases the write speed, it is not recommended in some situations.

For instance, when the power is gone suddenly, the data in the buffer would be permanently lost. So you should not enable the write-back caching feature when running database programs like PostgreSQL.

Benchmark Hard disk from command line

To benchmark the HDD and test the readable speed of the drive, use uppercase "T" and lowercase "t" flags together like below.

$ sudo hdparm -Tt /dev/sda

Sample output:

 Timing cached reads:   7232 MB in  1.99 seconds = 3629.42 MB/sec
 Timing buffered disk reads: 250 MB in  3.01 seconds =  82.99 MB/sec
Benchmark hard disk drive in Linux
Benchmark hard disk drive from CLI in Linux

Repeat this command at least 2-3 times to get the meaningful result.

For more details, check man pages.

$ man hdparm

Benchmark Hard disk using GNOME Disks graphical utility

If you don't like the command line way, the GNOME Disks GUI program also allows you us to benchmark hard disks.

Open Disks from menu or dash. Select the disk you want to benchmark and click three dots and choose "Benchmark Disk" option.

Benchmark hard disks with GNOME Disks
Benchmark hard disks with GNOME Disks

Click "Start Benchmark" option to start bench-marking:

Start Benchmark with GNOME Disks in Linux
Start Benchmark with GNOME Disks in Linux


In this guide, we discussed how to find hard disk data transfer speed in Linux (i.e. how fast the hard drive delivers data). We also looked at how to benchmark hard drive from command line mode and graphical mode using Gnome Disks GUI utility.

Featured image from Pixabay.

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More