4

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?

7ochem
  • 280
  • 1
  • 3
  • 12
Andy Song
  • 47
  • 5

1 Answers1

3

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.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • Sorry that's NFSv3 way of doing it. BTW, I have another dir which is under /exports and not a symbolic link works as expected. So I'm fairly sure it's about the the symbolic link. – Andy Song Apr 30 '13 at 07:53
  • @AndySong: See my edit, maybe this helps. – Sven Apr 30 '13 at 08:08
  • Thanks for that. I'm sure that works. Only that when I do 'df' it'll show a bunch of mounts that I don't want to see otherwise. A little annoying. – Andy Song Apr 30 '13 at 09:14