Contribute
Register

Remove "sleepimage" and get many GBs back and faster sleep!

Status
Not open for further replies.
Joined
Aug 18, 2012
Messages
143
Motherboard
Sabertooth x79
CPU
Core i7-3930k
Graphics
EVGA GeForce GTX 670 4GB
Mac
  1. MacBook Air
Classic Mac
  1. 0
Mobile Phone
  1. iOS
I recently used CCC to clone my main OS drive only to notice that it copied only about 37gb of the 70gb on my OS drive. I was so puzzled about this. Then I discovered the culprit: a 34gb sleep image file that CCC doesn't copy... but as soon as I booted into my clone drive, the file appeared and the clone was bloated to the 70gb drive size.

But here's the kicker: for desktops, you don't really need that sleep image file! The file is generally about the size of the RAM you have installed on your system (mine is 32gb RAM)... So you could easily get this space back. On top of that: my computer goes to sleep instantly now rather than waiting a while to do so (as it has to write the sleep image file anew when you go to sleep with sleep image enabled or "safe sleep").

There's a previous thread started asking about whether it's ok to do this here: http://www.tonymacx86.com/general-help/85674-safe-disable-safe-sleep.html ...But I thought this was a significant enough gain to point it out with a separate thread!

Here's the guide I followed: http://www.maclife.com/article/howtos/how_remove_diskhogging_sleepimage_file_your_mac

And here's some useful reading on this function: http://www.tuaw.com/2011/08/22/why-hibernate-or-safe-sleep-mode-is-no-longer-necessary-in-os/

To remove the sleep image file:
Code:
sudo rm -rf /var/vm/sleepimage

To disable safe sleep mode:
Code:
sudo pmset hibernatemode 0
Happy hacking!
 
qwerty123, I thought you would have read my build posts where I mention this. :)

This is such a simple trick to save lots of space (and only laptops really benefit from hibernate mode 3) that everyone who discovers it is usually very excited about it. :D
Actually, I've been using this on my MacBooks for years so that when I close the lid the machine goes to sleep almost immediately without spending time writing out RAM to disk. The only risk then is that if the battery runs down completely during sleep that I'll lose everything and have to reboot, but that risk has been worth it for me. Even with the newer laptops with SSDs the saving is faster, but as MrEddy mentions every gigabyte is precious on a laptop SSD.
 
qwerty123, I thought you would have read my build posts where I mention this. :)

Ha! Only saw your posts after I discovered (that other people had discovered) this. I'm surprised more people don't post doing this. It really does make a big difference especially if your boot drive is an SSD and you've got a lot of RAM!

Many cheers to you for including this in your build guides! :thumbup:
 
Great work everyone- we're going to add this to the next MultiBeast. Sleep and wake seem instantaneous now.

Here are before and after shots showing that I regained disk space:

diskspace1.pngdiskspace2.png

Edit: This is done automatically in MultiBeast now :D
 
Here's something from that Mac Life article needs to be considered before deleting the "sleepimage" file:

"When you start your machine back up, your Mac will perform a normal reboot without restoring windows, and opened files."
 
It should perhaps be noted that instead of actually storing whatever is in your RAM on your HDD it instead remains on the RAM. This has the consequence of your machine booting up once in a while to retain the state of the RAM. So if you actually shut off for your power source to your machine this is not the way to go. I myself have been using this "trick" for quite a while as I only have 128gigs of SSD storage and the trade-off is therefore minimal. And it's also a no-brainer if you actually don't use the sleep functionality...

Kudos for bringing it up though, I'm sure a lot will benefit from it!
 
Status
Not open for further replies.
Back
Top