Hard Drive Standby / Spin-down / Sleep Script for a Linux Media Server
Reliably spinning-down drives to reduce energy consumption based on inactivity using the traditional hdparm configuration unfortunately isn’t always a working solution. To configure the spin-down of drives based on inactivity relies on the hard drive manufacturer to implement these features correctly in the firmware which apparently isn’t always the case. The two Samsung SpinPoint 1GB “HD103UJ” I have appear to have defective spin-down features implemented in firmware. I’ve found that Samsung generally does not release updated firmware for drives to resolve issues such as this so there is little hope of a future resolution from the manufacturer. I will note that my smaller and older Samsung SpinPoint drives have no issues with the automatic spin-down features so it seems the issue is specific to the 1GB models.
To work-around the frustration with the apparently broken firmware in the Samsung SpinPoint 1GB models I wrote a script which runs runs from the root crontab every 15 minutes to intelligently spin-down drives on my Linux media server. The script monitors for the presence of media clients on the network, checks for Samba file locks and disk activity to make decisions on when to sleep the array. I generally want to keep the entire array spun up while a client is active to avoid any delay when navigating the media and to power down the drives shortly after there is no activity.
The script as-is is probably pretty specific for my media server but should be helpful as a starting point if you’re also struggling with getting spin-down working using hdparm. The script so far has been a better overall solution compared to hdparm as it allows much more flexibility than simply monitoring for disk activity. Let me know if you have any suggestions or questions.
Related Posts:


