1

I have a system here where I set a an idle (low-power) timeout for one hard-drive, as it is not used that much. For this, I have the command hdparm -S6 /dev/sdc in /etc/rc.local.

However, I've found that this works well over boots, but when I send the machine into hibernation/suspend and resume, the hard-drive remains powered up; the hdparm setting doesn't "stick". My workaround, which is getting on my nerves, is to issue the command manually again when I resume from hibernation.

Which script/file, like rc.local, is executed after suspend?

isync
  • 644
  • 1
    http://askubuntu.com/questions/92218/how-to-execute-a-command-after-resume-from-suspend (/etc/pm/sleep.d) – Rinzwind Jun 23 '16 at 14:41

3 Answers3

1

This doesn't work:

nano /etc/pm/sleep.d/myself_hdparm

which contains:

#!/bin/sh

case "$1" in
    resume)
        echo "setting sdc to low-power idling mode after resume!"
        hdparm -S6 /dev/sdc
esac

and then:

sudo chown myself:myself /etc/pm/sleep.d/myself_hdparm

sudo chmod 0755 /etc/pm/sleep.d/myself_hdparm

isync
  • 644
  • It should work though - at least if you replace resume with post (?), as you can see in the comments to this answer. But if you have installed tlp, it will apparently take precedence. In this case, the solution is to either uninstall it or (better) edit /etc/tlp.conf values DISK_DEVICES and DISK_SPINDOWN_TIMEOUT_ON_AC / ..._ON_BAT and service tlp restart. – phil294 May 07 '22 at 21:07
0

I do not have this resume-and-forget issue when I configure the value in /etc/hdparm.conf under "apm = " Values depend on distro afaik. However, the hdparm man page gives you the values that should work.

0

As it seems, the proper way to do it (at least with Ubuntu 14.04 and up) is to use gnome-disk-utility:

  1. Select the disk in question

  2. Click the little gear icon in the upper right corner of the disk utility app-window (not the gears on the partition, but on the application-window itself). It's a "hamburger button" on 18.04. Keyboard shortcut is "E".

  3. Select drive settings

  4. (a number of tabs shows up, depending on your drives capabilities)

  5. Select either the standby, APM or AAM tab

  6. Adjust settings to your liking

If anyone knows how this works under the hood, if there's some daemon involved in managing drives or so, please post a comment.

isync
  • 644