hdparm Command Tutorial with Examples For Linux – POFTUT

hdparm Command Tutorial with Examples For Linux

Linux have different tools to manage disk devices and hard disks. hdparm is one of the popular tools. Hdparm can get information about hard disk, change writing intervals, acoustic management, DMA settings etc.But be cautious while changing settings about the hard disk drive.


hdparm [options] [device ...]


$ hdparm -h

Show Information About Disk

One of the most wanted feature is getting information about the hard disk drive. We will use -I option and the hard disk drive to get detailed information.

$ hdparm -I /dev/sda
Show Information About Disk
Show Information About Disk

We will get a lot of detailed information about the hard disk. Here are some of them

  • Model Number
  • Serial Number
  • Firmware Revision
  • Cylinders, Heads, Sectors
  • DMA
  • Features supported and enabled

Measure Hard Disk Device Read Speed

Hard disk drive speed can be tested with hdparm . We will use -t option for speed test. This test will only look read speed of the hard disk drive.

$ sudo hdparm -t /dev/vdb
Measure Hard Disk Device Read Speed
Measure Hard Disk Device Read Speed

We will get the benchmarks result after 5-10 seconds. We will get information like how much disk read is done and how much time required for this and average read performance in MB/sec

Measure Hard Disk Cache Read Speed

Another read hard disk device speed test is reading cache. Reading cache will give more higher performance than reading from disk because only the cached data will be used and tested. We will use -T option for this benchmark test.

$ sudo hdparm -T /dev/vdb
Measure Hard Disk Cache Read Speed
Measure Hard Disk Cache Read Speed

As we can see from screenshot that reading performance is at 5GB/sec

Enable Read Ahead

To enable read ahead we will use -A1 .

$ sudo hdparm -A1 /dev/vda

Silence Please

Mechanic disk or classical hard disks have some moving parts. There are disks in the hard disk which turns 5400 or 7200 RPM. There are some heads those will write some data by using magnetic areas techniques which will create some noise. Especially in busy systems this noise can be problem for us. We can lower the noise by lowering disk performance.

$ hdparm -M 128 /dev/sda

Change Disk Write Periods

Another popular issue is hard disk drives writing periods. We can change write intervals with -B option with the level. Levels can be between 0 and 255 .

$ hdparm -B 254 /dev/sda

Change DMA Settings

DMA gives performance to the hard disk operations. Which will write data into disk drive without need of CPU or other mechanisms. New disk drives all ready this featured enabled but for some older disk drives may not have this feature enabled. We can enable DMA with-d1

$ hdparm -d1 /dev/sda

LEARN MORE  What is Master Boot Record or MBR?

1 thought on “hdparm Command Tutorial with Examples For Linux”

  1. /dev/sdb2:
    Timing cached reads: 16830 MB in 1.99 seconds = 8454.99 MB/sec
    Timing buffered disk reads: 434 MB in 3.01 seconds = 144.27 MB/sec


Leave a Comment