Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is Persistent Storage-hogging Sleepimage New to 10.11.4?

Upfront, the only thing I can point to is an El Capitan software update to 10.11.4 via the App Store on March 22, 2016, but I'm open to other informed explanations based on what follows...


After updating OSX to 10.11.4, I noticed a sudden, inexplicable drop of roughly 2 GB on my iMac's SSD hard drive. Investigating, I found a 2.1 GB "sleepimage" at /private/var/vm that (I swear!) wasn't there before this update,


Using Terminal, I first verified that my Mac was set to "hibernatemode 0," which supposedly prevents OSX from writing RAM contents to my hard drive before sleep. (It was set to 0.)


Using Terminal, I then deleted the 2.1 GB hard-drive bloat of this unnecessary sleep image, confident that this would solve the problem.


Despite this, every time I either restart my Mac, or shut down and reboot later after these steps, this @%&$*! sleep-image bloat reoccurs.


What puzzles me:

* "hibernatemode 3" should prevent creating a RAM sleep image period, but it's still happening. Why?

* Why is my iMac creating a sleep image at all when A) my Mac isn't allowed to sleep?; B) I reboot/restart my Mac after deleting this sleep image via Terminal; or C) I'm using a wired/non-battery Mac that likely won't run out of power to begin with?


cjr

iMac (21.5-inch, Late 2013), OS X El Capitan (10.11.4), 250GB SSD, 16 GB RAM

Posted on Apr 7, 2016 1:03 PM

Reply
Question marked as Best reply

Posted on Apr 7, 2016 1:17 PM

From the old Mac Hints site:


To disable safe sleep, run the two following commands in Terminal:


$ sudo pmset -a hibernatemode 0

$ sudo nvram "use-nvramrc?"=false


When done, restart your computer. Now go delete the file /private var vm sleepimage" to free up some hard drive space. When you put your computer to sleep it, should happen in under five seconds; my MacBook now goes to sleep in two seconds.


[robg adds: To state the obvious, with safe sleep disabled, a total power loss will wipe out whatever was open on your machine. To enable safe sleep mode again, repeat the above commands, but change hibernatemode 0 on the first line to hibernatemode 3, and =false to =true on the second line. You'll then need to reboot again. Personally, I prefer the safe sleep mode, even with the slower sleep time and hard drive consumption -- even if for no other reason than it's great when changing batteries on a flight.]


If your computer has 16 GBs of RAM, the sleepimage file should be about that same size. Note there are potential risks to deleting the image.


Description and modification of the different hibernate modes


When the computer goes into sleeping mode, its behavior depends on a power management variable called hibernatemode. The hibernate mode can be set to different values:


  • 0 - Default sleep behavior on most Apple computers. RAM is still powered on while sleeping. Wake up is fast. Safe sleep is disabled.
  • 1 - Hibernation behavior. System is totally shut down while sleeping. RAM contents are dumped to disk. Wake up is slow.
  • 3 - Default behavior on Powerbook HD computers. RAM is still powered on while sleeping. Wake up is fast. Safe sleep is enabled, so RAM contents are also dumped to disk before going to sleep.


Only a single mode can be activated at a time. In order to check what hibernate mode is currently active, the following command can be used in the Terminal application:


pmset -g | grep hibernatemode


In addition, users with administrator privileges can choose the hibernate mode. In order to do so, the following command can be used:


sudo pmset -a hibernatemode X


Replace X with the value of the hibernate mode to set. Enter your admin password when prompted. It will not be echoed.


Also see Energy Saver- About sleep and idle modes in Mac OS X.

5 replies
Question marked as Best reply

Apr 7, 2016 1:17 PM in response to cjr

From the old Mac Hints site:


To disable safe sleep, run the two following commands in Terminal:


$ sudo pmset -a hibernatemode 0

$ sudo nvram "use-nvramrc?"=false


When done, restart your computer. Now go delete the file /private var vm sleepimage" to free up some hard drive space. When you put your computer to sleep it, should happen in under five seconds; my MacBook now goes to sleep in two seconds.


[robg adds: To state the obvious, with safe sleep disabled, a total power loss will wipe out whatever was open on your machine. To enable safe sleep mode again, repeat the above commands, but change hibernatemode 0 on the first line to hibernatemode 3, and =false to =true on the second line. You'll then need to reboot again. Personally, I prefer the safe sleep mode, even with the slower sleep time and hard drive consumption -- even if for no other reason than it's great when changing batteries on a flight.]


If your computer has 16 GBs of RAM, the sleepimage file should be about that same size. Note there are potential risks to deleting the image.


Description and modification of the different hibernate modes


When the computer goes into sleeping mode, its behavior depends on a power management variable called hibernatemode. The hibernate mode can be set to different values:


  • 0 - Default sleep behavior on most Apple computers. RAM is still powered on while sleeping. Wake up is fast. Safe sleep is disabled.
  • 1 - Hibernation behavior. System is totally shut down while sleeping. RAM contents are dumped to disk. Wake up is slow.
  • 3 - Default behavior on Powerbook HD computers. RAM is still powered on while sleeping. Wake up is fast. Safe sleep is enabled, so RAM contents are also dumped to disk before going to sleep.


Only a single mode can be activated at a time. In order to check what hibernate mode is currently active, the following command can be used in the Terminal application:


pmset -g | grep hibernatemode


In addition, users with administrator privileges can choose the hibernate mode. In order to do so, the following command can be used:


sudo pmset -a hibernatemode X


Replace X with the value of the hibernate mode to set. Enter your admin password when prompted. It will not be echoed.


Also see Energy Saver- About sleep and idle modes in Mac OS X.

Apr 9, 2016 11:30 AM in response to theratter

Unfortunately, I've tried these Terminal commands but the sleep image still recreates itself on reboot.


While this sleep image isn't duplicating my available 16GB of RAM in terms of file size, it just annoys me that I now have 2.1GB less space for no reason on my non-battery-powered desktop Mac, and that this sleep image creates itself even when my Mac doesn't go to sleep.


Using pmset -g custom in Terminal results in the following verbose info:

AC Power:

Sleep On Power Button 1

autopoweroff 1

autopoweroffdelay 14400

standbydelay 10800

standby 1

ttyskeepawake 1

hibernatemode 0

powernap 1

hibernatefile /var/vm/sleepimage

womp 1

displaysleep 120

networkoversleep 0

sleep 120

halfdim 1

autorestart 0

disksleep 10


I've read that creating a "null" sleep image might stop this behavior:


cd /var/vm

sudo rm sleepimage

sudo ln -s /null/nullvalue sleepimage


Has anyone tried this?


cjr

Sep 22, 2016 7:31 AM in response to cjr

Follow these steps which I found on another site.

I've been successfully using them on OS X 10.10 - 10.11 for quite a while.


If you change the path, you can even apply the commands to other partitions and external volumes.

Otherwise you'd have to boot to each volume and apply them there.


If you only do this on your boot partition, the changes only take place there. If you then clone that partition/volume to another location, the settings don't follow, so you must apply them there once. After that the settings are retained through backups.


Example: I have several external drives that I frequently clone my internal drive to for backup.

Although the sleepimage file is disabled on my internal drive, the file on the backups were not affected until I applied these commands to them. Now all the backups have 0-byte locked sleepimge files, which freed up 8 GB on each one.



View the sleep image size:

Type in the Terminal: ls -lh /private/var/vm/sleepimage


Disable sleep mode:

Type in the Terminal: sudo pmset -a hibernatemode 0


Remove the image:

Type in the Terminal: sudo rm /private/var/vm/sleepimage


Create a 0-byte file:

Type in the Terminal: sudo touch /private/var/vm/sleepimage


Make the file not writable:

Type in the Terminal: sudo chflags uchg /private/var/vm/sleepimage


Run these commands one by one and reboot.

After reboot, re-run the first command to check the sleep image size (or check it in the hidden folder /private/var/vm).

Is Persistent Storage-hogging Sleepimage New to 10.11.4?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.