SleepImage files and sleep modes for laptops

If you use disk cleanup utilities such as WhatSize, CleanApp, or Grand Perspective to see the files on your system, you may run into a fairly large file called "sleepimage." This file may be up to 8GB in size for current laptops, and is in the hidden /

Written by Topher Kessler

If you use disk cleanup utilities such as WhatSize, CleanApp, or Grand Perspective to see the files on your system, you may run into a fairly large file called "sleepimage." This file may be up to 8GB in size for current laptops, and is in the hidden /private/var/vm/ folder.

Where does it come from?

In newer laptop models, Apple has implemented a hibernation sleep mode which will activate before all power is lost to the system (ie: the battery is about to die). When hibernation is activated, the computer will write all the contents of RAM to the disk in this "sleepimage" file, and then set the hardware to read the contents of this image back to RAM upon wakeup, before cutting all power to the system components and essentially shutting down the computer.

This is different from standard "sleep" mode, where RAM maintains its information and still draws power so the computer can more quickly start up.

Is it safe to delete?

Absolutely. The image will be recreated the next time your computer goes into hibernation mode, so if you are not regularly going into hibernation mode you can enter the following command in the Terminal to delete the file and free up some hard drive space (the image will be the same size as the amount of RAM in your system):

sudo rm /private/var/vm/sleepimage

How do I disable or change hibernation mode?

New laptops store the default hibernation mode in the computer's power management controller (SMC), which can be read by entering "pmset -g" in the Terminal. The number next to "hibernatemode" will indicate the type of hibernation the system will perform:

0 - no sleepimage is used, and RAM contents are kept alive.
1 - only sleepimage is used, and RAM contents are purged.
3 - RAM is kept alive and a sleepimage is used when power reaches critical levels.
5 - only sleepimage is used, but with secure virtual memory enabled.
7 - both live RAM and sleepimage are used, but with secure virtual memory enabled.

To change the sleep mode, enter the following command, in which "NUMBER" is one of the previous ones:

sudo pmset -a hibernatemode NUMBER

While setting this to 0 will speed up the wake/sleep process, it will also jeopardize your data in the event of a total power loss, so use caution if you set the sleep mode to this. Additionally, be sure to set 5 or 7 only if you have enabled secure virtual memory in the "Security" system preferences.

Questions? Comments? Send us feedback: http://www.macfixit.com/contact
Be sure to check us out on Twitter and the CNET Mac forums.


Topher has been an avid Mac user for the past 10-15 years, and has been a contributing author to MacFixIt for just over a year now. One of his diehard passions has been troubleshooting Mac problems and making the best use of Macs and Apple hardware both for family and friends, as well as in the workplace. He and the newly formed MacFixIt team are hoping to bring enhanced and more personable content to our readers, and keep the MacFixIt community going here at CNET. If you have questions or comments for Topher or the other MacFixIt editors, feel free to contact us at http://www.macfixit.com/contact

Resources
  • http://www.macfixit.com/co...
  • Twitter
  • CNET Mac forums
  • More from Late-Breakers
  •  

    Join the discussion

    Conversation powered by Livefyre

    Show Comments Hide Comments