Moving the hibernate image file on a MacBookPro…

So I like to partition my Macs so that my user directory is on a different partition to the system drive.
I got kind of frustrated when I got my MacBook Pro and realised that due to having 2Gb of RAM, the hibernate settings by default were taking up an extra 2Gb on my system partition with the sleep image file at /var/vm/sleepimage.

After poking around with pmset for a while, I realised that you can move the image file…

sudo pmset -a hibernatefile /Volumes/OtherVolume/sleepimage

Then trash /var/vm/sleepimage, and all seems hunky-dory…

There are some other useful settings I’ve seen people mention on the web, like setting:

sudo pmset -a  hibernatemode x

Where x is an integer meaning:

  • 0 – disable hibernate mode.
  • 1 – hibernate when shutting the lid instead of sleeping.
  • 3 – normal hibernate settings.
  • 5 – hibernate when shutting the lid instead of sleeping (with secure virtual memory turned on)
  • 7 – normal hibernate settings (with secure virtual memory turned on)

I wonder what the even numbers do…

5 thoughts on “Moving the hibernate image file on a MacBookPro…

  1. man pmset reveals that hibernatefile should only be on “the root volume”.

    hibernatefile – change hibernation image file location. Image may only be located on the root volume. Please use caution. (value = path)

    However, since pmset allows me to set it to a non-root-volume file, I assume it’s OK?!

  2. So yeah, I tried this, doesn’t work on my MacBook Pro. The system goes into hibernation, and appears to write the hibernate file as far as I can tell, but when it tries to start from the hibernate file it crashes, then instantly restarts. The effect is one grey screen – when it tries to wake from hibernate – followed by a black screen as the system restarts and boots normally. This is on a 2009 unibody MacBook Pro 17″

    Oh, well.

  3. This is a better description of those numbers by the way:

    # 0: disable hibernate
    # 1: hibernate instantly on lid shut
    # 3: hibernate when asleep and power removed (default)
    # 5: hibernate instantly on lid shut and ensure decrypted swap
    # 7: hibernate when asleep and power removed and ensure decrypted swap

    From waht I understand, laptops were defaulting to 5 because secure VM didn’t work with hibernatemode initially, but this was later fixed, so 5 and 7 are actually more insecure modes.

    I haven’t tested moving the hibernatefile since I first wrote this post over 3 years ago :) so it’s entirely possible it was broken at some point since then, but it was working for me in those heady days of 2006, when Justin Timberlake was Sexyback.

  4. I had success moving the sleepimage file to a “non-root” volume. I think the man page is worded misleadingly… You probably can’t move it to a volume that’s not on the same disk as the root.

    I moved mine to /Volumes/Swap (a partition on my laptop’s internal disk) and had no problems going to sleep or waking up. I made sure it used the hibernation file by removing power and battery after I put it to sleep.

    This is on a mid-2008 MBP.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>