hdparm

From Gentoo Wiki
Jump to: navigation, search

External resources

hdparm is a command line utility to set and view ATA & SATA hard disk drive hardware parameters.

Installation

Install sys-apps/hdparm:

root # emerge --ask hdparm

Configuration

At runtime

  • Show identification and feature info:
root # hdparm -I /dev/sdX
  • Benchmark drive:
Note
Check that no other program stresses the drive.
root # hdparm -tT /dev/sdX
  • Get current settings. This is not consistent: for some features, you find the current value in the common info, for other feature, you call hdparm with the right parameter, but without any value, like -d:
root # hdparm -d /dev/sdX
  • Set features by put the value directly behind the parameter (without space), e.g. to enable the DMA mode:
root # hdparm -d1 /dev/sdX
Warning
Changing the default values can harm your drive or freeze your system.
The following tables introduces the most common parameters. For a complete list see the hdparm man page.
Parameter Description
-B Set the Advanced Power Management feature. The value 1 saves the most energy, the value 255 disables the feature. The values in-between are corresponding steps. Values of 127 and below allow the spin-down of the drive.
Note
Aggressive power management can wear your drive because of often spin-downs.
-d Set the DMA feature for IDE drives. The value 1 enables the feature, 0 disables the feature.
-E Set CD / DVD drive speed. Lower speeds can reduces the running noise.
-M Set the Automatic Acoustic Management feature. The values 0 disables the feature, 128 sets the most quiet mode, 254 is the fastest mode.
-S Set the standby (spin-down after idling) timeout. The value 0 disables the feature, the values from 1 to 240 specifies time steps of 5 seconds, 241 to 251 time steps of 30 minutes.

On boot

To set parameters on boot, edit your /etc/conf.d/hdparm:

  • sdX_args: Set parameters for the given drive (replace sdX with the right device file name)
  • discX_args: Set parameters for the given disc drive.
  • cdromX_args: Set parameters for the given optical drive.
  • all_args: Set parameters for all drives.

E.g. to disable power management for all drivers and enable the DMA feature for sda:

File/etc/conf.d/hdparm

all_args="-B 255"
sda_args="-d1"

Afterwards enable the hdparm service:

root # rc-update add hdparm default

Troubleshooting