mount -o union doesn't allow changes to sub directories?

Jeremy Chadwick freebsd at jdc.parodius.com
Wed Mar 23 06:38:06 UTC 2011


On Wed, Mar 23, 2011 at 05:30:00PM +1100, Lawrence Stewart wrote:
> Hi Jeremy,
> 
> On 03/23/11 17:16, Jeremy Chadwick wrote:
> > On Wed, Mar 23, 2011 at 04:48:21PM +1100, Lawrence Stewart wrote:
> >> Hi again,
> >>
> >> If I run something like:
> >>
> >> mount -o union /dev/md0 /etc
> >>
> >> where md0 is a memory backed fs device, and /etc is fully populated but
> >> mounted RO off a CD, I can touch a new file in /etc, but can't in any
> >> subdir of etc (fails with "Read-only filesystem" reported).
> >>
> >> As far as I can tell this is a bug, but wanted to check if I'm
> >> misunderstanding how the "-o union" mount option is supposed to work.
> > 
> > Please see mount_unionfs(8), specifically the explanations of "lower"
> > and "upper" layers, along with EROFS (errno 30, "Read-only filesystem").
> 
> I don't think 'mount -o union' is the same thing as doing a unionfs
> mount. Earlier today I was playing with unionfs and it worked perfectly
> for the scenario I describe above. 'mount -o union' seems to do
> something similar, but subtly different to unionfs.
> 
> The key difference from the UI perspective is that unionfs can be used
> to mount a directory on top of another directory, whereas using 'mount
> -o union' requires you to mount a device with an fs on it on top of a
> directory.
> 
> The semantics of 'mount -o union' are far more useful for my situation
> that unionfs, so I'm keen to try and see if I can get it working
> properly, which I suspect will involve a kernel patch.

You're right -- MNT_UNION (which is what -o mount makes use of) is
different than UNIONFS.  How this plays with the kernel is unknown to me
(I've skimmed the code, it's over my head since it's VFS).

-- 
| Jeremy Chadwick                                   jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.               PGP 4BD6C0CB |



More information about the freebsd-fs mailing list