HowTo: Linux Check IDE / SATA Hard Disk Transfer Speed

by on October 7, 2007 · 28 comments· LAST UPDATED July 8, 2010

in , ,

So how do you find out how fast is your hard disk under Linux? Is it running at SATA I (150 MB/s) or SATA II (300 MB/s) speed without opening computer case or chassis?

You can use the hdparm command to check hard disk speed. It provides a command line interface to various hard disk ioctls supported by the stock Linux ATA/IDE/SATA device driver subsystem. Some options may work correctly only with the latest kernels (make sure you have cutting edge kernel installed). I also recommend to compile hdparm with the include files from the latest kernel source code. It provides more accurate result.

Measure Hard Disk Data Transfer Speed

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

To find out SATA hard disk speed, enter:
sudo hdparm -I /dev/sda | grep -i speed
Output:

	   *	Gen1 signaling speed (1.5Gb/s)
	   *	Gen2 signaling speed (3.0Gb/s)

Above output indicate that my hard disk can use both 1.5Gb/s or 3.0Gb/s speed. Please note that your BIOS / Motherboard must have support for SATA-II.

dd Command

You can use the dd command as follows to get speed info too:

dd if=/dev/zero of=/tmp/output.img bs=8k count=256k
rm /tmp/output.img

Sample outputs:

262144+0 records in
262144+0 records out
2147483648 bytes (2.1 GB) copied, 23.6472 seconds, 90.8 MB/s

GUI Tool

You can also use disk utility located at System > Administration > Disk utility menu.

Read Only Benchmark (Safe option)

Then, select > Read only:

Fig.01: Linux Benchmarking Hard Disk Read Only Test Speed

Fig.01: Linux Benchmarking Hard Disk Read Only Test Speed


The above option will not destroy any data.

Read and Write Benchmark (All data will be lost so be careful)

Visit System > Administration > Disk utility menu > Click Benchmark > Click Start Read/Write Benchmark button:

Fig.02:Linux Measuring read rate, write rate and access time

Fig.02:Linux Measuring read rate, write rate and access time

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 28 comments… read them below or add one }

1 Jonas November 6, 2007 at 1:50 pm

$ sudo hdparm /dev/sda (and following)

should be
$ sudo hdparm -tT /dev/sda

to get the output you show and describe (At least on most distros).

Reply

2 Hount February 15, 2011 at 9:02 pm

“sudo hdparm -I /dev/sda | grep -i speed” does not show actual speeds which your hardware is capable. As it reports SATA and SATAII speeds even on my laptop which does not have a single SATA port.

Reply

3 nixCraft November 6, 2007 at 2:25 pm

thanks for the heads up!

Reply

4 Shri3772 March 1, 2008 at 5:12 am

I am trying to install linus n the machine having SATA Hard Drive .

Please let me know the URl or the site name where I will find these drivers

Reply

5 Shri3772 March 1, 2008 at 5:13 am

help me in finding SATA Hard Drive Drivers for Linux

Reply

6 nick November 8, 2008 at 12:22 am

Thanks for the tip, works great.

Reply

7 Pablo May 11, 2009 at 8:27 am

Excellent, very useful tip. Thanks a lot!

Reply

8 manolekshmi July 24, 2009 at 9:31 am

in serial ata,how fast datatrnsfer?how it is possible?what is the main difference between PATA & SATA.i want deatails about SATA harddisk communication to motherboard

Reply

9 santhanaraj.k August 19, 2009 at 5:19 am

how can i delete a partition througn a simple command

Reply

10 adg September 15, 2009 at 11:57 am

Shri3772 ,
You probably won’t be able to install ‘linus’ on your hard drive.

Reply

11 Markus Ewald September 24, 2009 at 5:41 am

What about software RAID partitions?
I’d love to compare my RAID-5 versus a single drive!

Reply

12 andrius September 25, 2009 at 7:44 am

hdparm -tT /dev/md0

for raid

Reply

13 sanjay October 9, 2009 at 10:07 am

How to check the driver version is being used by SATA?

Reply

14 M. Preston June 14, 2010 at 11:09 pm

sudo hdparm -I /dev/sda | grep SATA

returns nothing.

Reply

15 My Name July 5, 2010 at 10:45 pm

sudo hdparm -I /dev/sda | grep “signaling speed”

returns something like this:
* Gen1 signaling speed (1.5Gb/s)

Reply

16 mark seger July 15, 2010 at 3:08 pm

you have to make sure you know what you’re monitoring. this tool looks like it’s measuring the transfer speed to the raw disk which doesn’t really have much value other than to verify your raw speeds are reasonable.

in reality, your disk has a file system and writing to a formatted disk will always be slowly, sometimes significantly slower depending on whether you’re reading/writing large sequential ones or small one. your blocksize can also make a dig differences. btw – if you’re doing random I/O expect a significant drop in numbers.

graphics are good to see, and I like them as well, but for simple benchmarking I like to see numbers and collectl makes that real easy to do. some like iostat but the output can be very difficult to read, especially if you’re taking samples every second which IS a good thing to do if you want to see exactly what’s going on.

-mark

Reply

17 dosn August 15, 2010 at 11:57 pm

Does this work on mounted disks?

Reply

18 christian February 16, 2011 at 4:35 pm

dd command: To get real write speed of your disk add conv=fdatasync to dd command. This will make dd not return before the output is physically written.

Reply

19 Stefan Lasiewski April 25, 2013 at 11:41 pm

This is a great comment. conv=fdatasync shows more realistic speeds. Running dd without this conv will only tell part of the story and a false sense of performance. On a database server or other server with constant disk activity, you want to know the performance *including* including the physical write time.

For me, running dd without `conv=fdatasync` shows double the write speed.

Reply

20 Stefan Lasiewski April 25, 2013 at 11:47 pm

Although, the option doesn’t exist for FreeBSD, and I don’t see any equivalent options :P (‘sync’ means something completely different).

Reply

21 duckgrindrr March 22, 2011 at 5:19 pm

For anyone who might be wondering, the application in the two last screenshots is called palimpsest.

Reply

22 Gmaster July 10, 2012 at 1:56 am

You asked to login as root and

$ sudo hdparm -tT /dev/sda

Would be more pronounced if you change the $ to #

# sudo hdparm -tT /dev/sda

Reply

23 TheBearAk July 18, 2012 at 11:57 pm

You don’t need sudo if you’re already root.

Reply

24 The Guy August 1, 2012 at 2:47 pm

What would be considered terrible? I’m trying to figure out why all of my applications (skype, firefox) are running at 100% and am wondering if my HDD is dying. I’m getting results like the following on my laptop
/dev/sda:
Timing cached reads: 512 MB in 2.00 seconds = 255.74 MB/sec
Timing buffered disk reads: 102 MB in 3.05 seconds = 33.41 MB/sec

…which is /dev/sda:
Timing cached reads: 6678 MB in 2.00 seconds = 3342.16 MB/sec
Timing buffered disk reads: 358 MB in 3.01 seconds = 118.94 MB/sec
much worse then my desktop

Reply

25 Rakesh August 21, 2012 at 7:47 am

On my Linux server I have attached SATA Hard disk but it showing IDE.
How I can change it ????

Reply

26 Prabhat August 22, 2012 at 7:05 am

was really very helpful

Reply

27 Jock Strapp April 11, 2013 at 9:39 am

boot@catweazel ~ $ sudo hdparm -tT /dev/md0
[sudo] password for boot:

/dev/md0:
Timing cached reads: 24454 MB in 2.00 seconds = 12239.97 MB/sec
Timing buffered disk reads: 1886 MB in 3.00 seconds = 628.60 MB/sec

Arf! Arf!

Reply

28 Shawn Hicks November 26, 2013 at 5:56 pm

Script to get sata link speeds and display in readable format.

#!/bin/sh
for i in `grep -l Gbps /sys/class/ata_link/*/sata_spd`; do
 echo Link "${i%/*}" Speed `cat $i`
 cat "${i%/*}"/device/dev*/ata_device/dev*/id | perl -nE 's/([0-9a-f]{2})/print chr hex $1/gie' | echo "    " Device `strings` | cut -f 1-3
done

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , , , , ,

Previous post:

Next post: