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
/ - 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
# 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
/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)
sudo exportfs -rav
sudo service nfs-kernel-server restart
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
$ 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
$ 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.