acpi hdparm script finally got fixed

Posted by bikethetam Fri, 16 Jan 2009 02:31:00 GMT

The acpi bug in /etc/acpi/start.d/90-hdparm.sh that prevented acpi from updating the disks energy saving settings and described here was finally fixed today in ubuntu 8.10 1/15/2009.

The patch is modifies 90-hdparm.sh the following way:
15c15,17
>   if [ "$LMT_CONTROL_HD_POWERMGMT" != 0 ] \
>      && [ -e /var/run/laptop-mode-tools/enabled ]
>   then
The patch was described the following way:
Version 0.114-0intrepid1: * {ac,battery,resume,start}.d/90-hdparm.sh: don't just check whether laptop-mode is configured to control the drives, also check whether laptop-mode itself is *enabled*. Finally closes LP: #59695.
Launchpad bug 59695 was open in 2006 and is the infamous "High frequency of load/unload cycles on some hard disks may shorten lifetime".

Ironically, after this patch, when going into battery mode, acpi will set the APM value (hdparm -B) for your drives to 128. That's a little bit aggressive. On my "Hitachi Travelstar 5K160 series HTS541616J9SA00", that means a spindown after less than 10 seconds of inactivity. And despite the relatime option, the laptop being idle the disk is accessed about once every 10 seconds (firefox, wpa_supplicant seem to be the culprits but that's a subject for another post). As a consequence, the disk spins down and then up at that interval.

Below are the numbers of load cycles increasing as APM is set to 128 (hdparm -B 128 /dev/sda6). 3 new cycles in 22 seconds.
me@laptop ~ $ date && sudo smartctl -a /dev/sda6 | grep 193
Thu Jan 15 20:15:20 PST 2009
193 Load_Cycle_Count        0x0012   084   084   000    Old_age   Always       -       160535
me@laptop ~ $ date && sudo smartctl -a /dev/sda6 | grep 193
Thu Jan 15 20:15:42 PST 2009
193 Load_Cycle_Count        0x0012   084   084   000    Old_age   Always       -       160538
My solution is to edit /etc/acpi/{ac,battery,resume,start}.d/90-hdparm.conf and change 128 into 200:
31c33,35
>         hdparm -B 200 $dev
That's enough, the Load_Cycle_Count doesn't move anymore.

Leave a comment

Comments