Mount Union Only at One Hierachy Level

Jason C. Wells jcw at speakeasy.net
Thu Dec 23 17:17:00 UTC 2010


'mount -o union' cannot properly overlay namespaces at more than one 
level of the hierarchy.  Another way of saying this is that 'mount -o 
union' doesn't manage namespace collisions in a unioned way.

Notice the duplicate . and .. and usr directories:

# ls -la
drwxr-xr-x   7 root  wheel   512 Dec 23 16:16 .
drwxr-xr-x   7 root  wheel   512 Dec 23 16:16 .
drwxr-xr-x   7 root  wheel   512 Dec 21 13:55 ..
drwxr-xr-x   7 root  wheel   512 Dec 21 13:55 ..
drwxr-xr-x   2 root  wheel  1024 Jul 19 02:24 bin
...
drwxr-xr-x   3 root  wheel   512 Dec 23 16:15 usr
drwxr-xr-x   3 root  wheel   512 Dec 23 16:15 usr
drwxr-xr-x  21 root  wheel   512 Dec 23 05:34 var

To achieve this I did;

# mount -t nullfs -o union,rw /usr/jail/f1 /usr/jail/f1-fs

where ./f1 contains the jail's ./usr, but without ./usr/local  and 
./f1-fs contains only ./usr/local.  I expect the namespaces to be 
unioned at /usr/jail/f1, but they were not.  Only ./usr/local is 
accessible.  ./usr/bin and friends are not accessible.

I did this because I desired ./usr to be read only, but ./usr/local to 
be read write so I could add packages inside the jail.

I know I can do this another way.  The question is, is this a bug?

Regards,
Jason C. Wells


More information about the freebsd-fs mailing list