What does "mount -o union" and MNT_UNION really do?
Tobias Roth
ports at fsck.ch
Fri Feb 23 16:52:15 UTC 2007
On Thu, February 22, 2007 11:23 pm, Craig Rodrigues wrote:
> Is there a legitimate case where you would
> want to do "mount -o union", and have it behave differently
> from "mount_unionfs / mount -t unionfs"? Or is this a leftover from
> a long time ago that we can now whack (it would simplify some code
> in the VFS layer if we whack it)?
Up to recently, mount -o union just worked, while unionfs was documented
to be mostly broken. Profile.sh for instance uses -o union, and I never
had any problems with it. I am using it exclusively in read only mode
though.
One difference that I can remember offhand is explained here (taken from
mount_unionfs(8):
Filenames are looked up in the upper layer and then in the lower layer.
if a directory is found in the lower layer, and there is no entry in the
upper layer, then a shadow directory will be created in the upper layer.
It will be owned by the user who originally did the union mount, with
mode ``rwxrwxrwx'' (0777) modified by the umask in effect at that time.
This is not the case with -o union. Given the above statement, I am not
sure whether unionfs will work if used in conjunction with read only mode.
Mount_unionfs(8) talks about another difference, although I don't know
whether this is meaningful in the current context:
The union file system manipulates the namespace, rather than individual
file systems. The union operation applies recursively down the directory
tree now rooted at uniondir. Thus any file systems which are mounted
under uniondir will take part in the union operation. This differs from
the union option to mount(8) which only applies the union operation to
the mount point itself, and then only for lookups.
Thanks,
Tobias
More information about the freebsd-fs
mailing list