Advertisement

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.