Measure your HDD performance on Linux with hdparm

Many times we notice that the performance of a server is not what it should, there we wonder, where is the problem? … Will it be insufficient bandwidth? … Lack of CPU or RAM? … Or the writing and reading in the HDD will not be the best?

Here I will show you how to know what maximum speed your HDD supports, the current speed it can work at etc, we will use the tool: hdparm

hdd seagate

Install hdparm

First and it is something obvious, we must install the software that we will use. If you use Ubuntu or Debian you can install it with:

sudo apt-get install hdparm

If you use ArchLinux or some other distro based on this it would be:

sudo pacman -S hdparm

Using hdparm

The first is know the maximum speed of our HDD, that is, if it is Sata1, Sata2 or 3, how much does it support. For this we will use the following command:

sudo hdparm -I /dev/sda | grep -i speed

This taking into account that the HDD we want to review is / dev / sda, that is, the first or main.

It will show us something like this:

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

Depending on how sophisticated the HDD is, and of course, if they have the maximum supported speed enabled in the BIOS.

Now let's see current speed with which the HDD is working:

sudo hdparm -tT /dev/sda

Repeat the command two or three times to get a range of values.

It will show us something like this:

/ dev / sda: Timing cached reads: 22770 MB in 2.00 seconds = 11397.43 MB / sec Timing buffered disk reads: 432 MB in 3.01 seconds = 143.59 MB / sec

The first value has to do with the speed of the disk cache, the second value means the actual read and write speed, that of the physical disk as such.

The end!

I hope you have been helpful.

By the way, you can see a complete and detailed information about your HDD by removing the grep of the command that I put previously, that is, like this:

sudo hdparm -I /dev/sda

Enjoy!


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   dhunter said

    Ha, I don't know why but I had read "Improve performance" instead of "measure" and I was going to jump in and ask the tricks you used. Thanks Gaara.

    1.    KZKG ^ Gaara said

      HAHAHAHA well ... the most obvious trick is to get an SSD hehe, but it is the most expensive 😀

      1.    dhunter said

        Some time ago I had 3 disks in a desktop pc and it occurred to me that the original purpose of RAID was speed and I did a RAID 0 (stripping), I copied almost triple the speed but with the disadvantage that if I lost a disk I would lose it everything.

        By the way before RAID was "Redundant Array of Inexpensive Disks" now it is "Independent Disks" because we generally don't need so much speed but data reliability.

    2.    giskard said

      The exact same thing happened to me!

  2.   old said

    With an IDE disk (PATA) something old, the maximum speed that you say comes out with -I does not come out for me. On the other hand, the current ones do come out, which to give you an idea are:
    / dev / sda:
    Timing cached reads: 334 MB in 2.01 seconds = 166.40 MB / sec
    Timing buffered disk reads: 148 MB in 3.03 seconds = 48.77 MB / sec

    1.    KZKG ^ Gaara said

      Thanks for the comment 😀

  3.   cristian said

    For more tests I recommend phoronix
    http://www.phoronix-test-suite.com

  4.   zetaka01 said

    I wouldn't play hard with the puck tests at home. Without any scientific and mathematical explanation, the less you stop it in rotations (turn it off), the better you are going to do. You can spoil it by defragmenting it, compressing it, encrypting it, etc., many times. Disk check utilities are not harmless, the more you use them, the more you wear out the disk. Like SSDs and USB drives, they have a limited number of writes. Using them from time to time is fine, but without overdoing it.
    And the less you stop / boot the disk the better.
    Spend the disc as little as you can.
    A greeting.