From Nuclear Physics Group Documentation Pages
Revision as of 20:17, 9 June 2015 by Maurik (talk | contribs) (→‎RedHat/Centos 6 Issues)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

NFS Configuration


The /etc/exports file tells what should be exported. The syntax of this file is fairly straightforward. Each entry should contain the path to the directory you want to export followed by a list of hosts or IP address ranges that are allowed to access that export. Options are set per host or IP range in parentheses. You can use a backslash as a line continuation indicator to break up long lines. Here is an example from Taro:

/data   @servers(rw,sync) @npg_clients(rw,sync) \,no_root_squash,sync)

Entries that start with an ampersand (@) refer to NetGroups that are defined in LDAP. You can see which hosts are members of a netgroup with this command:

getent netgroup group_name

Here are some details on the more common export options:

Mounts the directory as read/write
Mounts the directory as read only
Reply to requests only after the changes have been committed to stable storage (it is a good idea to always use this to protect against lost or corrupted data due to a server crash.
Does not allow root on the local machine to have root access to files on the network share. Probably a good idea for security reasons. Set this unless you have a significantly good reason not to.


The /etc/sysconfig/nfs file is used to pin down the the ports used by NFS. This is necessary because we have to know which ports to open in the firewall to allow machines to make NFS connections. For more information see iptables.

These are the port numbers that need to be set in this file:


Set NFS to start on boot

In order to configure a successful nfs server the "nfs" and "nfslock" services need to be configured to start automatically for runlevels 3 and 5. On Red Hat and Fedora machines this can be achieved easily with these commands (as root):

chkconfig --level 35 nfs on
chkconfig --level 35 nfslock on

Useful commands

To check what ports NFS is using issue an

rpcinfo -p localhost

A full restart of the nfs related system

service portmap restart
service nfs restart
service rpcsvcgssd restart


Occasionally, issues crop up due to network-mounted home directories. Some applications, like firefox, don't behave properly. It seems to strike everyone at once when it does, and the solution so far has been to restart the nfs service. CIS has related issues with their CIFS-based home directories.

RedHat/Centos 6 Issues

On RedHat 6 it is now default to use NFS version 4, which has a problem with mapping the UID of the user between server and client. This seems to ONLY happen between 2 RH/Centos 6 systems, since if either is a 5 system, the default is to use NFS version 3.

Workaround: Mapping of IDs from [1] and [2] edit /etc/idmapd.conf and set Domain on server and client to the "localdomain"

Domain = ""
Method = nsswitch
change the /etc/default/nfs-common file (on both your server and client): set 
start idmapd service:
service rpcidmapd restart

If you are not able to make this work, i.e. limited patience, instead, force NFS3:

In add vers=3 to the list of options.