Failing to mount multiple NFS shares properly

OK - stick with me here, as this is a little complex. I have an NFS server which is sharing two different shares. Each share comes from a different block device /dev/sda and /dev/sdab. The NFS server is on a raspberry pi. I can succesfully mount the different shares on my linux laptop and it behaves as expected.

However, when I try to mount it on my kodi raspberry pi, I only ever get to see the one block device (/dev/sdb). I go to Videos, then add videos, then browse, then Network File System, then the ip address of teh server comes up - click on that and I’m presented with /srv/nfs4/video and /srv/nfs4/video1 - it doesn’t matter which one I click, I get the same block device. I’m guessing this problem is with OSMC as it works fine on my other linux machines.

Could it be a mismatch between the server and client version? What other things should I be looking out for? I’ve even tried mounting it via the command line

sudo mount -t nfs 192.168.1.215:/srv/nfs4/video /home/osmc/disk3

and

sudo mount -t nfs 192.168.1.215:/srv/nfs4/video1 /home/osmc/disk4  

but get the same results (i.e. the same block device in both disk3 and disk4 directories.

I think you misunderstand how NFS works. It’s not like Windows, you’re not mounting a drive. NFS will not create any more entries in your “/dev/” directory.

Don’t go looking in “/dev/” to see whether the mount has worked, use a command such as “df -h”.

For adding NFS mounts through Kodi, you won’t even see that - accessing them is handled by a user-land library.

When you say:

I’m afraid I have no idea what you’re talking about … See above - block devices, nothing to do with NFS mounts.
If you are seeing the same information on both your “/home/osmc/disc3” and “/home/osmc/disk4” mount points, if you’ve used the commands you showed in your post then what you are sharing most likely has the same information on it (E.g., are you sure you’ve not created “/srv/nfs4/video1” as, say, a symbolic link to “/srv/nfs4/video”?).

You might want to try “showmount -e 192.168.1.215” on your Linux laptop, then actually go and look at those exported paths on the RPi.

OK - I accept I didn’t word it very well - I’m not expecting different entries in any /dev as this is an interface to the hardware. What I do expect is the operating system to recognise the different contents of each hard drive and not treat each mount point as the same. I’ve been using NFS for quite a long time now (5+ years), and have never had this problem before.

I have tried doing it through the interface, and got the problem - so I thought I’d trick OSMC into seeing it the old fashioned way and mounted it on the command line - it has the same problem. I’m guessing this stops it from being a problem with kodi, but more likely to be something to do with OSMC.

I’ve done this - and the directories /home/pi/disk3 and /home/pi/disk4 are not soft linked.

[adam@hark ~]$ showmount -e 192.168.1.215
Export list for 192.168.1.215:
/srv/nfs4/video1 192.168.1.0/24
/srv/nfs4/video  192.168.1.0/24

In my case, the NFS shares are linked to different block devices. One block device is mounted from /dev/sda1 to /home/pi/disk3 and the other is from /dev/sdb1 to /home/pi/disk4 - these are then bound to /srv/nfs4/video and /srv/nfs4/video1 respectively. This is then included in /etc/exports and after running exportfs -rav.

The NFS shares behave exactly as I expect them to on the linux laptop, but not on the OSMC - it mounts the two shares with the same filesystem (/home/pi/disk3 and /home/pi/disk4 have completely different contents).

1 Like

Well yes, that’s to be expected. When we read “filesystem”, we think NTFS, EXT4, FAT32. Do you mean that the two separate mounts that contain different content, show up at the two mount points on the target pi with identical content?

1 Like

It could be helpful to see your /etc/exports and /etc/fstab from the NFS server.

As to mounting on OSMC, I’d recommend using fstab instead of Kodis nfs://. It makes troubleshooting easier, and allows you to fine-tune the NFS mount options.

1 Like

Thank you - that is much clearer. My apologies for not understanding what you were trying to explain.

As @bmillham said, it would be very useful to see the “/etc/exports” file from the server, and if you have put your mount commands in there then the “/etc/fstab” from the client (OSMC RPi).

Could you then also please run something like the following commands on the client (ignore any errors from the “umount” commands):

sudo bash
umount /home/osmc/disk3
umount /home/osmc/disk4
ls -lin /home/osmc/disk[34]
mount -t nfs 192.168.1.215:/srv/nfs4/video /home/osmc/disk3
mount -t nfs 192.168.1.215:/srv/nfs4/video1 /home/osmc/disk4
ls -lind /home/osmc/disk[34]
ls -lin /home/osmc/disk3 | head
ls -lin /home/osmc/disk4 | head
mount
exit

and share the results please? That will hopefully give a bit more information on what’s going on.

Heh! :slight_smile:

Unless things have changed recently, I believe using mounts (if you’re sufficiently Unix/Linux aware to do so, or can follow a guide :slight_smile:) is actually the recommended way at the moment. There’s a (ridiculously complicated :slight_smile:) thread on this elsewhere, but basically your “old fashioned way” is still good - not everything benefits from being updated :slight_smile:

pi@raspberrypi:/srv/nfs4/video1 $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
/dev/sda1 /home/pi/disk3 vfat defaults 0 0 
/home/pi/dpi@raspberrypi:/srv/nfs4/video1 $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
/dev/sda1 /home/pi/disk3 vfat defaults 0 0 
/home/pi/disk3 /srv/nfs4/video none bind 0 0 

/dev/sdb1 /home/pi/disk4 ntfs defaults 0 0 
/home/pi/disk4/VIDEO /srv/nfs4/video1 none bind 0isk3 /srv/nfs4/video none bind 0 0 

I tried manually mounting with:

$ history
...
146  sudo mount -t nfs 192.168.1.215:/srv/nfs4/video /home/osmc/disk3 
147  sudo mount -t nfs 192.168.1.215:/srv/nfs4/video1 /home/osmc/disk4 

disk3 and disk4 reference to a local directory that I have on the OSMC machine:
$ ls
/home/osmc/disk3
/home/osmc/disk4

Mount gives:

192.168.1.215:/srv/nfs4/video on /home/osmc/disk3 type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.215,mountvers=3,mountport=37665,mountproto=udp,local_lock=none,addr=192.168.1.215)
192.168.1.215:/srv/nfs4/video on /home/osmc/disk4 type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.215,mountvers=3,mountport=37665,mountproto=udp,local_lock=none,addr=192.168.1.215)

This isn’t how it should be. I’ve tried mounting and unmounting to make sure that I’m not missing the 1 off video1 but it still mounts the same filesystem. Very strange. I’m still open to ideas here. Thanks for the support so far.

$ script doesn’t do a great job of recording the session, so please forgive what appears to be typos etc - I can verify that I followed your commands - still getting the result from mount that /srv/nfs4/video is mounted on /home/osmc/disk3 and /home/osmc/disk4

Script started on Sat Apr 30 22:27:43 2016
root@osmc-basil:/home/osmc# rebootcat config.txt e[6@sudo nano config.txt e[6Pvim config.txt lse[Kcd bootlse[Kaaaaaaaaaaacd bootlse[Kcd bootlse[Kaaaaaaaaaaaaaa  
e[Kroot@osmc-basil:/home/osmc# umount /home/so  osmc /  /disk3 /home/osmc/disk5 4 
root@osmc-basil:/home/osmc# lsn  -lin /home/osmc  /disk3 /home/osmc/disk4  
/home/osmc/disk3: 
total 0 
 
/home/osmc/disk4: 
total 0 
root@osmc-basil:/home/osmc# mount -t nfs 192.168.1.22 15:/srv/nfs4/ci  video /home/osmc/disk3 
root@osmc-basil:/home/osmc# mount-t nfs 192.167 7 8.1.215:/srv/nfs4/video1 /home/osmc/disk4 
bash: mount-t: command not found 
root@osmc-basil:/home/osmc# ls -lind /home/osmc/disk[34] 
    2 drwxrwxrwx 27    0    0 4096 Apr 25 19:30 /home/osmc/disk3 
17238 drwxr-xr-x  2 1000 1000 4096 Apr 30 13:54 /home/osmc/disk4 
root@osmc-basil:/home/osmc# ls -lin /home/osmc/disk3 |hes ad 
total 13878800 
       38 -rwxrwxrwx 1 1001 1001 1274951680 Mar 16  2014 16GB-sd-card1.iso 
       37 -rwxrwxrwx 1 1001 1001   62914560 Mar 16  2014 16GB-sd-card5.iso 
 87556097 drwxrwxrwx 2 1001 1001       4096 Dec 15 22:15 24.Hour.Party.People.2002.720p.WEB-DL.H264-brento [PublicHD] 
  3801089 drwxrwxrwx 2 1001 1001       4096 Feb  6 19:21 A.Pigeon.Sat.on.a.Branch.Reflecting.on.Existence.2014.720p.BRRip.x264.AC3.HORiZON-ArtSubs 
106430465 drwxrwxrwx 2 1001 1001       4096 Mar 28  2014 Deliverance (1972) 
       12 -rwxrwxrwx 1 1001 1001  142284799 Feb 11  2014 Game.of.Thrones-Ice.and.Fire.A.Foreshadowing.HDTV.x264-KILLERS.mp4 
 53215233 drwxrwxrwx 2 1001 1001       4096 Apr 14  2015 Game.of.Thrones.HDTV.[Season 5 Ep 1-4]~kaugip~ 
 86245377 drwxrwxrwx 2 1001 1001       4096 Jul 14  2014 Game.of.Thrones.S04.HDTV.x264 
       13 -rwxrwxrwx 1 1001 1001  490106914 Apr 14  2014 Game.of.Thrones.S04E02.HDTV.x264-2HD.mp4 
root@osmc-basil:/home/osmc# ls -lin /home/osmc/disk3 |heade[1Pe[1@4 
total 0 
root@osmc-basil:/home/osmc# cd s disk4 
root@osmc-basil:/home/osmc/disk4# cd .. 
root@osmc-basil:/home/osmc# mount -t nfs 192.168.1.215:/srv/nfs4/video1 /home/osmc/disk4 
root@osmc-basil:/home/osmc# mount -t nfs 192.168.1.215:/srv/nfs4/video1 /home/osmc/disk4
root@osmc-basil:/home/osmc# cd ..e[Kdisk4ls -lin /home/osmc/disk4 |head3 |head4 |head 
total 13878800 
       38 -rwxrwxrwx 1 1001 1001 1274951680 Mar 16  2014 16GB-sd-card1.iso 
       37 -rwxrwxrwx 1 1001 1001   62914560 Mar 16  2014 16GB-sd-card5.iso 
 87556097 drwxrwxrwx 2 1001 1001       4096 Dec 15 22:15 24.Hour.Party.People.2002.720p.WEB-DL.H264-brento [PublicHD] 
  3801089 drwxrwxrwx 2 1001 1001       4096 Feb  6 19:21 A.Pigeon.Sat.on.a.Branch.Reflecting.on.Existence.2014.720p.BRRip.x264.AC3.HORiZON-ArtSubs 
106430465 drwxrwxrwx 2 1001 1001       4096 Mar 28  2014 Deliverance (1972) 
       12 -rwxrwxrwx 1 1001 1001  142284799 Feb 11  2014 Game.of.Thrones-Ice.and.Fire.A.Foreshadowing.HDTV.x264-KILLERS.mp4 
 53215233 drwxrwxrwx 2 1001 1001       4096 Apr 14  2015 Game.of.Thrones.HDTV.[Season 5 Ep 1-4]~kaugip~ 
 86245377 drwxrwxrwx 2 1001 1001       4096 Jul 14  2014 Game.of.Thrones.S04.HDTV.x264 
       13 -rwxrwxrwx 1 1001 1001  490106914 Apr 14  2014 Game.of.Thrones.S04E02.HDTV.x264-2HD.mp4 
root@osmc-basil:/home/osmc# ls -lin /home/osmc/disk4 |head
root@osmc-basil:/home/osmc# mount -t nfs 192.168.1.215:/srv/nfs4/video1 /home/osmc/disk4
root@osmc-basil:/home/osmc# cd ..e[Kdisk4ls -lin /home/osmc/disk4 |head3 |head 
total 13878800 
       38 -rwxrwxrwx 1 1001 1001 1274951680 Mar 16  2014 16GB-sd-card1.iso 
       37 -rwxrwxrwx 1 1001 1001   62914560 Mar 16  2014 16GB-sd-card5.iso 
 87556097 drwxrwxrwx 2 1001 1001       4096 Dec 15 22:15 24.Hour.Party.People.2002.720p.WEB-DL.H264-brento [PublicHD] 
  3801089 drwxrwxrwx 2 1001 1001       4096 Feb  6 19:21 A.Pigeon.Sat.on.a.Branch.Reflecting.on.Existence.2014.720p.BRRip.x264.AC3.HORiZON-ArtSubs 
106430465 drwxrwxrwx 2 1001 1001       4096 Mar 28  2014 Deliverance (1972) 
       12 -rwxrwxrwx 1 1001 1001  142284799 Feb 11  2014 Game.of.Thrones-Ice.and.Fire.A.Foreshadowing.HDTV.x264-KILLERS.mp4 
 53215233 drwxrwxrwx 2 1001 1001       4096 Apr 14  2015 Game.of.Thrones.HDTV.[Season 5 Ep 1-4]~kaugip~ 
 86245377 drwxrwxrwx 2 1001 1001       4096 Jul 14  2014 Game.of.Thrones.S04.HDTV.x264 
       13 -rwxrwxrwx 1 1001 1001  490106914 Apr 14  2014 Game.of.Thrones.S04E02.HDTV.x264-2HD.mp4 
root@osmc-basil:/home/osmc# mount 
devtmpfs on /dev type devtmpfs (rw,relatime,size=370536k,nr_inodes=92634,mode=755) 
proc on /proc type proc (rw,relatime) 
sysfs on /sys type sysfs (rw,relatime) 
tmpfs on /run type tmpfs (rw,relatime) 
/dev/mmcblk0p7 on / type ext4 (rw,noatime,stripe=1024,data=ordered) 
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) 
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) 
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) 
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) 
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd) 
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) 
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) 
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) 
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) 
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) 
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls) 
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct) 
debugfs on /sys/kernel/debug type debugfs (rw,relatime) 
mqueue on /dev/mqueue type mqueue (rw,relatime) 
configfs on /sys/kernel/config type configfs (rw,relatime) 
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) 
/dev/mmcblk0p6 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro) 
sysfs on /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq type sysfs (rw,relatime) 
/dev/mmcblk0p5 on /media/SETTINGS type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks) 
/dev/mmcblk0p1 on /media/RECOVERY type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0111,dmask=0000,allow_utime=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,errors=remount-ro,uhelper=udisks) 
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=75108k,mode=700,uid=1000,gid=1000) 
192.168.1.215:/srv/nfs4/video on /home/osmc/disk3 type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.215,mountvers=3,mountport=37665,mountproto=udp,local_lock=none,addr=192.168.1.215) 
192.168.1.215:/srv/nfs4/video on /home/osmc/disk4 type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.215,mountvers=3,mountport=37665,mountproto=udp,local_lock=none,addr=192.168.1.215) 
root@osmc-basil:/home/osmc# ^C 
root@osmc-basil:/home/osmc# exit 

Script done on Sat Apr 30 22:30:28 2016

/etc/fstab on the NFS server:

pi@raspberrypi:/srv/nfs4/video1 $ cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
/dev/sda1 /home/pi/disk3 vfat defaults 0 0 
/home/pi/disk3 /srv/nfs4/video none bind 0 0 

/dev/sdb1 /home/pi/disk4 ntfs defaults 0 0 
/home/pi/disk4/VIDEO /srv/nfs4/video1 none bind 0 0 

and the /etc/exports:

pi@raspberrypi:/srv/nfs4/video1 $ cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/srv/nfs4/video 192.168.1.0/24(rw,fsid=root,no_subtree_check)
/srv/nfs4/video1 192.168.1.0/24(rw,fsid=root,no_subtree_check)

I can confirm that the directories /srv/nfs4/video and /srv/nfs4/video1 are as they should be on the NFS server (i.e. they have different files on them.

This is a big problem! Then mounting, you are not guaranteed that a particular drive will be mounted as the same /dev/sdx every time. If a drive is slow to spin up, it may be mounted differently each boot. It’s recommended that you use either the UUID or the LABEL of a drive to mount it:

UUID=0782f9a6-1d7c-4d06-99bf-7912b7b6f54d /home/pi/disk3

or

LABEL= /home/pi/disk3

That way each drive is always mounted in the correct spot.

1 Like

This is another possible problem, it should be

/home/pi/disk3 /srv/nfs4/video bind bind 0 0

I agree that this could be a problem, but it isn’t for the linux laptop and the raspberry pi does mount everything as it should.

I’m guessing this is declaring the mount as a bind type filesystem? I’ve never seen that before. Again, it isn’t a problem for other systems on the network, only the OSMC pi.

I just checked the fstab man page, and it does imply that using none instead of bind is OK for the fstype.

On the problem client, try setting up fstab to create your mounts, instead of doing it via command line.

I just noticed this… /srv/nfs4/video is mounted to both drive3 and drive4.

That’s exactly the point I’m making. That is on the client and should show video1 for disk4, but it still shows video.

I’ve tried mounting with fstab, but am getting errors:

osmc@osmc-basil:~$ sudo mount -a 
mount.nfs4: mounting 192.168.1.215:/srv/nfs4/video failed, reason given by server: No such file or directory
mount.nfs4: an incorrect mount option was specified

/etc/fstab on the client:

osmc@osmc-basil:~$ sudo cat /etc/fstab
/dev/mmcblk0p6  /boot    vfat     defaults,noatime    0   0
/dev/mmcblk0p7  /    ext4      defaults,noatime    0   0

192.168.1.215:/srv/nfs4/video /home/osmc/disk3 nfs4 rsize=8192,wsize=8192,timeo=14,_netdev 0 0 
192.168.1.215:/srv/nfs4/video1 /home/osmc/disk4 nfs4 rsize=8192,wsize=8192,timeo-14,_netdev 0 0 

I’m guessing I’m working with a version that I’m not used to - I usually use Arch, which has the latest release, but I may be using something here that I’m not supposed to.

Check for typos!

You’re right - thanks for that - hang on. It’s late here.

Exactly …

When you ran the commands, the second “mount” command failed (you missed a space). So unfortunately your “video1” share didn’t get mounted, so there’s no information on what might be the second share.

What is interesting is that the output from “mount” shows “/home/osmc/disk4” mounted anyway.
So it looks as though you probably have mounts for those shares specified in your “/etc/fstab” file. Those are possibly incorrect (mounting “srv/nfs4/video” on both your mount points), so when you later try (manually) to mount “srv/nfs4/video1” onto “/home/osmc/disk4”, it won’t, because that’s already a mounted NFS file-system.

Go and check your “/etc/fstab” on your NFS client (OSMC) machine. I think you’ll find you’ve put NFS mounts in there, and that those don’t reference “srv/nfsv4/video1”.

1 Like