The default Ubuntu Server installation did not spin down my hard drives by default. This results in unwanted power consumption. Ideally I want my disks to spin down after 20 minutes of inactivity. Luckily we have a tool called ‘hdparm’ to set a spindown time. Spinning down disks can save up to 10watt per disk and extends life expectancy. Be careful not to spin down your disks too often. Spinning up and down hundreds or even thousands of times decreases the lifespan of the drive.
Hdparm is installed by default, but if it isn’t you can install it with the following command:

sudo apt-get install hdparm

To configure the idle time use the command stated below. The number indicates the idle time before the drive spins down.
60 = 5 minutes
120 = 10 minutes
180 = 15 minutes
241 = 30 minutes
242 = 1 hour
243 = 1.5 hours
244 = 2 hours

sudo hdparm /dev/sdx -S 241

Spins downs the drive after 30 minutes of inactivity. You can find out which /dev/ you need to use by running the command


and see which of your disks hold the / (root). Of course you can spin down any disk you’d like.
To apply this setting on boot you can edit the crontab like this:

sudo crontab -e

And add the following line:

@reboot /sbin/hdparm /dev/sdx -S 241

Save it, and done!

Categorie├źn: LinuxTech