NFSv4 - how to set up at FreeBSD 8.1 ?

Rick Macklem rmacklem at uoguelph.ca
Wed Jan 5 01:41:57 UTC 2011


> On Tue, Jan 4, 2011 at 3:42 AM, Jean-Yves Avenard
> <jyavenard at gmail.com> wrote:
> > On 4 January 2011 10:50, Rick Macklem <rmacklem at uoguelph.ca> wrote:
> > After reading this thread, I tried NFSv4 today..
> >
> > Whenever I tried to mount from a linux client, I get:
> >  mount -o vers=4 server4:/pool/backup/sites/m /mnt
> > NFS compound failed for server server4: error 7 (RPC: Authentication
> > error)
> > NFS compound failed for server server4: error 7 (RPC: Authentication
> > error)
> > NFS compound failed for server server4: error 7 (RPC: Authentication
> > error)
> > NFS compound failed for server server4: error 7 (RPC: Authentication
> > error)
> > NFS compound failed for server server4: error 7 (RPC: Authentication
> > error)
> > NFS compound failed for server server4: error 7 (RPC: Authentication
> > error)
> > nfs mount: mount: /mnt: Permission denied
> >
> > with NFS v3 it mounts just fine
> >
> > any ideas?
> 
> NFSv4 mounts are relative to the filesystem being exported. NFSv3
> mounts are absolute paths on the server.
> 
Well, they are actually relative to where the NFSv4 root is specified
in the V4: line. For ZFS, the entire server file tree from that point
down must be exported (each volume requiring at least one line in /etc/exports).
For UFS, it can traverse down to the exported volume, but only by
specifying the path to the exported volume in the mount command.
(This may someday change, since it is questionable that it should have
 different behaviour than ZFS and could be argued a security risk.)

Since there can only be one root point specified by the "V4:" line,
you can get to multiple volumes, but they must be within the subtree.
For example, if the following three directories are roots of mounted
volumes on the server:
/usr
/usr/home
/usr/sub1

and the exports file looks like:
/usr -maproot=root -network 131.104.48.0 -mask 255.255.255.0
/usr/home -maproot=root -network 131.104.48.0 -mask 255.255.255.0
/usr/sub1 -maproot=root -network 131.104.48.0 -mask 255.255.255.0
V4: /usr

Then anywhere within /usr, /usr/home and /usr/sub1 can be mounted,
but the client specifies a path relative to /usr, such as:
# mount -t nfs -o nfsv4 server:/home /home
to mount /usr/home on the client.

By using:
V4: /
you can make the client mount paths look like what would be done
for NFSv3, but if the "/" file system isn't UFS, you must export
it as well as all the others or it can't be traversed.

rick

> IOW, if you export /pool/backup/sites/m/ on the server, then the mount
> line on the client is just:
> mount -o vers=4 server4:/ /mnt
> 
> If you export / on the server, then the mount line on the client would
> be:
> mount -o vers=4 server4:/pool/backup/sites/m/ /mnt
> 
> This tripped me up when I tried converting my NFSv3 setup at home to
> NFSv4.
> 
Just trying to clarify what was good useful information, rick


More information about the freebsd-stable mailing list