8

I have a hard drive, which should go to standby automatically after 30 or 60 minutes.

I tried (3 minutes for testing):

# hdparm -S 36 /dev/sda

/dev/sda:
 setting standby to 36 (3 minutes)

And it didn't work, even when there were no access for more than 5 minutes. Now I thought about some process accessing data, so I tested

# hdparm -y /dev/sda

/dev/sda:
 issuing standby command

Drive went to standby and kept sleeping, as you can lookup with

# hdparm -C /dev/sda;date

/dev/sda:
 drive state is:  standby

Touching some file in the mountpoint woke it up as you would expect it.

Why isn't the automatic suspend working? As far as I understood it should even turn off the hard drive independend from the OS, as long as there is no access.

migrated from serverfault.com May 21 '17 at 22:20

This question came from our site for system and network administrators.

  • Doing this is typically false economy. Why do you want to do this? – EEAA May 21 '17 at 21:06
  • 2
    I have a pi with a desktop drive for tv recordings. Now the drive is unused for like 20 hours a day and as a desktop drive it should live longer when it goes to standby for 20 hours than when it runs the whole day (which is quite the opposite of server drives). The 3 minutes were only for testing, i actually want it to go to standby after 30-60 minutes. – allo May 21 '17 at 22:20
5

Note that some drives do not implement this feature, even if the command passes. You may also need to reduce the Advanced Power Management level to 127 or less with hdparm -B 127 /dev/sda. From the man page:

-B Get/set Advanced Power Management feature... values 1 through 127 (which permit spin-down), and values 128 through 254 (which do not permit spin-down).

If all fails, you can write a small script that polls /proc/diskstats or /sys/block/sda/stat for the number of read/writes on the device and explicitly puts the drive in standby if they don't change over several minutes. See the hd-idle utility.

  • 2
    With hdparm -B 127 it works. – allo May 22 '17 at 20:00
2

The actual problem was smartd, which regulary checked the values of the device, even when it was in standby mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.