Back to Mobile View

Skip to Content

Why hibernate or 'safe sleep' mode is no longer necessary in OS X Lion (Updated)

Update: Several commenters expressed concern that disabling safe sleep could expose you to the possibility of drive corruption if you lose power or your machine spontaneously restarts. This particular fear is groundless; Safe Sleep doesn't have anything to do with volume corruption (except if you inadvertently bounce your laptop around while the drive is still spinning to save the sleep image, as noted below).

The technology that helps OS X deal with uncertain volume status is HFS+ journaling, and it's set on by default when your drive is first formatted for an OS X install. The file system journal keeps track of changes and updates to your drive; if your Mac loses power, the journal is 'replayed' to help restore the drive to a known good state. This is always at work regardless of the safe sleep status.

Whether you choose to keep Safe Sleep on or not is a matter of personal preference, but if your machine is generally plugged in and you don't run the battery down below 20%, you are never actually taking advantage of the feature. If you want to chew up the drive space and take the time for the sleep image to write anyway, that's up to you. On SSD-equipped machines, the image save time is inconsequential but the loss of storage space is even more acute.

Original post below.

Introduced in 2005's PowerBooks, 'safe sleep' (or 'hibernate mode' as it's known in the Windows world) is a feature designed to preserve the current state of your Mac when you put it to sleep. Enabled by default on Apple's notebooks, the feature writes the entire contents of your RAM onto the hard disk when you put your Mac to sleep. The practical upshot of this is if your Mac loses power, the next time you start it up everything should be restored to exactly the way it was when you put your Mac to sleep.

If you're running OS X Lion, this feature may sound very familiar. That's because it somewhat parallels the functionality of Lion's Autosave and Resume features, which also allow you to pick up where you left off, even after a power failure or a discretionary reboot. For that reason and several others, safe sleep mode seems like an unnecessary feature for most OS X Lion users. I've disabled it on my Mac, and if you're running Lion, you may be interested in doing the same thing on your own Mac.

Even if safe sleep does duplicate features already built into OS X Lion, why even bother disabling it? I did it for two reasons. First, if the system has to write the contents of your RAM to the hard disk every time you put your Mac to sleep, it could take a long time for your Mac to actually fall asleep. While this process is relatively fast on the new SSD I just installed, on my old and extremely slow HDD it could take a minute or more for my Mac to actually fall asleep. If you're in the (bad) habit of grabbing your laptop and tucking it away in your bag before the pulsing power light tells you the machine is fully asleep, you could be moving your machine just as the drive is trying to write out the data for the sleep image; that's a prescription for drive trouble down the line.

The second reason I disabled safe sleep was because of the large amounts of hard drive space it consumes. The 'sleep image' generated by safe sleep isn't restricted to the amount of RAM you're actively using; instead, it's equal to the entire amount of your RAM. On my system, this meant 6 GB of drive space was being consumed by the sleep image, and since I can think of many better uses for all that space, I decided to get rid of it.

If you've now decided that you also want to disable safe sleep, you have a few options. SafeSleep is one third-party app that can get the job done for free, but be warned it's no longer being updated or supported. SmartSleep may be a better option, and it's even available on the Mac App Store, but it does cost US$3.99. A few other third-party solutions exist; those are just the first two that came to mind. However, it seems these solutions merely toggle your Mac's sleep mode and don't do anything to get rid of the space-consuming sleep image.

Another option, for those of you who aren't afraid of the OS X Terminal, is to input the following commands (which will require you to enter your admin password):

To remove the sleep image file: sudo rm -rf /var/vm/sleepimage

To disable safe sleep mode: sudo pmset hibernatemode 0

Whether you use one of the third-party utilities or the Terminal commands, you'll now have reclaimed a portion of your hard drive space equal to the amount of RAM you have installed in your Mac. If you have Lion's Resume feature enabled, you shouldn't be losing out on anything by disabling safe sleep on your Mac. Resume plus Autosave accomplishes essentially the same thing, but without consuming unnecessarily huge swathes of your disk space and without making it take forever to put your Mac to sleep.

There is one caveat to this: applications not yet updated with full Lion compatibility may not support Resume or Autosave features. If you find yourself heavily reliant on these apps and don't want to risk losing your data, you may want to leave safe sleep enabled despite the potential benefits of disabling it.



Categories

Mac OS X

Update: Several commenters expressed concern that disabling safe sleep could expose you to the possibility of drive corruption if you...
 

Featured Comments

Add a Comment

*0 / 3000 Character Maximum Comment Moderation Enabled. Your comment will appear after it is cleared by an editor.

49 Comments

Filter by:
AceNeerav

Disabling safe sleep is a a very bad idea! What if u got something stored in a app that doesn't work with lion' auto save and resume and u have still forgotten to press command S? if it was totally worth disabling, apple would hadn't done it themselves.

August 31 2011 at 2:46 AM Report abuse rate up rate down Reply
1 reply to AceNeerav's comment
AceNeerav

if such ridiculous articles come up in tuaw in the name of geekism, i'm off from here for good!

August 31 2011 at 2:48 AM Report abuse rate up rate down Reply
AceNeerav

Is the picture from Thailland's safari world?

August 31 2011 at 2:34 AM Report abuse rate up rate down Reply
jmsjmorm

My niece 'tweaked' the factory settings on her grandmother's cellphone to the point where grandma was hardly able to use it. It's painful to think of the damage that's going to be inflicted by nerdy kids messing with Terminal strings on momma's laptop inspired by this ridiculous article.

August 29 2011 at 9:25 AM Report abuse rate up rate down Reply
Ewan

This is idiotic.

(1) Safe sleep saves energy.
(2) Safe sleep saves battery life. (See (1).)
(3) Autosave will not save you if Autosave has not saved recently.
(4) Aforementioned caveats about Resume and Autosave. Now let me emphasize why this is *not* trivial: not even standard OS X applications can Resume *exactly* to the point that they have restored the contents of memory, nor will they ever. Terminal will save your scrollback history, but it can't decide which version of your shell history to save if you had several tabs open. If you had Activity Monitor open puzzling over which process had that nasty memory leak, then you are out of luck, as that process will have been restarted.

No. The only way to *really* implement Resume is to do a proper memory dump, and that is what safe sleep does. Resume is a nice hack, but when SSDs are ubiquitous, it will be obsolete and irrelevant.

August 28 2011 at 12:41 AM Report abuse +1 rate up rate down Reply
1 reply to Ewan's comment
Kenahoo

None of those are remotely compelling reasons compared with the time my wife has to wait for her computer to "turn back on" when she opens it up. If you're worried about scrollback history, get to know the extended history modes of zsh. If you're worred about Activity Monitor losing info on processes, then ... I don't know what to say. I'm not worried about such things. Just open Activity Monitor again. And there are better tools to find memory leaks.

In any case, a better option might be to tweak the 'standby' and 'standbydelay' arguments. Then everyone should be happy. My wife's machine had standbydelay=7200 out of the box, which means it hibernates after 70 minutes. I'm going to change it to 24 hours.

November 08 2011 at 11:56 PM Report abuse rate up rate down Reply
lap.felix

Hum... I disabled it. Tried it. Yes, it was fast. But then i read Woz's comment so I wanted to re-enable it by doing: "sudo pmset hibernatemode 1"

And now everytime I close the clam, it goes in deep, deep, deep sleep. The kind of sleep it goes in when there's no battery :S

So I have to wait 2-3 minutes before it wakes up !

Can anyone help me ???

August 27 2011 at 1:41 PM Report abuse +1 rate up rate down Reply
1 reply to lap.felix's comment
Nelson Minar

You probably want mode 3. See the pmset man page or my comment below.

August 28 2011 at 12:03 PM Report abuse rate up rate down Reply
1 reply to Nelson Minar's comment
lap.felix

Good ! Thanks a lot ! I'll try this ! And if you do not hear form me again, it will mean it worked ! THANKS AGAIN!

August 29 2011 at 6:49 PM Report abuse rate up rate down
Brendan

Holy sh*t!

Man, I thought sleep taking up to a minute to kick in was normal, but with safe sleep off it takes 2 seconds! And resuming is nearly instantaneous as well. I have a late-2008 MBP with 8GB of ram and recently upgraded the hard drive to 500GB 7200rpm. This is easily worth it.

August 25 2011 at 11:15 AM Report abuse -2 rate up rate down Reply
Eric S

On my MacBook Pro, I have always disabled hibernate mode, but only for when I'm connected to AC power, not when I'm on battery. To do this, just add the -c option (for "charger") after the "pmset" in the pmset command shown above.

This way, if the cord gets knocked out and my battery drains, it'll save its state before sleeping due to the low battery level. Then if the Mac subsequently powers off due to the low battery, it'll resume from the hibernate image rather than doing a fresh reboot when I finally notice & plug it back in.

August 25 2011 at 9:40 AM Report abuse rate up rate down Reply
Macslu

RE: Update:

So, uhm, you're suggesting that it's perfectly fine for me to take my desktop and plug it into the wall outlet with the light switch. When I leave the room, I can just turn off the lights and shut down the computer at the same time?

August 24 2011 at 12:29 PM Report abuse -1 rate up rate down Reply
Tony

OMG... I little brother did the command line recommended above on his new Macbook Air. I can't seem to get it back to normal. Any suggestions folks that don't involve reimage/reinstall?

August 23 2011 at 3:47 PM Report abuse +1 rate up rate down Reply
Buy an ad here

Tweets

© 2012 AOL Inc. All Rights Reserved.