2

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?

1
  • Is this a read only disk (I.E> a CDROM) or a DMG file (Disk Image?)
    – Josh
    Oct 12, 2009 at 20:44

3 Answers 3

3

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

1
  • 1
    Glad that worked for you!
    – Josh
    Oct 26, 2009 at 20:01
2

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 macosxhints.com 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.

1
  • Thanks, and yeah, creating the ramdisk isn't that hard. The second part is a bit tougher...
    – indragie
    Oct 6, 2009 at 20:27
1

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`
3
  • 3
    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, 2011 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. Nov 11, 2011 at 14:25
  • This article explains more details on the command line way: blog.macsales.com/…
    – Vej
    Jan 19, 2020 at 12:40

You must log in to answer this question.

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