The configuration files for the NFS export service are
/etc/exports
and
/etc/sysconfig/nfs
. In addition to these files,
/etc/idmapd.conf
is needed for the NFSv4 server
configuration. To start or restart the services, run the commands
rcnfsserver restart. This also starts the
rpc.idmapd
if NFSv4 configured in
/etc/sysconfig/nfs
. The NFS server depends on
a running RPC portmapper.
Therefore, also start or restart the portmapper service with
rcportmap restart.
NFSv4 is the latest version of NFS protocol available on openSUSE. Configuring the directories for export with NFSv4 differs slightly from the previous NFS versions.
This file contains a list of entries. Each entry indicates a directory
that is shared and how it is shared. A typical entry in
/etc/exports
consists of:
/shared/directory host(option_list)
For example:
/export 192.168.1.2(rw,fsid=0,sync) /data 192.168.1.2(rw,bind=/export/data,sync)
Those directories for which fsid=0
is specified in
the option list are called pseudo root file systems. Here, the IP
address 192.168.1.2
is used. You can use the name of the host, a wild
card indicating a set of hosts (*.abc.com
,
*
, etc.), or netgroups.
For a fixed set of clients, there are only two types of directories that can be NFSv4 exported:
A single directory that is chosen as the pseudo root file system. In
this example, /export
is the pseudo root
directory because fsid=0
is specified in the
option list for this entry.
Directories that are chosen to be bound to some an existing
subdirectory of the pseudo file system. In the example entries above,
/data
is such a directory that binds to an
existing subdirectory (/export/data
) of the
pseudo file system /export
.
The pseudo file system is the top level directory under which all file systems that need to be NFSv4 exported take their places. For a client or set of clients, there can only be one directory on the server configured as the pseudo root for export. For this same client or client set, multiple other directories can be exported by binding them to some existing subdirectory in the pseudo root.
This file contains a few parameters that determine NFSv4 server daemon behavior. Importantly, the parameter NFSv4_SUPPORT must be set to yes. This parameter determines whether the NFS server supports NFSv4 exports and clients.
Every user on a Linux machine has a name and ID. idmapd does the name-to-ID mapping for NFSv4 requests to the server and replies to the client. This must be running on both server and client for NFSv4, because NFSv4 uses only names in its communication.
Make sure that there is a uniform way in which usernames and IDs (uid) are assigned to users across machines that might probably be sharing file systems using NFS. This can be achieved by using NIS, LDAP, or any uniform domain authentication mechanism in your domain.
For proper function, the parameter Domain
must be
set the same for both client and server in this file. If you are not
sure, leave the domain as localdomain
in both server
and client files. A sample configuration file looks like the following:
[General] Verbosity = 0 Pipefs-Directory = /var/lib/nfs/rpc_pipefs Domain = localdomain [Mapping] Nobody-User = nobody Nobody-Group = nobody
Do not change these parameters unless you are sure of what you are
doing. For further reference, read the man page of
idmapd
and idmapd.conf
;
man idmapd
, man idmapd.conf
.
After changing /etc/exports
or
/etc/sysconfig/nfs
, start or restart the nfs server
service with rcnfsserver restart. After changing
/etc/idmapd.conf
, start or restart the idmapd
service with rcidmapd restart. Make sure that both
services are running.
If this service should start at boot time, run the command chkconfig nfsserver on.
This is specific to NFSv3 and NFSv2 exports. Refer to Section 21.4.1, “Exporting for NFSv4 Clients” for exporting with NFSv4.
Exporting file systems with NFS involves two configuration files:
/etc/exports
and
/etc/sysconfig/nfs
. A typical
/etc/exports
file entry is in the format:
/shared/directory host(list_of_options)
For example:
/export 192.168.1.2(rw,sync)
Here, the directory /export
is shared with the host
192.168.1.2 with the option list rw,sync
. This
IP address can be replaced with a client name or set of clients using a
wild card (such as *.abc.com
) or even netgroups.
For a detailed explanation of all options and their meanings, refer to the man page of exports (man exports).
After changing /etc/exports
or
/etc/sysconfig/nfs
, start or restart the NFS server
using the command rcnfsserver restart.