Installation guide

Chapter 17. Network File System (NFS) 249
100005 3 tcp 1106 mountd
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100021 1 udp 1028 nlockmgr
100021 3 udp 1028 nlockmgr
100021 4 udp 1028 nlockmgr
The -p option probes the portmapper on the specified host or defaults to localhost if no specific host
is listed. Other options are available from the rpcinfo man page.
From the output above, various NFS services can be seen running. If one of the NFS services does
not start up correctly, portmap will be unable to map RPC requests from clients for that service to
the correct port. In many cases, restarting NFS as root (/sbin/service nfs restart) will cause
those service to correctly register with portmap and begin working.
17.2. NFS Server Configuration Files
Configuring a system to share files and directories using NFS is straightforward. Every file system
being exported to remote users via NFS, as well as the access rights relating to those file systems, is
located in the /etc/exports file. This file is read by the exportfs command to give rpc.mountd
and rpc.nfsd the information necessary to allow the remote mounting of a file system by an autho-
rized host.
The exportfs command allows you to selectively export or unexport directories without restarting
the various NFS services. When exportfs is passed the proper options, the file systems to be ex-
ported are written to /var/lib/nfs/xtab. Since rpc.mountd refers to the xtab file when deciding
access privileges to a file system, changes to the list of exported file systems take effect immediately.
Various options are available when using exportfs:
-r Causes all directories listed in /etc/exports to be exported by constructing a new export
list in /etc/lib/nfs/xtab. This option effectively refreshes the export list with any changes that
have been made to /etc/exports.
-a Causes all directories to be exported or unexported, depending on the other options passed
to exportfs.
-o options Allows the user to specify directories to be exported that are not listed in
/etc/exports. These additional file system shares must be written in the same way they are
specified in /etc/exports. This option is used to test an exported file system before adding it
permanently to the list of file systems to be exported.
-i Tells exportfs to ignore /etc/exports; only options given from the command line are
used to define exported file systems.
-u Unexports directories from being mounted by remote users. The command exportfs -ua
effectively suspends NFS file sharing while keeping the various NFS daemons up. To allow NFS
sharing to continue, type exportfs -r.
-v Verbose operation, where the file systems being exported or unexported are displayed in
greater detail when the exportfs command is executed.
If no options are passed to the exportfs command, it displays a list of currently exported file systems.
Changes to /etc/exports can also be read by reloading the NFS service with the service nfs
reload command. This keeps the NFS daemons running while re-exporting the /etc/exports file.