Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Trojan Man

macrumors newbie
Original poster
May 6, 2013
2
0
Hi all,

So after some time scouring these forums, I confronted my massive hidden usage of storage under the 'Other' category with OmniDiskSweeper. I found a folder called 'private' with an 8.6 GB sleepimage and 60 GB of swapfiles. This is using a massive chunk of my 120 GB, and I was wondering if it's safe to delete these files or whether anyone has any alternate solutions - it's getting to the point where Chrome and MS Word are becoming unresponsive following the "startup disk almost full" notification. Thanks!

-T
 
Reboot and your swap files will disappear, you can disable the sleep image by issueing the following command in the terminal (found in Applications->Utilities)

Set sleep mode in shell: sudo pmset -a hibernatemode 0
Remove the image: sudo rm /private/var/vm/sleepimage
Create a blanked file: sudo touch /private/var/vm/sleepimage
Make file immutable: sudo chflags uchg /private/var/vm/sleepimage
 
I found a folder called 'private' with an 8.6 GB sleepimage and 60 GB of swapfiles.
60 Gb of Swap is a lot -- as said, a reboot will clear those, but perhaps you might benefit from more RAM, if you can install it in your Mac model.

The sleepimage is important, if you want your Mac to remember what it was doing when it wakes from sleep. Disabling it will have consequences in this regard.

It's generally a bad idea to go deleting invisible system files. However, the 60Gb recovered from the Swap should go a long way, but if it is creeping back quickly, then something else might be at play.
 
Last edited:
Thanks so much - a simple reboot did the trick. I hadn't considered it initially because I had rebooted only a couple days ago; the fact that it crept back so quickly is somewhat unsettling, but the issue of the startup disk being almost full is solved for now. Again, I appreciate your time and assistance.
 
"The sleepimage is important, if you want your Mac to remember what it was doing when it wakes from sleep. Disabling it will have consequences in this regard."

I disable the sleep image function and delete the sleep image file.

Having done so, I've had no problems...
 
"What happens when your battery runs out?"

Well, I'll assume that the MacBooks powers off and you have to plug in the charger to re-charge it…!

I've had my MacBook Pro for 3 years now, and I can only recall the battery running low enough to invoke a "power-down" once or perhaps twice. I just put the charger on it, and back to normal...
 
Well, I'll assume that the MacBooks powers off and you have to plug in the charger to re-charge it…!
If you had a sleep image, the memory would be retained. Without it, you boot up, having lost any unsaved data.

I'm curious -- what happens when your laptop goes to "sleep", if there is no sleep image? If it can't save a sleep image, does it continue to power the RAM (which means shorter battery life while "sleeping")?

What is the problem with a sleep image -- is it the size you object to, or do you think the continual writes will shorten the life of the SSD?
 
Having switched to hibernatemode 0, I'd like to second these queries. If my battery is totally drained, the computer simply reboots once plugged in and woken up, i.e. I just need to ensure I've saved my work first? What sort of warning is involved prior to old-fashioned sleep? Will I still have the reserve power notification shortly before it conks out, or not at all?
 
With the sleep image disabled, I get a warning that I'm down to approximately 2-3% power. At that point, I just plug the power adapter in.

That's only happened a couple of times, because I generally don't wait until power has dropped to that low a level, before re-charging…
 
With the sleep image disabled, I get a warning that I'm down to approximately 2-3% power. At that point, I just plug the power adapter in.
But it's worth pointing out that, at that point, if you don't or can't plug the power in and the machine runs out of juice, you will lose anything in memory and have to reboot once you have a power source.
Obviously, that's less of a problem with Autosave and Resume.

It's also worth pointing out that if the Mac can't sleep, it's going to use more power to keep the RAM powered when you're not using it.
 
Good to know, thanks. Unless it's a massive difference in battery life we're talking about, I'd prefer that to 16GB writes to the SSD each time my computer goes into hibernation mode 3.
On a modern SSD, you have nothing to fear from writes. The days of preciously counting the writes until the drive dies are over.
 
On a modern SSD, you have nothing to fear from writes. The days of preciously counting the writes until the drive dies are over.

Heh, okay. Any idea how to undo sudo touch /private/var/vm/sleepimage and sudo chflags uchg /private/var/vm/sleepimage, then? :)
 
Heh, okay. Any idea how to undo sudo touch /private/var/vm/sleepimage and sudo chflags uchg /private/var/vm/sleepimage, then? :)
touch simply creates a file of zero K. chflags uchg makes it unchangeable.

Use "chflags nouchg" instead, and the file should get over-written. Or you can delete it and the system will create a new one.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.