Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I create a RAMDisk on OS X for a read-only filesystem, so that any attempted writes to the drive (which is read-only) are directed to the RAMDisk instead?

share|improve this question
Is this a read only disk (I.E> a CDROM) or a DMG file (Disk Image?) – Josh Oct 12 '09 at 20:44
up vote 3 down vote accepted

You may want a UnionFS mount...

I'm not sure exactly how you'd do this, most likely you'd create a RAM disk, put a DMG file on that, and then mount the DMG with hdiutil attach -union / file.dmg

share|improve this answer
Thanks, exactly what I needed – indragie Oct 25 '09 at 17:10
Glad that worked for you! – Josh Oct 26 '09 at 20:01

There are quite a few articles that explain how you can create a RAM disk:

  • you can create a RAM disk using the Make RAM Disk utility,
  • this article over on gives instructions on how you can create a RAM disk larger than 2.2 GB

The part about the redirection is a bit trickier, I'm not sure how you can do it.

share|improve this answer
Thanks, and yeah, creating the ramdisk isn't that hard. The second part is a bit tougher... – indragie Oct 6 '09 at 20:27

This line is a keeper... it may not be exactly what the OP was looking for, but it will surely make someone happy. And there's a lot you can learn for it too.

diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://1165430000`
share|improve this answer
I suggest you explain what it does, in detail, if it may not be exactly what the OP was looking for. – Daniel Beck Nov 4 '11 at 16:40
It's an answer to the first part of the OP's question, "How would I create a RAMDisk on OS X ..." It will create and format a HFS+ ramdisk, then mount it as /Volumes/ramdisk. The big number at the end changes the size of the ramdisk. It's in sectors or something I can never remember. – Orwellophile Nov 11 '11 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .