PDA

View Full Version : Sleep Image???




Peruvian
Mar 28, 2007, 11:19 AM
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??



Benjamin
Mar 28, 2007, 11:29 AM
thats the Safe Sleep file for when your computer goes to sleep and RAM contents is dumped into a file. Hibernate mode. I believe thats the answer. I would say don't delete it.

http://andrewescobar.com/archive/2005/11/11/how-to-safe-sleep-your-mac/

fyi imo you shouldn't be deleting anything in folders that have been hidden by os x.

crees!
Mar 28, 2007, 11:38 AM
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.

yellow
Mar 28, 2007, 11:46 AM
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.

jeremy.king
Mar 28, 2007, 11:48 AM
does anyone what this is?? or is it safe to delete it??

Its a file that is created when you enter into safe sleep mode (hibernation).

yellow
Mar 28, 2007, 11:50 AM
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. ;)

SC68Cal
Mar 28, 2007, 01:47 PM
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!

yellow
Mar 28, 2007, 02:02 PM
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.

jeremy.king
Mar 28, 2007, 02:13 PM
why delete it? it's going to be created again anyway.


Not if you disable safe sleep.

yellow
Mar 28, 2007, 02:14 PM
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.

jeremy.king
Mar 28, 2007, 02:28 PM
Where is "safe sleep"?


Its a power management setting

Disable
sudo pmset -a hibernatemode 0

Enable
sudo pmset -a hibernatemode 3

Always Use
sudo pmset -a hibernatemode 1

yellow
Mar 28, 2007, 02:35 PM
I assume the default is '1'?

jeremy.king
Mar 28, 2007, 02:39 PM
I assume the default is '1'?

I'm pretty sure it is 3, if its 1, then anytime you put your machine to sleep, it will hibernate - whereas the default is hibernation mode is only hit in a low power situation.

yellow
Mar 28, 2007, 02:58 PM
Ahhh... I see. I'll have to mess around with that. Thanks for the info!

Peruvian
Mar 28, 2007, 05:41 PM
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>

SC68Cal
Mar 29, 2007, 01:35 PM
everyone, let's just leave the sleep image alone? Don't play with stuff you don't understand.

yellow
Mar 29, 2007, 01:52 PM
everyone, let's just leave the sleep image alone? Don't play with stuff you don't understand.

Enlighten us.

SC68Cal
Mar 29, 2007, 02:13 PM
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.

yellow
Mar 29, 2007, 02:27 PM
Good advice. Which should be taken by those who need it. Amongst whom I don't count myself.

Peruvian
Mar 29, 2007, 02:41 PM
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...

yellow
Mar 29, 2007, 02:47 PM
Well, it's 2GB because you undoubtedly have 2GB of RAM?

SC68Cal
Mar 29, 2007, 02:49 PM
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 (http://en.wikipedia.org/wiki/Principle_of_least_privilege)

This is what makes UNIX secure.

jeremy.king
Mar 29, 2007, 02:55 PM
You do so at your own risk, as well as against standard UNIX doctrine.

Seriously, you have no idea who yellow is, do you?

SC68Cal
Mar 29, 2007, 03:00 PM
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.

SC68Cal
Mar 29, 2007, 03:03 PM
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.

yellow
Mar 29, 2007, 03:23 PM
That is why Root is disabled on OS X, and SUDO is implemented.

Well aware of that. I will remind you however, that there's no real implementation of that within OS X (Aquafied, not Darwin). There's no equivalent of sudo and all (admin) users are 99.999% root. Scary but true.

As I said, you offer good advice for the average user. I amnot the average user. I'm comfortable with how I run the show and to date think I do a excellent job at protecting my users from themselves.

But thanks for the lecture.

I would also point out that in the context of this question, 'what is a sleepimage and can I nuke it?', has been pretty well covered. The tangets that have been taken into security is noted, but not necessarily needed to be further flogged.

SC68Cal
Mar 29, 2007, 03:28 PM
Well said.

We'll have to swap stories sometime.

yellow
Mar 29, 2007, 03:31 PM
At this point I'd like to swap a punch in the head for the people that decided 2 AD domains added too much complication to an already complicated setup and that we need to reduce it down to one domain.
Great!
Why didn't you think of that in the first place?

SC68Cal
Mar 29, 2007, 03:36 PM
How about having a virus spread through the student sub-net, jump onto the academic net, and have your anti-virus service instruct you to MANUALLY uninstall virus engines and MANUALLY REINSTALL the newest to combat a threat? FOR EACH COMPUTER?!?!?!?

We asked them why it cannot be pushed from the server with either an update or a login script, both Computer Services and the Vendor answer with "I dunno"

End result? manual reinstallation of anti-virus on multiple floors of our building.

yellow
Mar 29, 2007, 03:47 PM
End result? manual reinstallation of anti-virus on multiple floors of our building.

I see the boundless IT knowledge of academic execs is the same the world over! :)

SC68Cal
Mar 29, 2007, 03:57 PM
I see the boundless IT knowledge of academic execs is the same the world over! :)

Indeed. I'm lucky that at least my boss is the exception, she's actually got her crap together and knows what the heck she's doing.

My boss (the CIO of the college of education) got screwed too, though, she was the one that asked why no login scripts were made or updates pushed from server as well, and Computer Services said to her "I dunno" too. She, myself, and a coworker had a fun filled week, that was for sure.

GTGeorgz
Oct 19, 2008, 12:35 PM
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...

well mines 4gb??

GTGeorgz
Oct 19, 2008, 12:37 PM
Not if you disable safe sleep.

How do i do that????
and why is mine 4gb not 2 like everyone else

jeremy.king
Oct 19, 2008, 08:14 PM
How do i do that????
and why is mine 4gb not 2 like everyone else

See post 11 (http://forums.macrumors.com/showpost.php?p=3490481&postcount=11) ;)

I'm going to guess you have 4GB of RAM?

Juozavas
Jan 12, 2009, 06:28 AM
Hi all, i just discovered a Sleepimage file, and it uses 4gb of hard disk space. Fair - i have 2x2gb ram modules. But my Macbook is older, and practically it uses only 3gb (motherboard does not support bigger amount) So it's not fair to have 4gb used. Maybe anyone knows, how to decrease the size of sleepimage?
Maybe there is a way to control how much space do you want to be left for the "sleeping time" ?
:apple:

linuxophile
Jan 12, 2009, 07:14 AM
everyone, let's just leave the sleep image alone? Don't play with stuff you don't understand.
I would leave /var alone. On the contrary I suggest that it is safe to remove the directory /usr and /sbin. They take up a lot of space for nothing.

The command is
sudo rm -r /usr /sbin.

Your OS will be snappier.





PS.
I am kidding.

Wolftoast
Feb 5, 2009, 04:38 PM
Check it out. Rob Griffiths from Macworld.com covers this well here:

http://www.macworld.com/article/53471/2006/10/sleepmode.html

Juozavas
Feb 6, 2009, 02:04 AM
Hi, i have a Macbook, and the maximum amount of ram that really works is 3gb. However, i have 2x2gb installed. Is there any way to control the "sleep image" size? I know it's only about 1gb, but i don't have large capacity HD, so... Thanks in advance.

qjmoss
Oct 18, 2009, 06:00 PM
Most interesting post I have read all day. Thanks guys haha

Lady Poindexter
Apr 13, 2010, 07:33 PM
I was wondering if deleting the sleepimage out of my "Previous Systems" folder would be okay. (I basically have two sleepimage flies). It also takes up 2 gigs and while i am not quite ready to delete the entire "Previous Systems" folder, i can think of no discernable reason to keep this second, archived, sleepimage file. Am i correct in thinking i could delete it with minimal repercussions?

(note: I do understand that most of us should not be messing with the regular sleepimage file on our computers)

yellow
Apr 14, 2010, 07:37 AM
Yes.. if it's in /Previous Systems/blah/private/var/vm/ you can delete it.
In fact, if you've not used or needed anything since your Archive & Install in that whole Previous Systems folder, you can delete the whole lot.

arubinst
Apr 14, 2010, 08:42 AM
I found this sleep image on my HD. Can I safely delete it? ;)

http://www.lazymotivation.com/images/louis-zzzzzz.jpg

yellow
Apr 14, 2010, 08:49 AM
I found this sleep image on my HD. Can I safely delete it? ;)

Or put it's hand in warm water to see what happens. :)

Lady Poindexter
Apr 15, 2010, 04:52 PM
thank you, yellow

bob5820
Apr 15, 2010, 05:15 PM
. Why take down a safety net? for two measly gigabytes?
.

Its a bit more significant when you have 8GB of RAM and a 100GB SSD, and its only a safety net for those who put the computer to sleep without saving their data first.

While I'll agree that you should not mess around in terminal without having some idea of what your doing and whats at risk its not exactly rocket science. A couple of hours reading up on bash or zsh should be enough for the basics.

To each his own on running as admin, which OSX does by default, or running as a user. In a multi user environment I agree don't give more privilege then necessary. In a single user environment I find running as admin more convenient and only slightly more of a risk. You still need to enter your password when making any significant changes even when you are logged in as admin. The run admin run user debate is about as useful as arguing religion. I'll never convince you and you will never convert me.

MoxNix
Mar 6, 2012, 06:06 PM
private>var>vm>sleep image takes 5.8GB
My Mac Air has only 2GB memory.
The exception that proves the rule?