Disabling Power Management for a hard disk with hdparm

Leaving the power management enabled for your hard disk might shorten its life considerably. To give you an idea about it read this entry in a thread on the topic:
http://lists.debian.org/debian-powerpc/2008/10/msg00008.html

To see whether power management is enabled for your disk, you can enter something like this:
hdparm -I /dev/hda | grep -i “power management”

On Debian Linux one might want write an entry like this to /etc/hdparm.conf, if /dev/hda is the disk you want to switch off the Power Management for:

### START excerpt /etc/hdparm.conf ###

apm = 255

/dev/hda {
}

### END excerpt /etc/hdparm.conf ###

Additionally I have this in /etc/default/hdparm:

### START excerpt /etc/default/hdparm ###

harddisks=”/dev/hda”
hdparm_opts=”-B255″

### END excerpt /etc/default/hdparm ###

A script like the one below might be necessary in /etc/power/scripts.d/, if you have pbbuttonsd running, to make sure the hdparm values are re-set after resuming the machine from some sleep mode:

/etc/power/scripts.d/hdresume:

### START /etc/power/scripts.d/hdresume ###
#!/bin/sh

# name : hdresume

# Exit silently if package is no longer installed
[ -x /etc/init.d/hdparm ] || exit 0

/etc/init.d/hdparm reload

### END /etc/power/scripts.d/hdresume ###

Link to the script from /etc/power/resume.d/:

# cd /etc/power/resume.d/
# ln -s /etc/power/scripts.d/hdresume .

Note the dot at the end of the last line …
Oh, and the laptop-mode-tools package is not installed here.