How to make use of Harddisk Power Management features

From ThinkWiki
Revision as of 06:11, 25 May 2006 by Hmh (Talk | contribs) (Enabling the Harddisks Power Management features: Warn about drive lifetime risks in -B modes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

ATTENTION!
Certain laptop drives that are common in ThinkPads (like the newer Hitachi models) will perform head unloads and even spin-down automatically independently from the spin-down timer (-S) when operating in the more aggressive Advanced Power Management (-B) modes. This can reduce the lifetime of the HD by several years in the worst case, so watch those S.M.A.R.T. attributes for excessive unloads and spin-downs!

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

This ACPI action script for battery events is an example of how to control a lot of Harddisk Power Management features.