Why is hybrid sleep off by default on laptops? (and how do I turn it on?)


Hybrid sleep is a type of sleep state that combines sleep and hibernate. When you put the computer into a hybrid sleep state, it writes out all its RAM to the hard drive (just like a hibernate), and then goes into a low power state that keeps RAM refreshed (just like a sleep). The idea is that you can resume the computer quickly from sleep, but if there is a power failure or some other catastrophe, you can still restore the computer from hibernation.

A hybrid sleep can be converted to a hibernation by simply turning off the power. By comparison, a normal sleep requires resuming the computer to full power in order to write out the hibernation file. Back in the Windows XP days, I would sometimes see the computer in the next room spontaneously turn itself on: I'm startled at first, but then I see on the screen that the system is hibernating, and I understand what's going on.

Hybrid sleep is on by default for desktop systems but off by default on laptops. Why this choice?

First of all, desktops are at higher risk of the power outage scenario wherein a loss of power (either due to a genuine power outage or simply unplugging the computer by mistake) causes all work in progress to be lost. Desktop computers typically don't have a backup battery, so a loss of power means instant loss of sleep state. By comparison, laptop computers have a battery which can bridge across power outages.

Furthermore, laptops have a safety against battery drain: When battery power gets dangerously low, it can perform an emergency hibernate.

Laptop manufacturers also requested that hybrid sleep be off by default. They didn't want the hard drive to be active for a long time while the system is suspending, because when users suspend a laptop, it's often in the form of "Close the lid, pick up the laptop from the desk, throw it into a bag, head out." Performing large quantities of disk I/O at a moment when the computer is physically being jostled around increases the risk that one of those I/O's will go bad. This pattern doesn't exist for desktops: When you suspend a desktop computer, you just leave it there and let it do its thing.

Of course, you can override this default easily from the Control Panel. Under Power Options, select Change plan settings, then Changed advanced power settings, and wander over into the Sleep section of the configuration tree.

If you're a command line sort of person, you can use this insanely geeky command line to enable hybrid sleep when running on AC power in Balanced mode:

powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e
                          238c9fa8-0aad-41ed-83f4-97be242c8f20
                          94ac6d29-73ce-41a6-809f-6363ba21b47e 1

(All one line. Take a deep breath.) [Update: Or you can use powercfg -setacvalueindex SCHEME_BALANCED SUB_SLEEP HYBRIDSLEEP 1, as pointed out by Random832. I missed this because the ability to substitute aliases is not mentioned in the -setacvalueindex documentation. You have to dig into the -aliases documentation to find it.]

Okay, what do all these insane options mean?

-setacvalueindex sets the behavior when running on AC power. To change the behavior when running on battery, use -setdcvalueindex instead. Okay, that was easy.

The next part is a GUID, specifically, the GUID that represents the balanced power scheme. If you want to modify the setting for a different power scheme, then substitute that scheme's GUID.

After the scheme GUID comes the subgroup GUID. Here, we give the GUID for the Sleep subgroup.

Next we have the GUID for the Hybrid Sleep setting.

Finally, we have the desired new value for the setting. As you might expect, 1 enables it and 0 disables it.

And where did these magic GUIDs come from? Run the powercfg -aliases command to see all the GUIDs. You can also run powercfg -q to view all the settings and their current values in the current power scheme.

Bonus reading:

Comments (27)
  1. Pierre B. says:

    One has to wonder, given that powercfg can list aliases, why it couldn't accept human readable names instead of GUID? (Maybe it does, I'm at a Mac at work, I can't check it out. Not that I would, I wouldn't want to go messing with power settings…)

  2. Troll says:

    Does turning off power while in hybrid sleep cause the same effects as an improper shutdown? I understand the system will resume from the hibernation file but what about dirty bit set for the volume/the errors which chkdsk corrects?

  3. mvadu says:

    @Troll, Does turning off power while in hybrid sleep cause the same effects as an improper shutdown?

    I am not sure if your question is genuine or not.. As Raymond mentioned :"A hybrid sleep can be converted to a hibernation by simply turning off the power", so if the power is removed while the system is on hybrid sleep it is treated as regular plain old hibernation. And system up on next boot will simply load the disk image to RAM and get going..

    If the system was on regular sleep and there is no battery back-up and power was lost, then improper shutdown sequences kick-in.. Even with systems with battery back-up if the battery is worn out then emergency hibernation might not complete and you may still lose data.

  4. John_L says:

    @mvadu Troll's question seems a good one to me – he's talking about hard disk errors caused by yanking the power during an I/O operation, and I guess that would include refreshing the saved RAM state.

    IIRC though, modern drives are very resilient to that kind of event.

  5. osexpert says:

    This could easily be solved by adding a movement detector (just like every cell phone has, only a much simpler and cheaper one) and only save state if laptop is not moving. If laptop vendors can force stuff on Microsoft I'm sure Microsoft could have forced this on laptop vendors.

    Apple laptops off course have this feature already (steal the good stuff next time).

    ["Sometimes, when my battery dies, I lose all my data, but other times it comes back. It seems to be totally random." -Raymond]
  6. mvadu says:

    @John_L,

    if power is lost during writing hibernation file as part of hybrid sleep, then you are just going lose the data. You don't have a hibernation file, and no power to keep RAM contents alive. Its similar to what would happen to old laptops (or laptops with old batteries) in regular sleep (no hibernation file created when system put on sleep) and battery reaches critical level. It tries to do a emergency hibernation (with screen blank as Raymond wrote in linked article) but might fail if the critical level is set to too low, and battery is not able to provide enough juice.

    Please note that when you enable hybrid sleep, system first creates hibernation file, then goes to sleep. If power is lost in first phase then the total operation is failed, and you get the same treatment of just pulling the plug.

  7. mvadu says:

    @osexpert (steal the good stuff next time).

    Toshiba laptops had a movement detector (a.k.a accelerometer) to park the had disk head if it detects too much vibration during I/O in 2005-2006 days (http://www.flickr.com/…/248221921)

    not sure who stole what from whom!!

  8. John D'Oriocourt says:

    @mvadu

    And I'm fairly sure that IBM/Lenovo laptops had that feature well before then, too.

    en.wikipedia.org/…/Sudden_Motion_Sensor

    Look at "Similar Systems" section. IBM had it in 2003. Some other major laptop company may have had a version even earlier than that.

  9. John D'Oriocourt says:

    Sorry for the double post, but I found a better source: an Anandtech article from October 2003.

    http://www.anandtech.com/…/2

  10. Apple calls this "safe sleep" says:

    They turned it on by default on laptops when they decided to implement it, and it was a pain in the butt. You also had to use similar (though slightly less geeky) command lines to disable it.

    Snow Leopard has it off by default, with the "delayed hibernate" mechanism instead.

  11. disk != ram says:

    The disk could be suspended independently from RAM. Wouldn't this be the best of both worlds for laptops?

    [Um, that's what happens. Laptops first suspend to RAM. And then when battery is low, they suspend to disk. -Raymond]
  12. johncos says:

    Hmm; since my laptop has an SSD (and therefore no problems with disk usage while in motion), perhaps I should consider enabling hybrid sleep.

  13. One of the most infuriating experiences I've had as a user is having sleep/hibernate fail on me. I tend to have very much the usage pattern Raymond describes: shut lid, put laptop (and associated bits) in backpack, set off home. Several times I found my back getting uncomfortably warm; other times I would get home to find a very hot laptop with a flat battery, having sat running the CPU flat out in an enclosed bag for my hour-long journey. I tried various things, including the obscure commands 'Apple calls this "safe sleep"' references since I was running Leopard at the time; eventually I just got into the habit of doing a proper shutdown before putting it away, rather than trusting sleep.

    As I recall, the blame really belonged to the graphics driver, which was disrupting the sleep attempt. Most of my problems seem to revolve around faulty drivers, one way or another … I spent this morning wrestling with a BIOS "feature" which would caused a pre-POST hang unless the hard drives were blank. Obscure, and it does make installing software rather tricky.

  14. pete.d says:

    @osexpert (steal the good stuff next time).

    To add what others wrote, I can't speak for the current crop of Mac laptops, but my ca. 2007 MacBook Pro does have a motion sensor, and you know what Apple decided is the right thing to do if movement is detected?  Fail the hibernate and reboot the computer.

    Nice.

    As you can imagine, I have become very diligent about not jostling my laptop even a little bit after closing the lid and before the thing really shuts down.

  15. pete.d says:

    @Raymond: "A hybrid sleep can be converted to a hibernation by simply turning off the power."

    Sort of.  It still requires manual intervention.  If the power settings are configured (for example) to hybrid sleep after 5 minutes and then hibernate after 1 hour, it still comes all the way out of sleep just to do the hibernate.

    What I would like to see is for Windows to somehow install a little stub in memory on hybrid sleep, which is all that runs when the hibernate timer expires, and which simply turns the computer off.

    There's something particularly annoying about watching my PC wake up from sleep, just so that it can write again all the contents of RAM to disk and then turn itself off.

  16. Troll says:

    "A hybrid sleep can be converted to a hibernation by simply turning off the power"

    Meaning I can hit the reset switch or pull the plug if I want my PC to do a shutdown (not hibernate) if it's already in standby? There will be no disk/file system errors like free space misreporting due to Free space bitmap getting corrupted etc?

    [I'm still trying to figure out how you got from "You can convert X to Y by doing Z" to "You can convert P to Q by doing Z." -Raymond]
  17. pete.d says:

    "Meaning I can hit the reset switch or pull the plug if I want my PC to do a shutdown (not hibernate) if it's already in standby?"

    No.  It means exactly what Raymond wrote: if you turn off the power, you get hibernation.

    If you want a shutdown, you have to power back on and do it explicitly.

    However, in either case no disk errors would be caused under normal circumstances.  What kind of feature would it be if when used as advertised it created disk errors?  Not a very good one, I think.

  18. 640k says:

    If you simply break the power every time you want to shutdown, disk/file system errors are only a matter of time before they appear. There are all kinds of non atomic writes going on in software and hardware all the time, even on journaling file systems. And if files like samdb or a registry hive is written halfways, good luck with your "foolproof" filesystem. A simple proof of concept is to copy a large file to a usb memory an yanking the power. usb is usually fat, but it demonstrates that it's very naive to think that you can just yank the power and think its all good afterwards.

    Same with printers and projectors, dont yank the power or they will break eventually!

  19. Marc says:

    Very interesting post – thanks.

    So why was Sleep the default option on the start menu for laptops in Vista? I remember a friend of mine who had owned their laptop for about 6 months unwittingly leaving in standby the whole time until they had to take it on a plane and were asked to turn it off. I can see the appeal for desktops, but have never understood it for battery powered devices.

    Personally, I only sleep my laptop when I know I'll be returning to it within an hour or so, otherwise hibernation rules.

  20. Random832 says:

    So, what's the point of having the aliases, if you can't do "powercfg -setacvalueindex SCHEME_BALANCED SUB_SLEEP HYBRIDSLEEP 1"? Actually, it seems you can, so why the magic GUIDs in your explanation?

    [Because I didn't know about your method. It's not documented, so who knows whether it will work in the future. -Raymond]
  21. pete.d says:

    @640k: "If you simply break the power every time you want to shutdown, disk/file system errors are only a matter of time before they appear."

    You are completely missing the point.  When the computer is in sleep mode, none of what you claim to be happening is actually happening.  It's perfectly safe to cut the power in that condition, given that the hibernation file has already been written out.

    That is in fact the entire point of having a hybrid sleep mode in the first place.

  22. bzakharin says:

    Presumably, when a system is in (hybrid) sleep mode, no disk activity is occurring (why would it be?) and I would imagine an uncommitted disk activity from before entering sleep mode is committed as part of the sleep process. So cutting power will not interrupt any disk activity.

  23. just say no to disk waste says:

    Large hiberfile on an expensive ssd is a no go.

    powercfg /hibernate off

    It's off by default on windows 2008, this is a good thing.

  24. Random832 says:

    It actually is documented: "-aliases  Displays all aliases and their corresponding GUIDs. The user may use these aliases in place of any GUID at the command prompt". I wouldn't have posted it otherwise. (Or I'd have left it at 'what's the point of having them?')

    [In which case: Awesome! -Raymond]
  25. mvadu says:

    @Random832, Nice.. so for once Raymond is sort of wrong.. not in his article, but in his comments.. by saying some thing is not documents, where as it is indeed documented feature..

    But he is not completely wrong because the GUID's may never change, but aliases might change in future version of windows.. ?

  26. Moz says:

    Haha, Raymond failed to memorise all of MSDN.

    I googled for one of those GUIDs to see what turned up, and there are a lot of references to the power commands but I never saw a reference to the alias.

  27. Troll says:

    "I'm still trying to figure out how you got from "You can convert X to Y by doing Z" to "You can convert P to Q by doing Z."

    I asked a simple question related to hybrid sleep on whether the feature was safe enough for very frequent real improper shutdowns due to power loss which may not happening in the US but are very real in other parts of the world. Occassionally, NTFS volumes develop all sorts of file system errors upon improper shutdowns which get corrected upon running Chkdsk.

    ["A hybrid sleep can be converted to a hibernation by turning off the power." You somehow converted this to "A standby can be converted to a shutdown by turning off the power." -Raymond]

Comments are closed.

Skip to main content