How to make use of Harddisk Power Management features
Enabling the Harddisks Power Management features
To enable the power saving features builtin to your harddrive hdparm is your friend. It's a tool that enables you (among other useful things) to spin the drive down, to set its automatic standby timer (the time of inactivity after which the drive spins itself down) and to set the drives internal Power Management mode. (blktool seems to be an alternative, supposedly doing the same things with different command line syntax.)
Here is a short listing of the relevant options:
-B <n> Used to set the harddrives Advanced Power Management mode, <n> being a number between 1 and 255, where 1 means agressive power saving and 255 means no power saving, but better performance. -C Used to check the drives current power state, which is one of - unknown (command not supported) - active/idle (normal operation) - standby (low power mode, drive is spun down) - sleeping (drive is shut down) -S <n> Used to set the drives standby (spindown) timeout. What <n> specifies depends on its value: - 1-240: multiples of 5 seconds (timeouts between 5 secs and 20 mins) - 241-251: multiples of 30 minutes (timeouts from 30 mins to 5.5 hours) - 252: timeout of 21 mins - 253: vendor defined timeout between 8 and 12 hours - 254: resered value - 255: timout of 21 mins and 15 secs (These interpretations may differ on older drives.) -y Immediately forces the drive into standby mode. -Y Immediately forces the drive into sleep mode. Note that the drive can only be reaccessed after a complete machine reboot. -Z Used to disable the automatic power saving functions of certain Seagate drives.
To get information about your drive and which Power Management features it supports use the -i and -I parameters.
Laptop-mode
To actually enable the harddrive to shutdown for a longer time and not get started again because of filesystem syncs every few seconds, you'll need to activate Laptop-mode.
The easiest way to do this is to install the laptop-mode-tools.
An Example
The following acpi action script is an example of how to control a lot of Harddisk Power Management features.
#!/bin/sh # I' using this on FC2 and FC3 # cpu throttling off as FC does thisout-of-the-box # turning swap off is only for those that feel comfortable # doing something this nasty. # # pcfe, 2004-11-15 # cpu throttling # cat /proc/acpi/processor/CPU0/throttling for more info ACAD_THR=0 BATT_THR=2 # spindown time for HD (man hdparm for valid values) # I prefer 2 hours for acad and 2 min for batt ACAD_HD=244 BATT_HD=24 # Power management level # 255 (off) on AC # 128 (medium) on batt # lowered to 32, pcfe, 2004-06-23 # upped to 64, pcfe, 2004-07-14 # upped to 96, pcfe, 2004-10-20 ACAD_PM=255 BATT_PM=96 # ac/battery event handler status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/AC/state` case $status in "on-line") logger "Running /sbin/laptop_mode stop" /sbin/laptop_mode stop logger "Setting HD spindown for AC mode with hdparm -S $ACAD_HD /dev/hda." /sbin/hdparm -S $ACAD_HD /dev/hda > /dev/null 2>&1 logger "Setting HD powersaving for AC mode with hdparm -B $ACAD_PM /dev/hda." /sbin/hdparm -B $ACAD_PM /dev/hda > /dev/null 2>&1 #logger "Turning on swap." #/sbin/swapon -a #echo -n $ACAD_CPU:$ACAD_THR > /proc/acpi/processor/CPU0/limit exit 0 ;; "off-line") #logger "Turning off swap." #/sbin/swapoff -a logger "Running /sbin/laptop_mode start" /sbin/laptop_mode start logger "Setting HD spindown for battery mode with hdparm -S $BATT_HD /dev/hda." /sbin/hdparm -S $BATT_HD /dev/hda > /dev/null 2>&1 logger "Setting HD powersaving for battery mode with hdparm -B $BATT_PM /dev/hda." /sbin/hdparm -B $BATT_PM /dev/hda > /dev/null 2>&1 #echo -n $BATT_CPU:$BATT_THR > /proc/acpi/processor/CPU0/limit exit 0 ;; esac