Was looking for how to do this, and found the original source andrewescobar.com is not around anymore. Found an archive version from web.archive.org.
1. Apply Safe Sleep Property
To summarize, new PowerBooks have the “has-safe-sleep” property. To apply this property to your Mac, something needs to be run in Open Firmware at boot. In the Terminal enter the folling, hitting return at the end of each line:
sudo nvram nvramrc='" /" select-dev
" msh" encode-string " has-safe-sleep" property
sudo nvram "use-nvramrc?"=true
In a Terminal shell it should look as follow:
computer:~ User$ sudo nvram nvramrc='" /" select-dev
> " msh" encode-string " has-safe-sleep" property
computer:~ User$ sudo nvram "use-nvramrc?"=true
The Mac must be restarted to set the changes.
2. Allow Hibernate Mode
To continue, you must have at least as much free disk space as physical memory , plus 750MB. To enable Sleep Safe, in the Terminal enter:
sudo pmset -a hibernatemode 3
This should create the file /var/vm/sleepimage.
If (and only if) you have secure virtual memory enabled, enter 7 (rather than 3) to disable encrypted hibernation. Encrypted Safe Sleep does not yet work.
When your Mac is set to sleep, it will now enter regular Sleep mode first (consuming minimal power). It will only enter Safe-Sleep if the battery is very low on power, or is unpluged. If you prefer to skip regular sleep, and use Safe Sleep mode instead (note: it takes a few seconds more to sleep and wake-up) enter:
sudo pmset -a hibernatemode 1
Enter 5 (rather than 1) with secure virtual memory.
To disable Safe Sleep:
sudo pmset -a hibernatemode 0
The Mac does not need to be restarted to set the changes to hibernate mode.
What is secure virtual memory?
Secure virtual memory is a software feature that encrypts your swap-files and sleep-image. The option is found in the Security pane in System Preferences. It is not enabled by default, and is does not need to be enabled to use Safe Sleep. In-fact, encrypted Safe Sleep appears to not yet work.
3. Verify Sleeping
Put the Mac to sleep and wait for the light to start pulsing. Wait a few more seconds. Wake it normally (by hitting the space bar for example).
Open Console and view system.log, or simply open the file /var/log/system.log. Look for a line indicating that the process worked. It is similar to:
Nov 11 12:15:33 computername kernel: System SafeSleep
4. Verify Safe Sleep
Now attempt to actually Safe Sleep for real. Put the Mac to Sleep, and wait for the light to start pulsing. Remove the power-source plug and the battery. Wait for the light to stop pulsing and turn off, which may take a a couple of minutes. Your Mac should now be in Safe Sleep mode. Plug the power back in and add the battery. Start-up. It should show the previous saved desktop (blurred and in grayscale) along with a progress bar as pictured above. The system should be back to the way you left it.
Safety: To be safe, don’t use FireWire target disk mode on a Mac that is in Safe Sleep/hibernation, since you may end up with filesystem corruption.
You may have problems with a bad hibernate images, which may repeatedly kernel panic. Try restarting which will start the image again. It may work. It may not, and repeatedly fail. This can happen if you don’t set “hibernatemode” properly when using secure virtual memory. If a bad hibernate image keeps booting then crashing reboot the mac holding down Command-Option-O-F to get in to Open Firmware. Type:
Hit return, then enter:
Disable Safe Sleep
To disable Safe Sleep enter in the Terminal:
sudo pmset -a hibernatemode 0
No need to restart.
For a more full undo, disable all nvramrc variables:
sudo nvram "use-nvramrc?"=false
Enter password, then restart.
Safe sleep isn’t perfect yet for all users. Safe Sleep should really only serve as a backup to regular Sleep, for times when the laptop battery is depleted or you need to unplug and move your desktop.
You should not use Safe Sleep as a replacement to regular Sleep. Regular Sleep is much faster, and uses very little power.It take about 15 seconds to enter Safe Sleep, and about 40 seconds to wake-up from it. That is much longer than the 2 seconds it takes for regular Sleep and wake-up.
Safe Sleep seems very promising though and it will be interesting to see if Apple officially supports it with older laptops.
[Updated on Nov 14, 2005 with wording changes and info on secure virtual ram.] [Updated on Nov 15, 2005 with warning on using target disk mode.]