RAM Disk gets unmounted when coming out of sleep

I have a script set up to create a RAM Disk at login. But I have now noticed that the RAM Disk (And sometimes other networked disks) get unmounted when I put the laptop to sleep and wake it up again.

Is there any way to stop this?

Mac OS X Snow Leopard 10.6.7 8GB RAM 128GB SSD 2010 13" MacBook Pro

Edit: This may be a known issue with Apple, but it is unknown if it was ever filed with them and if they ever plan on fixing it: http://openradar.appspot.com/8426423

I was using the RAM Disk as a temporary cache for my browsers, whom tend to use upwards of 500MB of space after a few days since cache on an SSD is mostly useless and doesn't boost the speed at all. It just ends up being writes and reads wearing on the SSD that don't need to be. So I wrote a script to create the SSD and required folders and placed symlinks in my Cache folder for my browsers.

It works 100% perfectly until I put the machine to sleep. Then when it wakes up the disk disappears, but somehow the browsers continue working without problems, but there is no indication that they are still writing to RAM or the SSD because no files seem to appear where they should be. If I recreate the RAM Disk, it is blank of course, but Chrome/Firefox/Safari won't start using it until I restart them.

So alternatively, is there a way to run a shell script after the computer wakes up? Maybe I could just recreate the RAM Disk when it wakes up again and hope for the best.

Or maybe I should just scrap the whole thing.


I've similar workflows around a ramdisk so I notice the same issue. I check and re-check the Energy preferences to no avail, so I started messing with the hibernatemode in pmset.

Its default is 3 in Snow Leopard & Lion, and it's not a problem until Lion. Now I've change it to 0. The difference is that no system image is written on disk, so that while sleeping, if my MBP ran out of juice, all will be gone but this drawback is negated by Lion's Resume feature.

Now, it seems my ramdisk stays around during/after sleep... See if you notice similar.


I just came across this. It has one section about sleepwatcher which seem to solve your problem.

Hope it helps