Enable hard drive standby / Advanced Power Management on Linux

My disks don't spin down, here's how I fixed it:


To check status without waking the drive:

sudo smartctl -i -n standby /dev/sda


To check status may wake drive:

sudo hdparm -I /dev/sda


To help hard drive goto sleep:

sudo smartctl --offlineauto=off /dev/sda

Disables SMART scrubbing (automatic offline testing), which helps the drive is to enter "standby". Note: offlineauto=off value is saved in the drive, surviving reboots and power outages.


To enable Advanced Power Management :

sudo hdparm -K 1 /dev/sda

-K     Set the drive´s "keep_features_over_reset" flag.  Setting this enables the drive to retain the settings for -APSWXZ over a soft reset (as done during the error recovery sequence).  Not all drives support this feature.


To check Advanced Power Management level:

sudo hdparm -B /dev/sda

To set Advanced Power Management level:

sudo hdparm -B 1 /dev/sda

-B     Get/set Advanced Power Management feature, if the drive supports it. A low value means aggressive power management and a high value means better performance.  Possible settings range from values 1 through 127 (which permit spin-down), and values 128 through 254 (which do not permit spin-down).  The highest degree of power management is attained with a setting of 1, and the highest I/O performance with a setting of 254.  A value of 255 tells hdparm to disable Advanced Power Management altogether on the drive (not all drives support disabling it, but most do).


To set spin down time:

sudo hdparm -S 120 /dev/sda

where 120 = 10mins

-S Put the drive into idle (low-power) mode, and also set the standby (spindown) timeout for the drive. This timeout value is used by the drive to determine how long to wait (with no disk activity) before turning off the spindle motor to save power. Under such circumstances, the drive may take as long as 30 seconds to respond to a subsequent disk access, though most drives are much quicker. The encoding of the timeout value is somewhat peculiar. A value of zero means "timeouts are disabled": the device will not automatically enter standby mode. Values from 1 to 240 specify multiples of 5 seconds, yielding timeouts from 5 seconds to 20 minutes. Values from 241 to 251 specify from 1 to 11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5 hours. A value of 252 signifies a timeout of 21 minutes. A value of 253 sets a vendor-defined timeout period between 8 and 12 hours, and the value 254 is reserved. 255 is interpreted as 21 minutes plus 15 seconds. Note that some older drives may have very different interpretations of these values.


Apparently sdparm can be helpful if hdparm does not work. I've not tested this yet...

To install:

sudo apt install sdparm

7 comments:

  1. This post gives truly quality information. Thanks a lot for sharing a wonderful piece of information keep it up and best of luck with your future article.

    aol mail login|cash app login|
    |cashappsignup|aol mail login |netgearrouterlogin

    ReplyDelete
  2. Hydrogen is a chemical element, which is known to be the lightest element in the periodic table. Hydrogen is the most widely available chemical substance in the universe, constituting roughly 75% of all baryonic mass.

    Hydrogen Production

    ReplyDelete
  3. Syngas, also known as synthesis gas, is a fuel gas. It is a mixture of gases that are composed of primarily hydrogen, carbon monoxide, and very often some carbon dioxide.

    Syngas Production

    ReplyDelete
  4. Hey! It’s me, Alan Owen! From The Social Network to Tenet to The Muppets, I have a huge watchlist. Apart from watching movies, I am also a coder and a learner of technology. Readers of blogs get the latest updates related to the technical world too.
    mcafee.com/activate
    office.com/setup
    mcafee.com/activate
    norton.com/setup
    webroot.com/safe

    ReplyDelete
  5. Obtenez la clé de produitwww office com setup 2016 gratuitement et installezsetup office com office 2019. Guide étape par étape pour setup office com download office

    ReplyDelete