MacOS – preset the hibernation file size on a Mac so that it can always hibernate

hibernatemacosssd

The short version of the question is: is there a way to preset the hibernation file to be 8GB so that the Macbook Air can always hibernate?

My Macbook Air only has 256GB of SSD space, and right now it has about 3GB of free space. And when the Macbook Air is not plugged in to the power, sometimes I come back and the machine is already powered down.

It used to be able to wake up from deep hibernation (writing all the RAM data to SSD), but I think because I have only 3GB of SSD space and there is 8GB of RAM, so there is not enough space, and as a result, I think Mac OS X actually did a shutdown instead of hibernate. The bad thing is that in Google Chrome, I will lose all the webpages I opened. I can look into history for them, but some pages were opened 3 days ago, and it is hard to hunt down every one of them.

So is there a way to preset the hibernation file to be 8GB so that next time I clean up the SSD and have 12GB, I won't accidentally use up 5GB and then the Macbook won't be able to hibernate again? That is, reserve the space first, so that let's say if I clean up the Macbook Air to have 12GB of free space, immediate make the hibernation file 8GB, and then making the SSD only having 4GB to use?

Best Answer

I don't think there is a way you can affect the size of the file /var/vm/sleepimage, which is the file created when the mac hibernates. You can move the location to which the file is saved to another drive instead of the boot volume using the command:

sudo pmset -a hibernatefile /Volumes/OtherDrive/sleepimage

This other drive can be an external HD or perhaps a USB3 thumb drive. Another option is to purchase a Transcend Jetdrive to use for the sleepimage file, or, better yet, move files from the internal SSD to the Jetdrive.

I have doubled the capacity of my 128GB MBAir using a Transcend Jetdrive and it is more than fast enough for iTunes and iPhoto libraries.