I’m using an Intel SS4200 as NAS with Raid 6. After installing a CF-Card with an IDE-Adapter as cheap (and horribly slow) SSD its now possible to put the harddrives to sleep. Since the end of 2009 Linux officially supports the harddisk-LEDs on the front of the SS4200 so why not use them to show the current drive running status?
To do so, I wrote a little script which polls hdparm every 10s and sets the LEDs to the drive state (active = blue, suspended = off). Using hdparm is necessary because the /sys entry always shows state running. The script can be found here GitHub – drive_watch.
I also added a second script that polls the S.M.A.R.T. status. If a drive reports that the Current Pending Sector Count or the Uncorrectable Sector Count is not zero than the amber led is set to blink for the concerning drive. This script is also at GitHub, see here GitHub – smart_leds.
To run both scripts in parallel the smart_leds script creates a lock file that is used to prioritize error detection (blinking amber) over running status (solid blue).
Here is a start script that assigns the correct HDD ids. This can be just put in
/etc/rc.local but make sure it contains an
exit 0 at the end.
# disk definitions
# workaround to really enter sleep
hdparm -B 255 $DISK1 || true
hdparm -B 255 $DISK2 || true
hdparm -B 255 $DISK3 || true
hdparm -B 255 $DISK4 || true
# if needed: disk independent idle monitor
# source: http://hd-idle.sourceforge.net
# # set idle time to 1500 seconds = 25 minutes
# # start idle monitor tool
# /srv/misc/hd-idle/hd-idle -i 0 -a $DISK1 -i $IDLE -a $DISK2 -i $IDLE -a $DISK3 -i $IDLE -a $DISK4 -i $IDLE -l /var/log/hd-idle.log
# start S.M.A.R.T. led status script
/srv/misc/smart-leds/smart_leds.sh $DISK1 $DISK2 $DISK3 $DISK4 &
# start active/standby monitoring script
/srv/misc/drive-watch/drive_watch.sh $DISK1 $DISK2 $DISK3 $DISK4 &