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 command
rcnfsserver restart. This also starts the
rpc.idmapd if NFSv4 is configured in
/etc/sysconfig/nfs. The NFS server depends on a
running RPC portmapper. Therefore, also start or restart the portmapper
service with rcrpcbind 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,crossmnt) /export/data 192.168.1.2(rw,bind=/data,sync)
Here the IP address 192.168.1.2 is used to identify
the allowed client. You can also use the name of the host, a wild card
indicating a set of hosts (*.abc.com,
*, etc.), or netgroups
(@my-hosts).
The directory which specifies fsid=0 is special in
that it is the root of the filesystem that is exported, sometime
referred to as the pseudo root filesystem. This directory must also
have the crossmnt for correct operation with NFSv4.
All other directories exported via NFSv4 must be mounted below this
point. If you want to export a directory that is not normally below
this exported root, it needs to be bound into the exported tree. This
can be done using the bind= syntax.
In the example above, /data is not below the
/export, but we want to export it anyway, so we
export /export/data, and specify that the
/data directory should be bound to that name. The
directory /export/data must exist and should
normally be empty.
When clients mount from this server, that should just mount
servername:/ rather than
servername:/export. It is not necessary to also
mount servername:/data and that will automatically
appear beneath wherever servername:/ was mounted.
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 for 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 the 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 know exactly 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, reload the
configuration file with the command killall -HUP
rpc.idmapd.
If this service needs to start at boot time, run the command chkconfig nfsserver on.
This is specific to NFSv3 and NFSv2 exports. Refer to Section 26.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.