FS#20699 - [pm-utils] set wrong hdparm -B values when on battery

Attached to Project: Arch Linux
Opened by Jirka Daněk (juraad) - Wednesday, 01 September 2010, 12:29 GMT
Last edited by Jan de Groot (JGC) - Thursday, 20 January 2011, 20:52 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Jan de Groot (JGC)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description: Disc keep spinning up and down when running on battery due to (IMHO) a typo in one of the pm-utils files.

Package versions:
* pm-utils 1.4.0-1

Config and/or log files etc.
* /usr/lib/pm-utils/power.d/harddrive

The harddrive hook contains these values:

# Default values on AC
DRIVE_SPINDOWN_VALUE_AC="${DRIVE_SPINDOWN_VALUE_AC:-0}"
DRIVE_WRITE_CACHE_AC="${DRIVE_WRITE_CACHE_AC:-1}"
DRIVE_POWER_MGMT_AC="${DRIVE_POWER_MGMT_AC:-254}"
DRIVE_ACOUSTIC_MGMT_AC="${DRIVE_ACOUSTIC_MGMT_AC:-0}"

# Default values on battery
DRIVE_SPINDOWN_VALUE_BAT="${DRIVE_SPINDOWN_VALUE_BAT:-6}"
DRIVE_WRITE_CACHE_BAT="${DRIVE_WRITE_CACHE_BAT:-0}"
DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-1}"
DRIVE_ACOUSTIC_MGMT_BAT="${DRIVE_ACOUSTIC_MGMT_BAT:-254}"

Setting DRIVE_POWER_MGMT_BAT to 1 results in calling hdparam with -H 1. The disk then keeps spinning up and down.

That has negative inpact on HDD lifetime and also can produce clicking noise in case of some laptops. Because of it im setting the bug severity to High.

Fix:

First of all, I think the DRIVE_POWER_MGMT_BAT=1 is a typo, because in subsequent comments in that file the default values are said to be 254 for AC (agrees, that is so) and 128 for BAT (that doesn´t).

But value 128 is inconsistent with DRIVE_SPINDOWN_VALUE_BAT=6. That translates into hdparm -S 6 and according to hdparm manpage, spindown is enabled only for -H values between 1 and 127.

In conclusion:

I propose either changing the value to 127, or maybe better, by default disable the power-management features in pm-utils and let users to decide wether they want them or not.

Workaround:

Disable the config file by creating an empty file in your /etc

mkdir -p /etc/pm/power.d/
touch /etc/pm/power.d/harddisk

Confirmations in forum:
* https://bbs.archlinux.org/viewtopic.php?pid=812670
* https://bbs.archlinux.org/viewtopic.php?id=99958
This task depends upon

Closed by  Jan de Groot (JGC)
Thursday, 20 January 2011, 20:52 GMT
Reason for closing:  Fixed
Additional comments about closing:  the hook has been removed.
Comment by Jirka Daněk (juraad) - Wednesday, 01 September 2010, 12:38 GMT
Correction: DRIVE_POWER_MGMT_ values get applied by calling ´´´hdparm -B´´´, not -H.

I am sorry for messing this up
Comment by Gerardo Exequiel Pozzi (djgera) - Thursday, 02 September 2010, 00:06 GMT
  • Field changed: Summary ([pm-utils] set wrong hdparm -H values when on battery → [pm-utils] set wrong hdparm -B values when on battery)
  • Field changed: Status (Unconfirmed → Assigned)
  • Field changed: Category (Packages: Extra → Upstream Bugs)
  • Task assigned to Jan de Groot (JGC)
Yes power.d/harddisk is a bit agressive for some disks, also in "AC mode". For example sets by default AAM (acoustic) to -M 254, this makes some disks a permanent heads movement (sounds like head crash).

Anyway this should be reported to upstream.
Comment by Jirka Daněk (juraad) - Thursday, 02 September 2010, 09:36 GMT
It definitely should be also reported to upstream. But Arch should be also noticed that it distributes a broken package. Like every piece of technology, HDDs have only a limited lifetime and can whistand only a limited number of spindowns (hundereds of thousands). Current pm-utils setting can significantly reduce HDD lifetime and shouldn´t be therefore distributed as part of Arch.

Also, these powersaving features of pm-utils interfiere with those of laptop-mode. For example in case of hdparm -B the pm-utils settings override the values set in laptop-mode. That can make powersaving very difficult to set-up on Arch.
Comment by Jan de Groot (JGC) - Thursday, 02 September 2010, 09:40 GMT
Can't we just rip out this thing and rely on laptop-mode for harddisk powersaving?
Comment by Pac Shady (PacShady) - Monday, 06 September 2010, 12:01 GMT
I noticed this recently when I could hear my hard drive spin up and down randomly, every minute or two. Checked my SMART details and found the load cycles and start/stop count climbing dramatically. Tried making a powersave script in /etc/pm/power.d but it seems to be ignored now. Tried the fix above (touch /etc/pm/power.d/harddisk) and that didn't work either. Fixed by editing /usr/lib/pm-utils/power.d/harddisk itself and changed the values. I know it will probably be overwritten at next update, but it will have to do for now.

This is a major bug, it's been known for years now that such aggressive powersaving will kill laptop hard drives very quickly. I'd rather have my battery run down a little faster than have my hard drive blow out in six months :)
Comment by Kevin Piche (kpiche) - Saturday, 09 October 2010, 05:16 GMT
I fixed this by creating /etc/pm/config.d/no-hd-powersave with:
DRIVE_POWER-MGMT_BAT=254

Loading...