What is /private/var/sleepimage? OsX
January 20, 2011 Leave a comment
I have a rocking fast macbook pro. 6Gb 8 Gb ram i5 processor and most importantly 2 hard drives!! In another post I showed howI removed my DVD rom drive and put in a second hard drive – solid state of course. I currently have an OCZ 60 gigs Vertex 2 SSD for my os and applications, and a Western Digital Black 750 gig 7200 rpm drive for my movies, music and photos.
I ran into an issue trying to install the beta of Xcode because it is 9 gigs and can only be installed on the same drive as the os. Between CS5 and the other 200 apps that I have installed (yes, I know, I have a problem) I don’t have enough room for xcode on my solid state, and xcode can only be installed on the same drive as the os.
A quick scan with GrandPerspective showed a mystery 6GB file. I suspected that it was for the swap file, but further investigation reveals that it is for an obscure feature called “Safe Sleep”. Basically safe sleep copies the entire contents of ram to the hard drive every time the laptop goes to sleep. (Similar to windows hibernate) This explains the mystery of why my macbook has always kept blinking for several seconds when I close the lid. Apple added this ‘feature’ back when the g4 was the baddest processor on the block, specifically so people wouldn’t have to turn off the computer before swapping out a battery. Now that all macs have internal, non user replaceable batteries; Safe Sleep has become antiquated.
If you are like me and don’t want to waste this space you can run these commands in the terminal. The only thing you will loose is the ability to swap out your battery without completely shutting down your computer.
johnDoesMacbook$ sudo pmset -a hibernatemode 0
johnDoesMacbook$ sudo nvram “use-nvramrc?”=false
Once you’ve done that, restart the computer then feel free to delete the sleep image file. It is located in
The private folder is hidden so you will need to either use the terminal to delete it, or show hidden files with Secrets.
johnDoesMacbook$ cd /private/var/vm
johnDoesMacbook$ sudo rm swapfile0
Be aware that the file will be recreated but it will have a 0k file size.
info resourced from