Kodi Community Forum

Full Version: NFSv4 setup with Ubuntu 11.10
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

Been spending literally hours on this, and hoping the kind folks in here can help. I looked at several forums, including the FAQ on how to setup a NFS with XBMC to no avail.
Have been running SMB for quite awhile now with success, so overall was more interested in the performance gains given the lower overhead of NFS but never have done it prior.

To start, here is the debug log file: http://xbmclogs.com/show.php?id=34786

I have edited my etc/exports file beyond count. Here is the current state..

Code:
/export         192.168.0.*(rw,async,no_wdelay,no_root_squash,insecure,no_subtree_check,anonuid=0,anongid=0)
/export/movies  192.168.0.*(rw,async,no_wdelay,no_root_squash,insecure,no_subtree_check,anonuid=0,anongid=0)
/export/tv      192.168.0.*(rw,async,no_wdelay,no_root_squash,insecure,no_subtree_check,anonuid=0,anongid=0)

I have the no_root_squash as I saw it worked for others, but was hoping to do something a bit more secure, unless I have no choice.
Also I saw on the original ubuntu forms that I had to declare the root directory of the mounts being done for NFS.. not even sure if that's necessary... so I go back and forth commenting it out.

Also I have my media files in a home/<userdirectory>, so wondering if that's an issue with encryption... although I'm getting no errors on boot.

Anyway I'm going to turn in for the evening... but appreciate any advice in the meantime.

Regards,
-ped5

EDIT: Realized I may have picked the incorrect forum as I'm running XBMC itself on the ATV2 and not Ubuntu itself where the shared drive is stored. However my problem is setting up the NFS on the Ubuntu side, so thus why I posted here. I think I need Ubuntu expertise more than for ATV2. However if wrong, happy to have a moderator move it. Smile
Here's the sum total of my Ubuntu-based NFSv4 server + client crib notes. I get very close to Gigabit wirespeed using this config.

In my case I am sharing the /home/user/share folder...a mounted drive. Hope this helps:

server
Code:
sudo apt-get install portmap nfs-kernel-server

sudo vim /etc/default/nfs-kernel-server
NEED_SVCGSSD=no

sudo vim /etc/default/nfs-common
NEED_IDMAPD=yes
NEED_GSSD=no

make these dir + chown them for user
/exports
/exports/share

sudo vim /etc/exports
/exports 192.168.0.1(rw,fsid=0,insecure,async,no_subtree_check)
/exports/share 192.168.0.1(rw,nohide,insecure,async,no_subtree_check)

sudo vim /etc/fstab
/home/user/share /exports/share none bind 0 0

iptables -- add these three lines
-A INPUT -p udp -i eth0 -m udp --dport 111 -j ACCEPT
-A INPUT -p tcp -i eth0 -m tcp --dport 111 -j ACCEPT
-A INPUT -p tcp -i eth0 -m tcp --dport 2049 -j ACCEPT

sudo exportfs -ra
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-kernel-server restart
sudo exportfs -v

client
Code:
sudo apt-get install portmap nfs-common
sudo mount -t nfs4 nfs-server:/export/share /mnt/shr
*on xbmc had to add ‘nfs’ to /etc/modules*


Autofs solves both these issues and its very easy to use from the client side.

Code:
sudo apt-get install autofs

sudo vim /etc/auto.master
/mnt /etc/auto.nfs

sudo vim /etc/auto.nfs
share1 -fstype=nfs4 192.168.X.Y:/share1 NOTE: assuming use of NFSv4 server of course...use '-fstype=nfs' if v3 I believe.

sudo service autofs stop
sudo service autofs start

You do an 'ls /mnt/share1' and your NFS share will now show up and have full performance. That's it.
Excellent, thanks so much for sharing. I will steal with pride your notes.

Few questions, as in addition to getting this to work, would be great to understand some of the logic.

in your etc/exports.
Why are you only using 192.168.0.1 and not using wild cards or ranges?

To do chown for the export directories - which user? uid=501, which should theoretically equal that of the mobile account on an ATV2?

When I did "ID" on my Ubuntu server, got the local user ID with sudo priveleges of course. However on ATV2, there wasn't even a mobile user account listed, so therefore have no idea what XBMC is using. I'm running a tethered 4.4.2 on the ATV2.

Also another thing that I notice is new... why are you updating your iptables?

Lastly,
for the "client" side of things... do I need to do that on the ATV2? Doesn't XBMC v11 and higher have NFS by default, so there shouldn't be any command line aspects I need to configure? Or do I need to ssh into the ATV as well, and run these? And yup, looking to run NFSv4.

Thanks much for the help! Hoping I'll start to understand this one... been awhile since in the Linux world, but I'll get there. Smile
this will probably not work on IOS, since it requires the client to mount the NFS share on the operating system level.
Xbmc does support NFS natively via libnfs, but only NFSv3.
(2013-07-06, 13:34)wsnipex Wrote: [ -> ]this will probably not work on IOS, since it requires the client to mount the NFS share on the operating system level.
Xbmc does support NFS natively via libnfs, but only NFSv3.

Ok, so meaning iOS won't work if I'm using NFSv4 on my Ubuntu server?

So what do we recommend is best, should I install NFSv3 then, or look to install some packages on the ATV2 so libnfs will support NFSv4, or by definition is libnfs NFSv3 only?

Thanks, and apologies if I may have apparently posted in the wrong forum based on my setup.
use nfsv3 on the server
Ok, understood that I need to use v3.

However from all the resources I check online, cannot for the life of me find anything other than either upgrading nfsv3 to v4, how to install v4, or how v4 is superior to v3.

The only thing I can guess is it's syntax in the configuration files, but cannot find any resources for how to setup for v3
None of this helps. I can uninstall nfs-kerner-server, however seems to be the same for v4 and v3. So how do I use NFSv3 without using v4?

If you can refer to me to any documentation, would be much appreciated.
(2013-07-07, 21:56)wsnipex Wrote: [ -> ]http://wiki.xbmc.org/?title=NFS#NFS_sharing_from_Linux

Yes, I read that particular article before I came here. However wasn't specific enough or explained the nuisances between nfsv3 and v4. Anything else we know of that can help me get unstuck? Thanks.

Or if anyone knowledgable wants to pm me or post directly, no complaints either. Smile