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

Peruvian

macrumors 6502
Original poster
Jun 10, 2006
251
10
U.K.
I just ran the omnidisksweeper to see what space i could release on my HD, I have found a file which is 2gb called sleep image..

It can be located by this path:

private/var/vm

does anyone what this is?? or is it safe to delete it??
 
I just ran the omnidisksweeper to see what space i could release on my HD, I have found a file which is 2gb called sleep image..

It can be located by this path:

private/var/vm

does anyone what this is?? or is it safe to delete it??

Words of wisdom. If you don't know what it is, don't mess with it.
 
More words of wisdom. Yes, you can delete it it a reboot doesn't do it for you.
It should be automatically removed when a Mac comes out of sleep, but sometimes this doesn't happen, and the detritus left over wastes disk space. The startup scripts that run on boot clean up /var/vm/ and it may go bye-bye then, but if not.. feel free to delete it without worry.
 
Perhaps I should note that I've deleted it multiple times off my MBP with no ill effects. My Mac works fine and still sleeps happily. ;)
 
why delete it? it's going to be created again anyway.

I'd reccomend anyone out there that deletes the sleep image also delete the swap file as well, because you know, that'll free up space too!
 
why delete it? it's going to be created again anyway.

I'd reccomend anyone out there that deletes the sleep image also delete the swap file as well, because you know, that'll free up space too!

A swap file doesn't (rarely, maybe) reaches 2048MB in size.

And yes, it's going to be created again, but it won't be THAT one. It'll have a new one created. So, now you've got a 2GB (in my case, because I have 2GB of RAM) wasted on my disk because I've had a wake-from-sleep failure that caused me to reboot the machine.
 
Not if you disable safe sleep.

Where is "safe sleep"?

Well, I was partially wrong. The swapfile gets recreated, but it's a zero length file.

More info:

I slept the computer (closed lid) between removal and subsequent checking. The sleepfile was recreated, but has a zero length. On subsequent lid closures, the file grew no larger.
 

Attachments

  • Jiggity.jpg
    Jiggity.jpg
    48.8 KB · Views: 406
Ok, i deleted the 2gb file i talked about in the original post, but any time i restart, the same file reappears, still at 2gb...

How do i get this to stop reappearing>
 
everyone, let's just leave the sleep image alone? Don't play with stuff you don't understand.
 
First off, that sleepimage file is for your own sake. If your computer is asleep and the battery dies or is removed that saves the state that your computer is in, so that when a power source is returned you retain your state, and no data is lost. Why take down a safety net? for two measly gigabytes?

Secondly, you're all playing around inside of the /private directory which has lots of files that YOU THE USER should not play around with, but I imagine you are all running around in Admin accounts, which is a major bad practice. It's a matter of principal that unless you know EXACTLY what you are DOING that you should run as a standard user right up until you absoluetly have to have admin privledges.
 
Ok , i feel you on the advice which is appreciated, but just for my knowledge, why when i delete does it come back, still at 2gig. i know its only a small amount but i need the space at the moment, and surely it shouldnt be 2gig but something smaller...
 
Good advice. Which should be taken by those who need it. Amongst whom I don't count myself.

You do so at your own risk, as well as against standard UNIX doctrine. The common wisdom for security escalation is that you only use it when you specifically need it. When you hit something that you need to do as admin, you authenticate to elevate your privilidges, do what you need to do (in a quick and precise manner, don't dilly dally), then de-escalate to back to standard user, to remove any risks of hurting anything by accident.

That is why Root is disabled on OS X, and SUDO is implemented. It only allows you to do a task or two as ROOT, rather than waltzing around with the ability to destroy everything if you trip up.

Principle of Least Privilege

This is what makes UNIX secure.
 
Ok , i feel you on the advice which is appreciated, but just for my knowledge, why when i delete does it come back, still at 2gig. i know its only a small amount but i need the space at the moment, and surely it shouldnt be 2gig but something smaller...


It's 2 gigabytes because that is your ram size.

The sleep image is a file on the hard drive that the system RAM is written to, in order to prevent against loss of contents in the case of a power outage. If it happens, the memory in the RAM is lost, and needs to be restored from the disk, to return to the state when the computer was put to sleep.

You don't know what you are doing, clearly. Leave it alone.
 
Seriously, you have no idea who yellow is, do you?

I don't care, really. My feeling is that if you run as admin for your day to day, you're not exercising careful judgement.

I work for a large university as a system administrator and application developer. Security is my bread and butter.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.