The default Ubuntu Server installation did not spin down my hard drives by default. Luckily we have a tool called ‘hdparm’ to do this for us. Spinning down disks can save up to 10watt per disk and extends life expectancy. 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
lsblk
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: Tech