Home Forums OS X Server and Client Discussion Questions and Answers Making RAM disks in 10.6 that are -notremovable

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #381858

    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`[/code]

    Not 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.

    Anyway this is about more than just the icon. When the ram disk is mounted as a real disk, its harder to eject, which is good because it’s my web folder and I don’t want it going anywhere. AND when its mounted that way, I can use time machine to back it up. Which works out to be a great system for that.


    thanks for you sharing with us. Then i need do lots of about it


    This forum really needs a button to report spammers.


    The `-kernel’ flag is needed since 10.5 (??):

    MFS=$(/usr/bin/hdiutil attach -kernel -notremovable -nomount ram://2200000) &&
    /usr/sbin/diskutil erasevolume HFS+ web-ram "$MFS"

    NB: Per the hdid(8) man page, $MFS can be unmounted, but its backing RAM is wired and cannot be reclaimed “cleanly” without  reboot.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Comments are closed