How to make use of Harddisk Power Management features

From ThinkWiki
Revision as of 04:14, 12 December 2004 by Wyrfel (Talk | contribs) (page created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Harddisk Power Management


enabling the harddisks power management features

# 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
# spindown time for HD (man hdparm for valid values)
# I prefer 2 hours for acad and 2 min for batt
# 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
# ac/battery event handler
status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/AC/state`
case $status in
               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
               #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


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.