NFSv4 - how to set up at FreeBSD 8.1 ?

Rick Macklem rmacklem at uoguelph.ca
Wed Jan 5 13:13:21 UTC 2011


> > You can also do the following:
> > For /etc/exports
> > V4: /
> > /usr/home -maproot=root -network 192.168.183.0 -mask 255.255.255.0
> 
> Not in my configuration - '/' and '/usr' are different partitions
> (both UFS)
> 
Hmm. Since entire volumes are exported for NFSv4, I can't remember if
exporting a subtree of the volume works (I think it does, but??).

However, I do know that if you change the /etc/exports for the above to:
(note I also moved the V4: line to the end because at one time it
 was required to be at the end and I can't remember if that restriction
 is still enforced. Always check /var/log/messages after starting mountd
 with a modified /etc/exports and look for any messages related to problems
 with /etc/exports.) In other words, export the volume's mount point and
 put the V4: line at the end are changes that "might be required?". If you
 take a look at mountd.c, you'll understand why I have trouble remembering
 exactly what works and what doesn't.:-)
/usr -maproot=root -network 192.168.183.0 -mask 255.255.255.0
V4: /

then for the above situation:
# mount -t nfs -o nfsv4 server:/ /mnt
- will fail because "/" isn't exported
however
# mount -t nfs -o nfsv4 server:/usr /mnt
- should work. If it doesn't work, it is not because /etc/exports are
  wrong.

A small number of NFSv4 ops are allowed on non-exported UFS partitions
so that "mount" can traverse the tree down to the mount point, but that
mount point must be exported. When I did this I did not realize that ZFS
did its own exporting and, as such, traveral of non-exported ZFS volumes
doesn't work, because ZFS doesn't allow any operations on the non-exported
volumes to work.

At some point, there needs to be a debate w.r.t. inconsistent behaviour.
The easiest fix is to disable the capability of traversal of non-exported
UFS volumes. The downside of this is that it is harder to configure the
single (sub)tree on the server that is needed for NFSv4.

Have fun with it, rick


More information about the freebsd-stable mailing list