Sleep Image???

Discussion in 'MacBook Pro' started by Peruvian, Mar 28, 2007.

  1. Peruvian macrumors regular

    Peruvian

    Joined:
    Jun 10, 2006
    Location:
    U.K.
    #1
    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??
     
  2. Benjamin macrumors 6502a

    Benjamin

    Joined:
    Oct 27, 2003
    Location:
    Portland, OR
    #2
  3. crees! macrumors 68000

    crees!

    Joined:
    Jun 14, 2003
    Location:
    MD/VA/DC
    #3
    Words of wisdom. If you don't know what it is, don't mess with it.
     
  4. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #4
    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.
     
  5. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #5
    Its a file that is created when you enter into safe sleep mode (hibernation).
     
  6. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #6
    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. ;)
     
  7. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #7
    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!
     
  8. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #8
    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.
     
  9. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #9
    Not if you disable safe sleep.
     
  10. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #10
    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.
     

    Attached Files:

  11. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #11
    Its a power management setting

    Disable
    sudo pmset -a hibernatemode 0

    Enable
    sudo pmset -a hibernatemode 3

    Always Use
    sudo pmset -a hibernatemode 1
     
  12. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
  13. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #13
    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.
     
  14. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #14
    Ahhh... I see. I'll have to mess around with that. Thanks for the info!
     
  15. Peruvian thread starter macrumors regular

    Peruvian

    Joined:
    Jun 10, 2006
    Location:
    U.K.
    #15
    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>
     
  16. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #16
    everyone, let's just leave the sleep image alone? Don't play with stuff you don't understand.
     
  17. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #17
    Enlighten us.
     
  18. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #18
    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.
     
  19. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #19
    Good advice. Which should be taken by those who need it. Amongst whom I don't count myself.
     
  20. Peruvian thread starter macrumors regular

    Peruvian

    Joined:
    Jun 10, 2006
    Location:
    U.K.
    #20
    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...
     
  21. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #21
    Well, it's 2GB because you undoubtedly have 2GB of RAM?
     
  22. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #22
    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.
     
  23. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #23
    Seriously, you have no idea who yellow is, do you?
     
  24. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #24

    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.
     
  25. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #25
    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.
     

Share This Page