Usage

Disk info

Benchmarking

Power management configuration

Modern hard drives support numerous power management features, the most common ones are summarized in the following table. See hdparm(8) for the complete list.

Warning: Overly aggressive power management can reduce the lifespan of hard drives due to frequent parking and spindowns.

Parameter

Description

-B

Set the Advanced Power Management feature. Possible values are between 1 and 255, low values mean more aggressive power management and higher values mean better performance. Values from 1 to 127 permit spin-down, whereas values from 128 to 254 do not. A value of 255 completely disables the feature.

-S

Set the standby (spindown) timeout for the drive. The timeout specifies how long to wait in idle (with no disk activity) before turning off the motor to save power. The value of 0 disables spindown, the values from 1 to 240 specify multiples of 5 seconds and values from 241 to 251 specify multiples of 30 minutes.

-M

Set the Automatic Acoustic Management feature. Most modern hard disk drives have the ability to speed down the head movements to reduce their noise output. The possible value depends on the disk, some disks may not support this feature.

To query current value, pass the parameter without a value. For example:

# hdparm -B /dev/sda

To apply different value, for example set APM to 127:

# hdparm -B 127 /dev/sda

Tips and tricks

Querying the status of the disk without waking it up

Invoking hdparm with the query option is known to wake-up some drives. In this case, consider smartctl provided by smartmontools to query the device which will not wake up a sleeping disk. For example:

Systems with multiple hard drives can apply the rule in a flexible way according to some criteria. For example, to apply power-saving settings to all rotational drives (hard disk with rotational head, excluding in particular solid state drives), use the following rule:

Putting a drive to sleep directly after boot

A device which is rarely needed can be put to sleep directly at the end of the boot process.
This does not work with the above udev rule because it happens too early.
In order to issue the command when the boot is completed, just create a systemd service and enable it:

the leading -i 0 parameter indicates that hd-idle is disabled on other drives.

Power management for Western Digital Green drives

Western Digital Green hard drives have a special idle3 timer which controls how long the drive waits before positioning its heads in their park position and entering a low power consumption state. The factory default is aggressively set to 8 seconds, which can result in thousands of head load/unload cycles in a short period of time and eventually premature failure, not to mention the performance impact of the drive often having to wake-up before doing routine I/O. Western Digital issued a statement, claiming that Linux is not optimized for low power storage devices and advising to reduce logging frequency. There are different ways to amend the idle3 state:

Western Digital supplies a DOS utility wdidle3.exe for download for tweaking this setting. This utility is designed to upgrade only the firmware of the following hard drives: WD1000FYPS, WD7500AYPS, WD7501AYPS but is known to be able to change the idle3 timer of other Green models as well.

hdparm features a reverse-engineered implementation behind the -J flag, which is not as complete as the original official program, even though it seems to work on at least a few drives.

Another unofficial utility is provided by the idle3-tools package. A raw idle3 value is passed as a parameter of the idle3ctl command. The correspondence between this value and the timeout in seconds is provided in the bottom table within idle3ctl(8). The following command sets the timer to 5 min:

# idle3ctl -s 138 /dev/sdc

this one completely disables the timer:

# idle3ctl -d /dev/sdc

Note:

A full power cycle is required for any change to take effect regardless of which program above is used. It means the drive needs to be powered OFF and then ON, a simple reboot does not suffice.

Some Western Digital Green drives are also known to have a different interpretation of hparm's standby timeout parameter, -S 1 resulting in a 10 min timer rather than 5 sec.

The power consumption of a Green drive is typically around 5.3W during read/write, 4.7W in idle mode and 0.7W in standby mode

Troubleshooting

APM level reset after suspend

The APM level may get reset after a suspend requiring it to be re-executed after each resume. This can be automated with the following systemd unit (adapted from a forum thread):

Note: The sleep.target is pulled by all suspend, hybrid-sleep and hibernate targets, but it finishes starting up before the system is suspended, so the three targets have to be specified explicitly. See [1].