1

Is it possible on Mac OS X to mount a /dev disk device readonly with a shadowfile, so the filesystem still operates readwrite?

I know how to do it for a disk image file, with hdiutil, but the same options don't appear to be available for block devices.

kasperd
  • 30,455
  • 17
  • 76
  • 124
iluvcapra
  • 63
  • 7
  • I have no Mac OS machine nearby to test, but you should be able to mount either a temporary (RAM-backed) filesystem or a standard filesystem from a loop device and then use an union mount to put it on top of the read-only partition. That way you can see all files from the r-o partition but any writes will be done on the new, read-write filesystem. – André Borie Jun 08 '16 at 10:24

2 Answers2

2

It is possible... sort of. This is a high-level overview.

  1. Mount the specific filesystem that you want to access as a ready only mount. You need to use the "-o union" option (more on this later).
  2. Next you will need either another read-write device, or you will need something like bindFS to map a scratch folder. http://bindfs.org/
  3. With the second mount point, make sure to mount this at the same location and make sure this read/write and use the "-o union" option again.

the union option allows multiple filesystems to be stacked together, it prefers the top-most mount point and keeps going down to lower filesystems. Here is an article I followed while experimenting with this feature on my own http://aplawrence.com/foo-mac/union-mounts.html

Now for the major problems with this answer. One issue is that you cannot actually modify or delete a file and have that change on the top-most layer, that only makes new, differently named files feasible. The other big issue is that you cannot see the bottom layer in finder! So it's a command-line only solution. Maybe somebody has a more clever way around these issues.

Dylan
  • 156
  • 4
0

again with comment thing - not being able to put comments due to 50 points is killing me. But to give you short answer. It's not possible. if you set it up only to read then you can't expand/add/create from this device. Since it's still operating on "file level" then it cannot allocate any space on it, therefore it can't be treated as FS in any matter.

Michal
  • 434
  • 3
  • 7