1

I have a problem with my Ubuntu 15.10 amd64 system on my ASUS R513C laptop.

I am setting the APM level on my HDD to 254 by running sudo hdparm -B 254 /dev/sda by hand and this fixes a problem with the disk constantly spinning up and down every couple of seconds.

But this setting is not conserved after the computer wakes up from sleep or reboots. It is then always reset to 1, and the spinning up and down starts again.

I checked: /etc/apm/event.d/20hdparm and /etc/default/acpi-support but I can't find where it sets the -B parameter.

I've also read https://wiki.ubuntu.com/PowerManagement but didn't find a solution there.

Paweł Pela
  • 113
  • 5
  • hmm did you commit that change to the system using a root prompt (`#`) or just with sudo? Oh and that site .... is 5 years old... ancient and probably obsolete (laptop-tools mentioned on it is no longer used for one). – Rinzwind Mar 08 '16 at 19:21
  • @Rinzwind both sudo and switching to root have the same effect - the change lasts only until next wakeup/reboot, then I have to set it by hand again. – Paweł Pela Mar 08 '16 at 19:47
  • I would expect the root one to be permanent. If you do not find a solution: add it somewhere in /etc/init.d so it is executed on every boot (or to crontab or cron). – Rinzwind Mar 08 '16 at 19:52
  • @Rinzwind I added it temporarily to .bashrc but I think that is not a very good solution overall... – Paweł Pela Mar 09 '16 at 23:59
  • bashrc is not the best place; somewhere earlier would be better. – Rinzwind Mar 10 '16 at 08:03
  • Have a look in /var/log/pm-powersave.log and the scripts /usr/lib/pm-utils/power.d/95hdparm-apm and /lib/hdparm/hdparm-functions. – user70550 Apr 11 '17 at 12:35

1 Answers1

1

Still haven't found the correct solution. As a workaround I create an executable script: /lib/systemd/system-sleep/sleep-sdb.sh

#!/bin/sh

case $1/$2 in
  pre/*)
    ;;
  post/*)
    hdparm -B 254 -S 120 /dev/sdb
    ;;
esac

Found here:

vlasov
  • 26
  • 2
  • thanks for the pointers! I would copy the solution from the first link to be included here in your answer, though (while preserving the link). That way your answer will be a standalone one, even if the other website changes location or something else happens to it. – Paweł Pela Mar 19 '16 at 13:12
  • Imported the script. Btw, my ubuntu was resetting HDD APM to 128, so I use -B 192 for hdparm in a script, not sure if there is a real difference. – vlasov Mar 21 '16 at 01:48