Contribute
Register

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

Status
Not open for further replies.
Joined
Aug 19, 2012
Messages
164
Motherboard
Sabertooth x79
CPU
Core i7-3930k
Graphics
EVGA GeForce GTX 670 4GB
Mac
  1. MacBook Air
Classic Mac
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!
 

DBP

Joined
Nov 1, 2012
Messages
1,014
Motherboard
GA-Z77X-UP5 TH
CPU
i7-3770K
Graphics
HD4000 / GTX 1050 Ti
Mac
  1. iMac
  2. MacBook
  3. MacBook Air
  4. MacBook Pro
  5. Mac mini
  6. Mac Pro
Classic Mac
  1. eMac
  2. iBook
  3. iMac
  4. Power Mac
  5. PowerBook
Mobile Phone
  1. Android
  2. iOS
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.
 
Joined
Aug 19, 2012
Messages
164
Motherboard
Sabertooth x79
CPU
Core i7-3930k
Graphics
EVGA GeForce GTX 670 4GB
Mac
  1. MacBook Air
Classic Mac
Mobile Phone
  1. iOS
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:
 

tonymacx86

Administrator
Staff member
Joined
Nov 18, 2009
Messages
8,556
Motherboard
PRIME Z490-A
CPU
i5 10600K
Graphics
Vega 56
Mac
  1. MacBook Air
Classic Mac
  1. Apple
  2. PowerBook
Mobile Phone
  1. iOS
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
 
Joined
Feb 14, 2011
Messages
148
Motherboard
Gigabyte Z87X-UD5H
CPU
i7-4770K
Graphics
GTX 780
Mac
  1. MacBook Pro
Classic Mac
  1. Apple
Mobile Phone
  1. iOS
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."
 
Joined
Apr 6, 2011
Messages
17
Motherboard
Hackintosh
CPU
i5-2500K
Graphics
Intel HD 3000
Mac
Classic Mac
Mobile Phone
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!
 
Joined
Apr 17, 2012
Messages
151
Motherboard
GA-H61N-USB3
CPU
Intel Core i5-2500k
Graphics
EVGA GeForce GTX 660 SC 2GB
Mac
  1. iMac
  2. MacBook Pro
Classic Mac
Mobile Phone
  1. iOS
Wow! this is interesting and exciting because I have 8GB of RAM and only a 32GB boot SSD. All the extra space is greatly appreciated!
 
Status
Not open for further replies.
Top