This tutorial is to help those who’d like to use NFS (Network File System - mostly used with Linux/Unix systems). It assumes that you already are sharing media files favourably on a NAS system that supports NFS shares (for how to setup NFS sharing e.g. on your NAS system, look for instructions by your system’s vendor).
Why use /etc/fstab
instead of Kodi’s built in NFS client? Using /etc/fstab
is faster than Kodi’s own NFS client - it delivers better throughput and is more reliable (also than SMB mounting). Many performance issues, especially with high-bitrate content can be solved by using NFS shares and /etc/fstab
. Additionally, it’s quite easy to set up.
Preparation:
You will need to know the following information
- The IP address of the system where your media files are shared from.
- For this tutorial, we will be using 192.168.1.2
- The directory used by the NFS share on your media sharing device (e.g. NAS).
-
We will be using /nfs (which is probably the standard path on many NAS).
-
please use the following command to find the correct export path for your NAS (if it’s NOT /nfs):
showmount -e IP_of_your_NAS
- What you would like the share to be named on OSMC?
- We will be using Server_Movies.
- You may use any name here you’d like.
- Does the share name contain spaces?
- Replace spaces with \040. So My Movies would be My\040Movies.
Once you know that information, log into your OSMC system via SSH: Accessing the command line - General - OSMC
Edit your /etc/fstab
file:
sudo nano /etc/fstab
Go to the end of the file (use the down arrow key) and add this line:
192.168.1.2:/nfs /mnt/Server_Movies nfs noauto,x-systemd.automount 0 0
An example with spaces:
192.168.1.2:/nfs /mnt/TV\040Shows nfs noauto,x-systemd.automount 0 0
Once done editing /etc/fstab
, save the file and exit nano /etc/fstab
with CTRL+X
and Y
for “yes”.
Now verify that there are no errors in your fstab file:
sudo mount -a
You should just get a new prompt back. If you get any errors, look again at your /etc/fstab
for any mistakes.
Once you get a prompt with no errors, you will need to reload systemd:
sudo systemctl daemon-reload
sudo systemctl restart remote-fs.target
At this point, your shares should just work. To test, simply try to go to the share:
cd /mnt/Server_Movies
ls
Or if you used the TV Shows example (TV\040Shows):
cd /mnt/TV\ Shows
ls
Notice the difference! In the fstab file, you use \040
for a space. On the command line, you just use a \
followed by a space.
and if all is well, you will see your files!
If you do not see your files, try this:
sudo mount /mnt/Server_Movies
Or if you used the TV Shows example (TV\040Shows):
sudo mount /mnt/TV\ Shows
If you see errors, post your logs on the forum:
grab-logs -f -J
If everything is fine, you can add the NFS mount as a media source to Kodi. The path were the NFS mounts are found will always be this one:
/mnt/
When you follow this guide - especially the noauto,x-systemd.automount 0 0
part of the line that you add to /etc/fstab
- the mount should be present before any library updating begins after a startup or in other words: as soon as the share is accessed. Keep this line as simple as possible! If no errors occur, don’t add any other commands!
Be aware: NFS mounting under FSTAB does not allow for a username and password to be set. The NFS share has to be configure e.g. on your NAS system so that it can be accessed via the path IP_of_your_NAS:/nfs
(which we used as an example here, the /nfs
part may be different for you) without any other configuration (than the one explained above) needed on the OSMC device. Make sure to configure your NAS or other media sharing device accordingly.
A hint to gather the information mentioned under “2.” in more words: Type in the command showmount -e IP_of_your_NAS
into the command line of your OSMC device (via SSH). The output should show you the mount directories that your NAS offers. Choose the correct path that you’d like to mount via NFS FSTAB on your OSMC device and use that for the setup process above (the path would then replace /nfs
under “2.”).