Access NFS directory from Windows Server

Hello!

I just got my Vero 4K+ today and I am trying to mount my Videos via NFS from Windows Server 2016 but am stumped. I haven been going through the various forum posts in NFS mounts and everyone’s problems seem to be slightly different than mine.

I am a noob coming from LibreELEC where to add my NFS folders I went to Movies ->Add Videos->Browse to my NFS Share, click on the folders and that’s it. When I try to replicate these steps on my Vero 4K+ I can click on the NFS Share up address, open the first level folder but can not move past the initial folder eg. nfs://192.168.1.28/video but I can not access folder1 in /video.

My NFS settings on windows are below and I have added the up address of my Vero 4K+ To the list of permitted users

Can anyone please help?

If the folders you are trying to share are NTFS you probably have a permissions nightmare. I suppose you would need to define authorised users on the share in addition to NFS’s authorisation by IP address.

Is there a reason to be using NFS?

I am using NFS because my file storage is on a Windows Server and this was presumably a easy setup since it works just fine with my LibreELEC system in the next room over with no changes. This this a top level folder with its own drive letter; all file permissions were set at the top most level folder.

Understood. So what is the user for the LE system and is it the same on the OSMC system? Or did you create a new user for OSMC, set the permissions for that and let it percolate down through the file tree?

You can, of course, share the same files with SMB which would be the default for a Windows server and you’ll find more ppl with that setup so more advice available.

I guess you’ve found this already:

I have Windows Server 2016 serving NFS to my Vero for testing. OSMC/Kodi will not connect with default settings using NFS version 4…it requires the minorversion in the fstab line, like:

media.nabs.net:/nfstest    /net/media/nfstest          nfs4    minorversion=1

Note that if NFS version 4 is enabled on your Windows server, and OSMC is trying to use version 4, without this setting is will not fall back to version 3…it will just fail, because version 4 is available, but is treated as if it is not permitted. An alternative is to disable version 4 entirely on the Windows server, which will result in correct fallback to version 3.

Or, you could force version 3 in fstab:

media.nabs.net:/tv     /net/media/tv               nfs     nfsvers=3

This can be done in Windows by giving a user or group permissions on the Windows file system, then edit the user/group properties to set the uidNumber or gidNumber to match the osmc user/group. This appears on the “Attribute Editor” tab of the user properties.

Since it only affects Unix-style UID/GID checks (like NFS), you can literally do this for any user with permissions, including your personal account, unless you need to do this for a lot of users and keep them in sync with your *nix systems.

There is an NFS permissions wizard on Windows, but it mucks with the security in such a way that you can’t share the content via both CIFS and NFS. Editing users to add uidNumber and gidNumber is much easier.

One last caveat is that if you share the content via both CIFS and NFS, you need to name the shares differently, as they share the same namespace on Windows.

Are you saying I need to adjust fstab AND user permissions or just fstab?

fstab first (based on the enabled version in the Windows NFS config). Without that, permissions don’t matter.

You should test by using the command line to try the mounts until you get it right. Once the mount completes, you can work on permissions.

I tried to mount NFS with your above command line but keep getting an error

“mount.nfs4: mount point /mnt/XXXX does not exist”

Do I need to create a local directory named as my mount point?

Yes, if using fstab you need to manually create the mount point directory.

Does it have to be in the mnt directory or can it be in root? It is better practice to have it in the mnt directory?

/mnt is the suggested place for the mount point. Technically it can be anywhere, but don’t place it anywhere other than /mnt without a good reason.

Ok, small steps - I have successfully mounted the NFS share but had to force nsf 3.

I can now see the top level folder but can not open the folder or go any deeper in the tree. I ran showmount -a with the server IP and can see the folder and permission is set to everyone.

Do you mean from the Kodi GUI, or from the command line? From the CL, what’s the output of:

cd /mnt/mountpoint
ls -lh

From the Kodi GUI

I can not cd into the mnt folder - Permission denied

You need to check the settings on the Windows NFS server if you are getting permission denied.

I doubt that it’s a problem, but show the contents of your /etc/fstab. And the output of:

mount

I forgot to change the permissions on the mnt folder so I can now access it.

This output from the /mnt/BenServer/ ls -lh:

osmc@osmc:/mnt/BenServer$ ls -lh
total 12K
drwx------ 2 4294967294 4294967294 4.0K Jun 12 20:07 tvshows
drwx------ 2 4294967294 4294967294 8.0K Jul  7 16:19 videos

This is the contents of my /etc/fstab:

# rootfs is not mounted in fstab as we do it via initramfs. Uncomment for remount (slower boot)
#/dev/vero-nand/root  /    ext4      defaults,noatime    0   0
10.0.0.9:/Videos   /mnt/BenServer          nfs    nfsvers=3

Finally, this is the results from mount:

devtmpfs on /dev type devtmpfs (rw,relatime,size=791072k,nr_inodes=197768,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /run type tmpfs (rw,relatime)
/dev/mapper/vero--nand-root on / type ext4 (rw,relatime,stripe=1024,data=ordered)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
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)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=183124k,mode=700,uid=1000,gid=1000)
10.0.0.9:/Videos on /mnt/BenServer type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.0.0.9,mountvers=3,mountport=2049,mountproto=udp,local_lock=none,addr=10.0.0.9)

That’s good. So you should now be able to see your directories from the Kodi GUI.

Yes I can now see the top folder and the 2 main folders below but for some reason I can not access the individual files in the folders.

In an attempt to remedy the permissions issues I ran:

sudo chmod -R 766 /mnt/BenServer

But that did nothing

You will have to change the permissions on the Windows system. I don’t have any experience with the Windows NFS server, but I assume that there are permissions settings in the server that need to be fixed.

Check from the command line if you can:

ls -l /mnt/BenServer/tvshows