Spin down HDDs when idle

This (along with all my guides) is for Ubuntu but it could probably be done on any Debian based linux variant. It is worth setting your drives to spin down when the system is inactive. This will save some power and reduce the wear on the drive.First install your dependencies:

You can send the command from the terminal to check if it works, this will spin down disks sda to sde:

And this command will tell you the current status of the drive:

You can automate this to make the drives spin down after X min of inactivity by editing the /etc/hdparm.conf file and adding:

The ‘241’ value will spin the drives down after 30 min inactivity. I can really remember where I found this value out initially but I have a note written down that says that this is the case. So if you need to find out you can do some Google-foo to find out – I expect that it is in the man page – why, yes it is (http://unixhelp.ed.ac.uk/CGI/man-cgi?hdparm):

A value of zero means “timeouts are disabled”: the device will not automatically enter standby mode.
Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes.
Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours.
A value of 252 signifies a  timeout  of  21  minutes.
A value of 253 sets a vendor-defined timeout period between 8 and 12 hours.
A value of 255 is interpreted as 21 minutes plus 15 seconds.
The value 254 is reserved.

Note that some older drives may have very different interpretations of these values.

Also note that smartd can interfere by checking SMART disk status every hour. When this was happened, it would wake the disks up, basically never allowing them to go into standby. To change SMART checking to every 2 hours, and to not spin the drive up if it is in standby we need to edit /etc/default/smartmontools and add:

Then edit /etc/smartd.conf and comment out:

Add below commented line:

Reboot the system.

Useful sources

Leave a Reply

(email optional)