Suspend idle harddisks and monitor the suspension

Goal

Suspend idle hard disks and monitor the suspension state

Intro

To save energy modern disks can spin down when not used. Depending on the disk, savings from 3 to 10 Watts can be achieved. Using the SMART capabilities hdparm can set a spin down timeout on each disk. To check the state of a disk hdparm can also output the state of a disk. As there is no automatic mechanism to be notified if a disk changes its state from idle to suspended state or vice versa another solution is presented in this blog post. The idea is to query the disks for their state periodically and save the value to a database. The problem is, that between to measurements the state can not be tracked. So using smartctl, a tool from the smartmontools is used to get the SMART value “Start Stop Count” from each disk and also save its output to the database. This is important as a spin down timeout that is set too low can result in frequent spin downs and ups, which may shorten the lifetime of a hard drive.
Continue reading