A couple of additional SafeSleep tips and tricks
Mar 02, '06 05:29:00AM • Contributed by: TrumpetPower!
Mar 02, '06 05:29:00AM • Contributed by: TrumpetPower!
If you've been using Safe Sleep (see these two hints on it), you should probably also be aware that resetting the PRAM (Command-Option-P-R at boot, or through OpenFirmware) will clear the NVRAM property that enables Safe Sleep.
This is both good and bad: if you're unable to boot the computer because of a corrupted sleepimage file (such as happens if you use the hibernatemode pmset option for encrypted swap when your swap isn't encrypted, or vice-versa), it's a quick-and-easy way to get the computer booting again. It's bad because I'm sure somebody will set up Safe Sleep, come to rely upon it, reset the PRAM for some other reason...and really, really get upset when the computer did a normal sleep rather than a Safe Sleep!
Also, somebody might find the following shell script handy:
#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin;
sudo -v
sudo nvram nvramrc='" /" select-dev
" msh" encode-string " has-safe-sleep" property
unselect
';
sudo nvram "use-nvramrc?"=true;
if sysctl vm.swapusage | grep -q 'encrypted'; then
sudo pmset -a hibernatemode 7;
else
sudo pmset -a hibernatemode 3;
fi
echo "You must restart your computer to finish enabling Safe Sleep."
It'll automagically take care of figuring out which hibernatemode to use; just run it (remember to make it executable) and (assuming your hardware supports it), Safe Sleep is enabled. (And reboot, of course.)
•
[14,448 views]
