NFS-Utils-1.3.2

Introduction to NFS Utilities

The NFS Utilities package contains the userspace server and client tools necessary to use the kernel's NFS abilities. NFS is a protocol that allows sharing file systems over the network.

This package is known to build and work properly using an LFS-7.6 systemd platform.

Package Information

NFS Utilities Dependencies

Required

libtirpc-0.2.5

Recommended

Optional

keyutils-1.5.9, Python-2.7.9 (for mountstats and nfsiostat), MIT Kerberos V5-1.13.1 or libgssapi and librpcsecgss (for GSS and RPC security support)

Required (runtime)

rpcbind-0.2.2

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/nfs-utils

Kernel Configuration

Enable the following options in the kernel configuration and recompile the kernel if necessary:

File systems  --->
  [*] Network File Systems  --->         [CONFIG_NETWORK_FILESYSTEMS]
    <*/M> NFS client support             [CONFIG_NFS_FS]
    <*/M> NFS server support             [CONFIG_NFSD]

Select the appropriate sub-options that appear when the above options are selected.

Installation of NFS Utilities

Fix an issue that would prevent rpc.statd from starting:

sed -i "/daemon_init/s:\!::" utils/statd/statd.c

Install NFS Utilities by running the following commands:

./configure --prefix=/usr           \
            --sysconfdir=/etc       \
            --sbindir=/sbin         \
            --enable-libmount-mount \
            --without-tcp-wrappers  \
            --disable-gss           &&
make

To test the results, issue: make check.

Now, as the root user:

make install &&
install -v -m644 utils/mount/nfsmount.conf /etc/nfsmount.conf

If the NFSv4 support was not disabled, run the following commands while still as the root user:

install -v -dm555 /var/lib/nfs/rpc_pipefs &&
install -v -dm755 /var/lib/nfs/v4recovery &&
cat > /etc/idmapd.conf << "EOF"
[General]
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain

[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup

[Translation]
Method = nsswitch
EOF

Command Explanations

--enable-libmount-mount: This switch enables linking of the mount.nfs program with the libmount library.

--without-tcp-wrappers: This switch disables TCP Wrappers support because it is not part of BLFS.

--disable-gss: This switch disables support for RPCSEC GSS (RPC Security). Remove it if you have installed optional dependencies.

--disable-nfsv4: Tis switch disables support for NFS version 4. Use it if you have not installed recommended dependencies. It implies --disable-nfsv41.

--disable-nfsv41: Tis switch disables support for NFS version 4.1. Use it if you have not installed LVM2 but stil wish to enable support for NFS version 4.

Configuring NFS Utilities

NFS Server Configuration

/etc/exports contains the exported directories on NFS servers. Refer to the exports.5 manual page for the syntax of this file. Also refer to the "NFS HowTo" available at http://nfs.sourceforge.net/nfs-howto/ for information on how to configure the servers and clients in a secure manner.

For sharing the /home directory over the local network using NFSv3, add the following line to /etc/exports:

/home 192.168.0.0/24(rw,no_subtree_check,anonuid=99,anongid=99)

NFSv4 exports exist in a single pseudo filesystem, where the real directories are mounted with the --bind option. In order to share /home over NFSv4, you need to bind mount it into a pseudo filesystem you are going to export (in this example we will use /srv/nfsv4, in which case the /home directory will become /srv/nfsv4/home).

install -v -dm755 /srv/nfsv4/home &&
mount -v --bind /home /srv/nfsv4/home

To make the above change permanent, you can add the following line to your /etc/fstab:

/home /srv/nfsv4/home none bind 0 0

Update /etc/exports to export your NFSv4 share:

/srv/nfsv4       192.168.0.0/24(rw,fsid=0,no_subtree_check)
/srv/nfsv4/home  192.168.0.0/24(rw,nohide,insecure,no_subtree_check)
[Note]

Note

Be sure to replace the directory, network address and prefix above to match your network. The only space in the lines above should be between the directory and the network address.

Systemd Units

To start the NFS server daemons at boot, install the systemd units from the blfs-systemd-units-20150210 package by running the following command as the root user:

make install-nfsv4-server

If you have disabled NFSv4 support, run the following command as the root user to omit the NFSv4 specific systemd units:

make install-nfs-server

You can edit the /etc/default/nfs-utils file to change the startup options for NFS daemons. Defaults should be fine for most use cases.

Client Configuration

/etc/fstab contains the directories that are to be mounted on the client. Alternately the partitions can be mounted by using the mount command with the proper options. To mount the /home and /usr partitions, add the following to the /etc/fstab:

<server-name>:/home /home nfs rw,x-systemd.automount,x-systemd.device-timeout=10,timeo=14 0 0
<server-name>:/usr  /usr  nfs ro,x-systemd.automount,x-systemd.device-timeout=10,timeo=14 0 0

The options which can be used are specified in man 5 nfs. If both the client and server are running recent versions of Linux, most of the options will be negotiated. You can specify either rw or ro, x-systemd.automount if the filesystem is to be automatically mounted at boot, or noauto (and perhaps user) for other filesystems.

If the fileserver is not running a recent version of Linux, you may need to specifiy other options.

Systemd Units
[Note]

Note

The following systemd unis are not required if the nfs-server units were previously installed.

To start the NFS client services at boot, install the systemd units from the blfs-systemd-units-20150210 package by running the following command as the root user:

make install-nfs-client

Contents

Installed Programs: blkmapd, exportfs, mount.nfs, mount.nfs4 (link to mount.nfs), mountstats, nfsdcltrack, nfsiostat, nfsstat, osd_login, rpcdebug, rpc.idmapd, rpc.mountd, rpc.nfsd, rpc.statd, showmount, sm-notify, start-statd, umount.nfs (link to mount.nfs) and umount.nfs4 (link to mount.nfs)
Installed Libraries: None
Installed Directories: /var/lib/nfs

Short Descriptions

blkmapd

is used to perform device discovery and mapping for the parallel NFS (pNFS) block layout client.

exportfs

is used to maintain a list of NFS exported file systems.

mount.nfs

is used to mount a network share using NFS.

mount.nfs4

is used to mount a network share using NFSv4.

mountstats

is used to display NFS client per-mount statistics.

nfsdcltrack

is the NFSv4 client tracking callout program.

nfsiostat

is used to report input/output statistics for network filesystems.

nfsstat

is used to display statistics kept about NFS client and server activity.

rpcdebug

is used to set or clear the kernel's NFS client and server debug flags.

rpc.idmapd

implements the NFSv4 ID <-> name mapping daemon.

rpc.mountd

implements the NFS mount protocol on an NFS server.

rpc.nfsd

implements the user level part of the NFS service on the server.

rpc.statd

is used by the NFS file locking service. Run on both sides, client as well as server, when you want file locking enabled.

showmount

is used to display mount information for an NFS server.

sm-notify

is used to send Network Status Monitor reboot messages.

start-statd

is a script called by nfsmount when mounting a filesystem with locking enabled, if statd does not appear to be running. It can be customised with whatever flags are appropriate for the site.

umount.nfs

is used to unmount a network share using NFS.

umount.nfs4

is used to unmount a network share using NFSv4.

Last updated on 2014-10-26 23:09:24 +0100