Home › Forums › OS X Server and Client Discussion › Questions and Answers › Making RAM disks in 10.6 that are -notremovable
- This topic has 3 replies, 3 voices, and was last updated 14 years, 4 months ago by
slewsys.
-
AuthorPosts
-
May 14, 2012 at 8:54 am #381858
l008com
ParticipantI 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:
/usr/sbin/diskutil erasevolume HFS+ "web-ram" `/usr/bin/hdiutil attach -notremovable -nomount ram://2200000`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.
May 19, 2012 at 6:19 am #381884onejob
Participantthanks for you sharing with us. Then i need do lots of about it
May 19, 2012 at 6:21 am #381885l008com
ParticipantThis forum really needs a button to report spammers.
June 16, 2012 at 10:43 pm #382466slewsys
ParticipantThe `-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.
-
AuthorPosts
- You must be logged in to reply to this topic.