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
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
- 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
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
As we can see from screenshot that reading performance is at 5GB/sec
Enable Read Ahead
To enable read ahead we will use
$ sudo hdparm -A1 /dev/vda
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
$ 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
$ hdparm -d1 /dev/sda