Prevent SSD wear by using a RAM disk for cache

Jan 04, '11 07:30:00AM

Contributed by: QuickSander

Installing a new OCZ Vertex II SSD in an old 2006 iMac really speeds things up (and is documented in photos here).

However, I was searching for ways to limit the wear of my SSD (since each cell has a limited lifetime with regards to writes). One solution was to store the Safari cache on a RAM drive which will only be written to disk at logout.

Several hints on this site describe a way to store Safari cache on a RAM drive. However, none seemed to work for me because:

Therefore, I created this Mac OSX application (which is actually a simple Bash script), which you can place in your login items which will create a RAM drive and store/restore Safari cache on login/logout.

To get it running:

Actually you can store anything to the RAMdisk and the app will restore it on login, but let's use the Safari cache as an example.

Open Terminal and type:
rm -rf ~/Library/Caches/com.apple.Safari; ln -s /Volumes/RAMDisk/[username]/SafariCache ~/Library/Caches/com.apple.Safari
When you start up Safari it will create the cache on the RAM disk and at logout Cache2RAM.app will store it for you on disk (so it can be restored later on automatically). Now SSD cache writes are limited to logout only.

[crarko adds: I haven't tested this one. I've mirrored the application here.

I made some corrections based on the comments.]

Comments (40)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2011010204203424