NFSv4 Symbolic link under virtual root

My intention:

  1. use /exports as my virtual root of NFSv4
  2. export dir /my/dir through NFS

So I created a symlink under /exports like this

# ln -s /my/dir /exports/dir

and my /etc/exports looks like:

/exports *(async,rw,fsid=0,no_root_squash,insecure,no_subtree_check,crossmnt)

When I mount from client using:

# mount -t nfs4 192.168.1.52:/dir /mnt

I got following error message:

mount.nfs4: mounting 192.168.1.52:/dir failed, reason given by server:
    No such file or directory

According to this it should work. Any idea?


You need to mount

 mount -t nfs4 192.168.1.52:/export/dir /mnt

Edit: Strike that - it's my daily NFSv3 practice shining through (and missing the crucial v4 part in the question).

Try to remove the link and bind the dir instead:

mkdir /exports/dir
mount --bind /my/dir /exports/dir

and if it works, add the mount to /etc/fstab.

 /my/dir  /exports/dir   none    bind  0  0

Restart NFS server

If this still fails, try to make /exports/dir an explicit line it /etc/exports.