Fstab nfs mount not working

So I dug around quite hard to find the right way to set up an fstab nfs mount and ended up using this in my fstab file,    /home/osmc/mnt/diskstation/video    nfs    ro,rsize=8192,wsize=8192,udp,noatime,intr,x-systemd.automount,noauto    0    0

Rebooted the Pi and tried to access the folder in ssh to test it and got this in return,

ls: cannot open directory mnt/diskstation/video: No such device

The folder /home/osmc/mnt/diskstation/video can simply not be opened at all, so clearly something was attempted, no idea why it failed though.

Some silly questions:

  • did you create the directory before trying to do the mount?
  • what does the mount give as output?
  • what do you get as a result of mount -a

I did create the directory before trying to mount.

mount gives the following,

osmc@osmc:~$ mount
/dev/mmcblk0p2 on / type ext4 (rw,noatime,stripe=1024,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=371420k,nr_inodes=92855,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
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 type tmpfs (rw,nosuid,nodev,mode=755)
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/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 /home/osmc/mnt/diskstation/video type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
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)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mmcblk0p1 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/cpu0/cpufreq/scaling_cur_freq type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=75148k,mode=700,uid=1000,gid=1000)

And (sudo) mount -a gives absolutely no feedback at all.

I don’t know how to interpret these entries from mount - obviously something is happening. Further, I’m not familiar with that style of fstab entry - what will the noauto do?

No idea what the binfmt thing is, not my work.

See this post for why I’m using noauto, OSMC Alpha 1 is here! - #63 by DBMandrake

I’d quote it but can’t figure out how.

The following is for Ubuntu but may work in this case :


Also I have seen it time and time again on this forum mentioned that mounting via fstab locally is not advised. It is recommended to use the browse function and search for the NFS share. I use the browse method for OSMC RPi2 and I have never had an issue. Simply set up your permissions correctly on the NFS server and away you go !

That’s weird because I’ve seen the exact opposite mentioned in multiple places on this forum. Supposedly it performs better.

Some say Toomatoooee and some say Tomat-toe :smile:

I have read in the past that performance is better as you are mounting an NFS share like a local disk but unless the verdict has changed since I last looked into it, I remember seeing Sam Nazarko suggest using the browse function ?!

Eitherway I stream up to 5gig DTS/AC3 5.1 1080p movie files across 500MB power over ethernet plug adapters using Cat6 without issue using the browse function from an Xpenology VM NFS server, running on my server.

The best way is to test I suppose and figure out what is best for you ? But I personally like the flexibility of the browse function and only use fstab on Ubuntu server VMs that I have, for the likes of running Calibre etc. Remember that the OSMC is meant for the TV so not having to jump into the command line every two minutes is a great thing in my opinion.

I’m currently using the browse method and it works just fine. I wanted to add a local mount because I may want to access things on it that aren’t media and wouldn’t be related to Kodi at all.

This is a working fstab line to mount an nfs share. /mnt/Main nfs hard,sync,intr,rw,x-systemd.automount,noauto

You may want to do a showmount -e to give you the first part of the line that will work for you.

Something is already using /home/osmc/mnt/diskstation/video on your system it seems. Make a new directory somewhere and use that for the second part. After you’ve added the line to fstab, try sudo mount -a without rebooting to test it. Let us know if you get any error messages.

I can’t imagine what could be using the directory, I made the entire mnt/ +subdirs specifically for this mount.

Doing showmount -e returns,

osmc@osmc:~$ showmount -e
Export list for
/volume1/video *

I’ll give your fstab entry a go, the only thing I can imagine would cause a problem is the fact I specified read only, which I guess doesn’t matter since there are no write rights on the server anyway. Hard is default and I know async works for pretty much everyone since it’s default and I’ve seen it specifically listed in multiple example entries.

Tried your entry, sudo mount -a gives no response and the folder gives no error when trying to view it but doesn’t show what it should either. The showmount command is the same.

In the process of trying to get this to work, something seems to have taken up residency there judging from your last mount output.

Step 1, unmount anything that’s mounted there already:
sudo umount /home/osmc/mnt/*

Step 2, edit your fstab file with a line to mount your nfs share there. Be sure to take out (or comment out) anything else in fstab that’s trying to mount there. /home/osmc/mnt/diskstation/video nfs hard,sync,intr,rw,x-systemd.automount,noauto

Step 3: without rebooting, try doing

sudo mount -a

Step 4: see if anything got mounted there by doing

ls -al /home/osmc/mnt/diskstation/video



If it didn’t work, start over from step 1 so you can start from a clean slate.

umount worked so the folder became accessible again. I copied exactly your fstab line and ran a sudo mount -a with no feedback. Trying to ls -la the folder only lists . and … and there is no mention of the server I’m trying to mount in the output from mount at all.

Mount -a will do nothing if you use noauto in fstab, so you can’t use that as a method of testing. You need to reboot.

Also I would not recommend the “hard” mount option in fstab - if your NFS server goes down your entire system will hang until it returns. I would use a “soft” mount for media mounts.

Hard is designed for things like mounting your entire root file system over NFS.

Changed my original line to add soft and rebooted. Still the same error, not that I expected it to change.

Found the problem, the udp flag is apparently invalid, taking it out mounts properly.

EDIT: Works if I specify nfsvers=3, I guess it was defaulting to 4 and udp is messed up on 4?