So; as I’ve posted before; NFS has been a complete pain to set up, contrary to all the guides and forums posts I could find about it (mostly people referencing other people’s setups).

Now, after hours of work and research on it, it works, and I’m pretty sure I understand why.

The long version

(Thanks to, and helpful people in ubuntuforums)

I’m going to run through, setting up one share for “Movies”, and one for “TV_Shows”. My setup is more complex, and based on content ratings, but it all works the same.

  • SSH in to the server, or open terminal if you are sitting at it
  • $ sudo apt-get install nfs-kernel-server

The guide says “NFSv4 exports exist in a single pseudo filesystem, where the real directories are mounted with the –bind option”; grappling with this threw me off initially, but basically if you follow the guide to the letter, being thrown off won’t hurt you like it did me.

  • $ sudo mkdir /export
  • $ sudo mkdir /export/Movies
  • $ sudo mkdir /export/TV_Shows
  • $ sudo chmod -R 777 /export #opens permissions before we bind the real folders
  • $ sudo nano /etc/default/nfs-kernel-server
    • Verify that NEED_SVCGSSD=no
  • $ sudo nano /etc/default/nfs-common
    • To the bottom of the file, add
    • Save (ctrl-x > yes)
  • $ sudo /etc/init.d/nfs-kernel-server restart

Now, we’re ready to set up the exports

You should at this point know:

  • What IP scheme is used inside your network (you can also be willing to go ultra-insecure instead)
  • The locations of your media folders so we can bind them

Now, here’s a pitfall:

SettingUpNFSHowTo states that /etc/exports should specify an “fsid-0” or “root” share.

For NFS4; THIS IS NOT CORRECT. NFS4 does this automatically

As per them:


This caused a lot of confusion: in the later steps, folders would not be listed at all, or would be empty, permissions were odd, and it Just Didn’t Work™

So, moving on…

    • $ sudo nano /etc/exports
      #/media/ *(rw,sync,no_root_squash)

Instead of “”, you can put “” (or whatever your ip range is), or you can also put “*” to allow any connections.
XBMC Requires “all_squash,insecure”.

And now, the NFS config part of the server is done

To set the settings, do:

$ sudo /etc/init.d/nfs-kernel-server restart

(Note: you can safely ignore any messages about setting defaults, since it’s just telling you it’s doing this for you)

Bind mounts, AKA: Why did no one tell me about these before??

Bind mounts are basically file links for servers.. Many times, when accessing files over samba, cifs, and afp, I wished I could ‘fake-relocate’ folders; tried different combinations of “ln” switches, but nothing worked consistently.

Bind mounts work.

To do a one-time mount (good for testing), run “mount –bind /from /media/to”.
For our example: “sudo mount –bind /media/Shared/Video/Movies /export/Movies”

Once you verify that this works (“ls /export/Movies”), you can unmount it (“sudo umount /export/Movies”), then move on to making it permanent.

Modify /etc/fstab

  • sudo nano /etc/fstab
    #NFS Exports
    #/home/jim/Music /export/videos/Music none bind 0 0 #simple example
    /media/Shared/Video/Movies /export/Movies nobootwait bind 0 0
    /media/Shared/Video/TV_Shows /export/TV_Shows nobootwait bind 0 0

    “nobootwait” is good to throw in there, especially for a headless server: when omitting, it stalled my next reboot, waiting for me to confirm whether or not to proceed (I made a typo)
    “bind” is the filetype, according to fstab

  • Save (ctrl-o, ctrl-x)
  • Now mount the folders (you did unmount them before, yes?)
    $ sudo mount /export/Movies
    $ sudo mount /export/TV_Shows
  • Verify that they work (“ls /export/Movies”, etc)

And; We’re done all the server work!

XBMC: We’re almost 100% complete!

You have two options here: modify the sources.xml file, or do it through XBMC itself.

To modify the sources.xml, find it first. Since we’re on a Raspberry Pi with Raspbmc, it’s located in /home/pi/.xbmc/userdata/.
I’m not going through details, but here’s an example:

<path pathversion="1">nfs://</path>

Through the GUI

  • Navigate to Videos > Files > Add Videos… > Browse > Network Filesystem (NFS)
  • Your server should be listed, and the shares listed inside it; add them from here as you would any other folder
    If it is not listed, you can “add network location” and type everything in manually

Test it all out!

On my Raspberry Pi with Raspbmc, browsing the same folder through NFS instead of SFTP cuts it from ~5 seconds to ~3. (SMB lists it in ~7)
Playing files also feels about twice as fast!

(Just a lottle) bit of a pain in the ass, but promising results!
I’m switching all sources to NFS now, and testing it for the week.