Page 1 of 1

NFS Setup

PostPosted: May 5th, '12, 18:49
by magick_crow
I have a 2 computers in my home with a router. I want to have the 2 computers share directories using NFS but everything I try ends up not working. How do I do it properly? Do I need to set up a static LAN ip? How? The other computer is a Kubuntu one and it was working when this server was also a Kubuntu but I have upgrade to Mageia and can't get it to work. Can't wait to here the proper way to do it! Thanks.

Re: NFS Setup

PostPosted: May 6th, '12, 18:27
by djennings
First of all turn off your firewall. You can always turn it back on later

Second put an entry for the other computer in your /etc/hosts table
Code: Select all
xxx.xxx.xxx.xxx          remote_host_name

Third In mageiaControlCentre>NetworkSharing>AccessNFS scan for remote shares. scanning can take a while
After finding remote shares highlight the one you want to connect to and pick a mount point. A mount point under /mnt is traditional.
Select Options and under advanced various add the option soft (I forget why, but I always do)

Now you should be able to press 'Mount' to mount the option. If you do not have /etc/hosts set up correctly this will fail.

When sharing NFS folders in Mageia Control Centre use the option 'secured connection = off'

If you want to do the set up purely on the command line.
My server has in /etc/exports
Code: Select all
/home/derek/Pictures 192.168.1.0/24(root_squash,anonuid=65534,anongid=65534,async,insecure,no_subtree_check,rw)

to export the shares give the command
Code: Select all
exportfs -ra


My client has this line in /etc/fstab
Code: Select all
zero:/home/derek/Pictures /home/derek/Pictures nfs rsize=8192,wsize=8192,nosuid,soft 0 0
where zero is the host name of the server.
On boot the client automatically connects to the server.

Re: NFS Setup

PostPosted: May 11th, '12, 17:13
by wilcal
djennings wrote:My client has this line in /etc/fstab
Code: Select all
zero:/home/derek/Pictures /home/derek/Pictures nfs rsize=8192,wsize=8192,nosuid,soft 0 0
where zero is the host name of the server.
On boot the client automatically connects to the server.

NFS connections have been somewhat tricky with Mandrake/Mandriva/Mageia.
A number of times over the years we've run into problems. All, as in ALL,
of my experience has been where the NFS server is the same OS
as the NFS client so I can't tell you how a Ubuntu NFS server
will work with a Mageia client.

Do go through the process outlined by djennings above. That may be
successful. But, on occasion it may not. Open all the clients ports
as in turn off the firewall. Also the "zero" outlined in djennings
explanation may not work all the time. What I do is open a terminal,
log in as admin with a "su -", then launch kwrite in admin mode.
Open /etc/fstab and edit the the NFS command to reflect the IP
of the NFS server not the servers name. As follows:

192.168.1.5:/home/derek/Pictures /home/derek/Pictures nfs rsize=8192,wsize=8192,nosuid,soft 0 0

I find this change to work universally. The Mageia 1/2 NFS Server/Client
process presently works just fine. I have a local Mageia 1 server
and my Cauldron/Mageia 2 NFS tests are working just fine as of today.

Re: NFS Setup

PostPosted: May 12th, '12, 00:11
by djennings
Also the "zero" outlined in djennings
explanation may not work all the time.


When editing fstab by hand then yes, using the IP address is preferable. However the NFS GUI in MCC **always** writes the fstab file using the host name. My example fstab was written by the GUI. It is the GUI insisting on using the host name that causes so many problems with the MCC NFS GUI.

When the GUI does a search for NFS servers it learns the host name and IP addresses of the servers, and then writes the host name into the fstab file and discards the IP address.
When you then ask the GUI to mount the NFS share it tries to use the hostname to identify the share so causing a DNS lookup which of course will fail in most cases. That is why I emphasised the need to put the server host name in /etc/hosts so DNS can find it and then the GUI works.

It is a pity that the GUI does not try doing a lookup with avahi. Then we could use dynamic IP addresses with NFS.

Re: NFS Setup

PostPosted: May 14th, '12, 19:41
by doktor5000
djennings wrote:It is a pity that the GUI does not try doing a lookup with avahi. Then we could use dynamic IP addresses with NFS.

You should be able to easily adjust this via the hosts key in /etc/nsswitch.conf ...

Re: NFS Setup

PostPosted: May 15th, '12, 10:34
by djennings
doktor5000 wrote:
djennings wrote:It is a pity that the GUI does not try doing a lookup with avahi. Then we could use dynamic IP addresses with NFS.

You should be able to easily adjust this via the hosts key in /etc/nsswitch.conf ...


The resolver already does use avahi. But avahi only resolves names with the domain name .local and diskdrake asks for a lookup without specifying a domain name.
As it happens since writing the last comment I have submitted a patch that does lookups with a .local domain name. See https://bugs.mageia.org/show_bug.cgi?id=207#c36