1

I'm sharing a folder with NFS that contains other fstab mounted drives, and client side nfs fails to traverse only the deepest mount.

ie: /home/user/pictures Is a regular directory, which contains /camera1

/home/user/pictures/camera1 is a GPT formatted 3TiB drive and mounted normally as ext4 in the server /etc/fstab

It's possibly a conflict that it's currently shared with samba, but seems to coexist , and that works fine on server and client.

But after I mount it with NFS I have an unusual problem viewing /camera1: it's as if it isn't mounted at all. Instead it shows the server's pre-mount empty directory when viewed from the NFS connected client.

I found that --rmount (note the leading 'r') - as distinct from the --mount that is suggested in all the examples - makes the server NFS exports directory (/mnt/nfs/...) properly traverse all the way through to /camera1. But the client side still does not mount /camera1 - it mounts /~pictures ok, but /camera1 is seen as the empty folder: as if /camera1 were unmounted on the server.

For demonstration purposes there is an UNMOUNTED.txt in the server directory: ~/pictures/camera1/ prior to mounting anything. So when I mount the drive, the UNMOUNTED.txt is replaced by a correct directory listing of the camera1 drive.. on the server. As intended.

**But* on the client I still see .../camera1/UNMOUNTED.txt

Note:

/ - is one drive

/home - is a second drive

/home/user/pictures - is a folder on the /home drive

/home/user/pictures/camera1 - is a third drive

All work as expected as regular ext4 fstab mounts on the server, and only the 'camera1' mount is a problem when remotely viewed via NFS.

I'll run through my setup just in case that's where I'm going wrong.

SERVER (Kubuntu 14.10)

nobody and nogroup exist, so..

# mkdir -p /mnt/nfs/pictures
# chown -R nobody:nogroup /mnt/nfs
# chmod 777 /mnt
# chmod 777 /mnt/nfs
# chmod 777 /mnt/nfs/pictures

ok

# mount --bind /home/user/pictures /mnt/nfs/pictures

mounts /mnt/nfs/pictures, but /mnt/nfs/pictures/camera1 is empty. This is the crux of the problem.

# mount --rbind /home/user/pictures /mnt/nfs/pictures

(rbind this time) works as expected and /mnt/nfs/pictures/camera1 is populated

so then..

/etc/idmapd.conf already had the correct mappings and I confirmed identical everything both machines.

I edited /etc/exports:

/mnt/nfs/ <SERVER-IP>(rw,fsid=root,no_subtree_check)

/mnt/nfs/pictures <SERVER-IP>(rw,no_subtree_check,sync,no_root_squash)

ok

sudo exportfs -rav

ok

sudo service nfs-kernel-server restart

also ok.

So then on the..

CLIENT (Kubuntu 16.04)

(Using SSH, but physically accessing it has same results)

$ showmount -e <SERVER-IP>
Export list for <SERVER-IP>:
/mnt/nfs/pictures    <SERVER-IP>
/mnt/nfs    <SERVER-IP>

correctly displays the share

then

$ ls -al /home/user/pictures
total 8
drwxr-xr-x  2 user user 4096 Aug 23 23:47 .
drwxr-xr-x 36 user user 4096 Aug 23 23:49 ..

confirms the directory exists and is empty, so I mount the share:

# mount -t nfs <SERVER-IP>:/pictures /home/user/pictures
or 
# mount -t nfs <SERVER-IP>:/mnt/nfs/pictures /home/user/pictures
....same diff

ok

...but...

$ ls -al ~/pictures/camera1
total 16
drwxrwxr-x 2 user user 4096 Nov 12  2015 .
drwxrwxrwx 6 user user 4096 Aug 24 12:31 ..
-rw-rw-r-- 1 user user   21 Nov 12  2015 UNMOUNTED.txt
-rwxr-xr-x 1 user user  213 Nov 12  2015 .directory

Of course it should be fully populated by the contents of the otherwise mounted and functional 'camera1' drive mount.

Becasue --rbind helps server-side I was trying to leverage it client-side, but

# mount --rbind -t nfs <SERVER-IP>:/pictures /home/user/pictures

Just fails, telling me my syntax is wrong... despite listing --rbind as valid in the help/man.

Help?

  • You should have a look at the exports options crossmnt and nohide. – Thomas Aug 24 '16 at 9:57
  • Thanks, that seems to have moved me forward one step. However now the group ownership is still locking me out. It's being mapped to group 'user', when it should be group 'users' – Betlog Aug 24 '16 at 13:07
  • Now I'm confused. Server side everything is owned by group 'user', but client side everything i have nfs mounted is owned by group: 'users', except the bit I was having problems with before (camera1), which is group 'user'. The 'users' group is empty on client and server, and GID 100. The group I would expect it to map to is the one my login is in: 'user' GID 1000.. Not what I would expect it to do at all. It's still effectively locking me out, but I can see that it seems closer to working. – Betlog Aug 24 '16 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.