Mounting RAM Disks as "-notremovable"

Joined
Feb 7, 2010
Messages
4
Reaction score
0
Points
1
I am replacing my G5 (10.5) Xserve with a late 2008 Xserve (10.6). This server is primarily a web server, with a small amount of mail traffic.

I keep my 'webfolder' on a RAM disk. All of my pages are dymanic php/mysql, so they can't be cached. But reading from RAM is so fast, you'd never know it.

This is the command I used in 10.5 to create a 1 GB RAM disk at boot:
Code:
/usr/sbin/diskutil erasevolume HFS+ "web-ram" `/usr/bin/hdiutil attach -notremovable -nomount ram://2200000`

Note the "notremovable", that flag makes the system treat the mounted disk image (or in this case, the RAM disk), like a real physical disk, and not a mounted disk image. When you use this flag, the ram disk will actually show up with a regular hard drive icon. Without this flag, it shows up as a white disk image.

But this flag doesn't work in 10.6. According to the man page, it's still there. But when I use it, I get permissions errors. I am using it with sudo (from the command line, or as root via lanuchdeamons). As I look closer at my errors, It appears that what might be happening is that the diskutil command is being run as root, but the hdiutil command inside of it, is not.

I've had this script working for over two years under a 10.5 system. I also tested it on 10.7 and 10.8 seeds, and it works great on all of them. But on every 10.6 system I've tested, it will not work. But this server must run 10.6. 10.7 Server dropped some of the vital features I need.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top