Spinning down disks with hdparm

When having a datastorage it’s a good idea to cope with the energy saving settings of your hard discs. Controlling the settings may provide quiter disks, more energy saving disks and disks that spin down when their service is not requested. So they may run a longer time until they fail.

A normal desktop disk is not capable of running 24/7. Only special storage disks may run 24/7 without failure during guarantee. This feature is bought by a higher price. So it’s suggested to spin down the disks of the storage. Saving energy is an important fact, too.

The following paragraphs describe how to enable spindown. This was tested with UbuntuĀ 12.04. Be careful! Using Ubuntu requires sudo in front of these commands.

Setting spindown time

Simply execute the following command to set the spindown time:

hdparm -S 60 /dev/sdX

When setting the spindown time multiples of 5 seconds is used. The value 60 activates standby after 5 minutes. Values greater than 240 imply different multiples. Please see the man page for this.

Setting power management mode

Depending on the power mode of a disk, it may go into standby or not. This is described by a value used by the Advanced Power Management. A value betwen 1 and 127 permitts spindown. Values between 128 – 254 prohibits spindown. In case a disk is delived with a value >127 the disk will never spindown! So this value eventually must be chaned.

hdparm -B 1 /dev/sdX

Simply execute the following command to set the power management mode.

Permanently active this settings

In order to permanently activate these settings put the following into /etc/hdparm.conf:

/dev/sdb {
apm = 1
spindown_time = 60
}

Manually shutting down disk

In order to test spindown or do this via a script simply execute the following command:

hdparm -y /dev/sdX

Then the disk is spinned down until there is another access to this disk.

Sources

  • man hdparm

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.