Page 1 of 1

Configure NFS Server

Posted: September 30th, 2014, 7:00 pm
by RuRat
I am trying to add lines /etc/exports
and not quite understanding what we should replace /export with

this is what i added

/export (insecure,no_subtree_check,rw,nohide,fsid=0)
/export/rurat (insecure,no_subtree_check,rw,nohide)

this is the error i have gotten

* Exporting directories for NFS kernel daemon...
exportfs: No host name given with /export (insecure,no_subtree_check,rw,nohide,fsid=0), suggest *(insecure,no_subtree_check,rw,nohide,fsid=0) to avoid warning
exportfs: No host name given with /export/rurat (insecure,no_subtree_check,rw,nohide), suggest *(insecure,no_subtree_check,rw,nohide) to avoid warning
[ OK ]
* Starting NFS kernel daemon [ OK ]

please Help

Re: Configure NFS Server

Posted: October 15th, 2014, 2:31 am
by AnaximanderThales
RuRat wrote: /export (insecure,no_subtree_check,rw,nohide,fsid=0)
/export/rurat (insecure,no_subtree_check,rw,nohide)
Well -- if I'm reading your question correctly, you need to know what to replace 'export' with. Based upon the fsid=0, you're reading NFSv4 documentation. I know Ubuntu uses v4.

You can replace 'export' with whatever you'd like. There is one other issue though.
Your /etc/exports line will be set in this way:
/dir/to/export http://www.xxx.yyy.zzz [options]

So, you have your directory to export, then you can have individual IP's or a range connect to it (secure).
As far as export being anything --
Three Scenarios:
/mnt/Music <-- Sharing with everyone but on a higher port number
/home/torrents <-- Share with everyone on standard port numbers
/home/rurat <-- only available for your desktop
/var/www <-- share with only three computers

If you want everything centrally located, you can create directories in a central location (/export) and bind the two directories. I'm not sure if this is absolutely necessary for NFSv4. I have NFSv4 installed, but nothing is bound together. I believe this is considered NFSv3 conention.
Mount Bind steps:

Code: Select all

mkdir -p /export/music /expot/torrents /export/rurat /export/www
[as root]
mount --bind /mnt/music /export/music 
mount --bind /home/torrents /export/torrents
mount --bind /mnt/rurat /export/rurat
mount --bind /var/www /export/www
Once directories are bound, you'll want to add those to fstab so you're not having to manually bind them at each reboot.
vi /etc/fstab [as root]

Code: Select all

/mnt/music           /export/music         none      bind      0         0
/home/torrents       /export/torrents      none      bind      0         0
/home/rurat          /export/rurat         none      bind      0         0
/var/www             /export/www           none      bind      0         0

Finally, your /etc/exports

Code: Select all

/export/music      192.168.1.0/24(insecure,no_subtree_check,rw,nohide,fsid=0)
/export/torrents   192.168.1.0/24(no_subtree_check,rw,nohide,fsid=0)
/export/rurat      192.168.1.100(rw,fsid=0,no_subtree_check,sync)
/export/www        192.168.1.101(rw,fsid=0,no_subtree_check,sync) 192.168.1.102(ro,fsid=0,no_subtree_check,sync) 192.168.1.140(ro,fsid=0,no_subtree_check,sync)
The options I used, I have no idea if they'll work the way you'd expect. I just pulled things for demonstration purposes. You can use this Ubuntu NFSv4 Article as a primer, and then investigate further.

And just for completeness, this is my /etc/exports. As I've said before, I believe mine is actually NFSv3 conventions even though I have NFSv4 on my server.

Code: Select all

/var/lib/mythtv/recordings    *(rw,async,no_root_squash,no_subtree_check)
/var/lib/mythtv/videos        *(rw,async,no_root_squash,no_subtree_check)
/var/lib/mythtv/music         *(rw,async,no_root_squash,no_subtree_check)
/var/lib/mythtv/pictures      *(rw,async,no_root_squash,no_subtree_check)
/mnt/tvsvr                    *(rw,async,no_root_squash,no_subtree_check)
/mnt/tvs                      *(rw,async,no_root_squash,no_subtree_check)
/mnt/transfer                 *(rw,async,no_root_squash,no_subtree_check)
/mnt/music                    *(rw,async,no_root_squash,no_subtree_check)