hdparm: power down drives when not in use

This entry was posted by on Saturday, 21 April, 2012 at

There’s a great tool to master control over your harddrives, and it’s called hdparm. It has many options but this article will only cover those relevant to power saving.

Find out the current power state of your drive:

sudo hdparm -C /dev/sdc
drive state is: active/idle

This means it is spinning, but doing nothing. You may want it to spin down after a certain number of minutes. You can manipulate the power management level from the commandline:

sudo hdparm -B [1-255] /dev/sdc

hdparm’s strange time format

Values 1-127 permit spin-down, 128-254 do not and 255 disables advanced power management altogether (if the drive supports it).
Values 1 to 240 are in 5 second steps, values 241 to 251 are steps of 30 minutes, see the table below.

1 5 sec Spindown
127 635 sec 10.58 min  .
128 640 sec  .
240 1200 sec 20 min No Spindown
241 30 min  .
254 420 min 7 hours  .
255 * APM disabled*  .

Persistent settings

Setting the power management level from the commandline is not persistent, it will be reset over reboot. To make it persistent, you’ll have to edit /etc/hdparm.conf:

/dev/sdc {
spindown_time = 127

There are a gazillion more options, but this makes sure /dev/sdc spins down. Then, after a while we can check:

sudo hdparm -C /dev/sdc
drive state is: standby

NOTE: do not use a very short spindown time, most drives (especially 3.5″) are optimised for spinning and the increased wear by spinup/down cycles will wear them out quickly. Usually 2.5″ laptop drives are better.


3 Responses to “hdparm: power down drives when not in use”

  1. This doesn’t work on my mdadm RAID1. Spin down for few seconds with hrapdm -y -Y works only for few secons. So proably -S paramter will never work because disk is accessing all the time. I logged what writes to disk and I noticed that md2_raid1 access disk each 1-2 sec.I am still looking for some solutions. I think that spin down mdadm raid is possible but I am not able to write a script which will detect inactivity of system (not mdadm) and then shut down mdadm and then disks. It is too hard for me.

  2. I agree, the time settings seem rather arcane. I could not find a clear definition of which value does exactly what and it seems some vendors may implement this differently.

  3. Hello! Nice post. One question. In the spin down table you wrote “no spindown”. Are there some time values where disk wont spin down? I had similar issues with my seagate HDD. Time 243 wont spin it down. Time 127 it will.

Leave a Reply