NFS-Utils-2.9.2

#### Beyond Linux® From Scratch (System V Edition) - Version r13.1-84

### Chapter 15. Networking Programs

- Prev

  Net-tools-2.10

- Next

  Configuring for Network Filesystems

- Up
- Home

# NFS-Utils-2.9.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.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://www.kernel.org/pub/linux/utils/nfs-utils/2.9.2/nfs-utils-2.9.2.tar.xz

- Download MD5 sum: c398aeaa53ee5bc9ded8bc11752347e9

- Download size: 748 KB

- Estimated disk space required: 25 MB (with tests)

- Estimated build time: 0.2 SBU (with tests)

### NFS Utilities Dependencies

#### Required

libevent-2.1.13, libnl-3.12.0, libtirpc-1.3.7, libxml2-2.15.4, and rpcsvc-proto-1.4.4

#### Optional

Cyrus SASL-2.1.28 (for SASL authentication), libnsl-2.0.1 (for NIS client support), LVM2-2.03.42 (libdevmapper for NFSv4 support), OpenLDAP-2.7.0 (for LDAP authentication), MIT Kerberos V5-1.22.2 or libgssapi, and librpcsecgss (for GSS and RPC security support), and libcap-2.78 with PAM

#### Required (runtime)

rpcbind-1.2.9

## Kernel Configuration

Enable the following options in the kernel configuration (choose client and/or server support as appropriate) and recompile the kernel if necessary:

    File systems --->
      [*] Network File Systems --->                            [NETWORK_FILESYSTEMS]
        <*/M> NFS client support                                            [NFS_FS]
        <*/M> NFS server support                                              [NFSD]

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

### Note

In BLFS we assume that NFSv3 will be used. If the server offers NFSv4 (for linux, CONFIG_NFSD_V4) then auto-negotiation for v3 will fail and you will need to add `nfsver=3` to the mount options. This also applies if that option is enabled in the client's kernel, for example in a distro trying to mount from a BLFS NFSv3 server.

Even if neither end of the connection supports NFSv4, adding `nfsver=3` is still beneficial because it prevents an error message "NFS: bad mount option value specified: minorversion=1" being logged on every mount.

Note that for the purposes of BLFS, we are only covering NFSv3 because it is easier to configure. If you depend on some of the more advanced configuration or security features of NFSv4, you may wish to review this blog post as it may help you setup configuration for NFSv4.

## Installation of NFS Utilities

Install NFS Utilities by running the following commands:

    ./configure --prefix=/usr       \
                --sysconfdir=/etc   \
                --sbindir=/usr/sbin \
                --disable-nfsv4     \
                --disable-gss &&
    make

Now, as the `root` user:

    make install                       &&
    chmod u+w,go+r /usr/sbin/mount.nfs &&
    chown nobody:nogroup /var/lib/nfs

The tests for this package require that the package be installed. In addition, the rpc.statd daemon must not be running and the tests need to be run as the `root` user.

To test the results, issue, as `root`:

    make check

## Command Explanations

`--disable-nfsv4`: This option prevents building NFSv4 capabilities into the installed programs. Remove it if you need the advanced capabilities provided by NFSv4.

`--disable-gss`: Disables GSSAPI support in this package. If you need to use it, make sure that MIT Kerberos V5-1.22.2 is installed, and that you have GSSAPI support enabled in libtirpc-1.3.7 as well.

chown nobody:nogroup /var/lib/nfs: The rpc.statd program uses the ownership of this directory to set it's UID and GID. This command sets those to unprivileged entries.

## Configuring NFS Utilities

### 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 https://nfs.sourceforge.net/nfs-howto/ for information on how to configure the servers and clients in a secure manner. For example, for sharing the `/home` directory over the local network, the following line may be added:

    cat >> /etc/exports << EOF
    /home 192.168.0.0/24(rw,subtree_check,anonuid=99,anongid=99)
    EOF

### Note

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

##### Boot Script

If you have enabled building NFSv4 capabilities, install the `/etc/rc.d/init.d/nfs-server` init script included in the blfs-bootscripts-20251220 package to start the server at boot.

    make install-nfs-server

Now create the `/etc/sysconfig/nfs-server` configuration file:

    cat > /etc/sysconfig/nfs-server << "EOF"
    PORT="2049"
    PROCESSES="8"
    KILLDELAY="10"
    EOF

### Note

The above parameters may be optionally placed in `/etc/sysconfig/rc.site`.

### 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,_netdev 0 0
    <server-name>:/usr   /usr  nfs   ro,_netdev 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 (but see the Note above on nfsver=3). You can specify either `rw` or `ro`, `_netdev` 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 specify other options.

##### Boot Script

### Note

The following boot script is not required if the nfs-server script is installed.

Install the `/etc/rc.d/init.d/nfs-client` init script included in the blfs-bootscripts-20251220 package to start the client services at boot.

    make install-nfs-client

To automatically mount `nfs` filesystems, clients will also need to install the `netfs` bootscript as described in Configuring for Network Filesystems.

## Contents

Installed Programs: exportfs, fsidd, mountstats, mount.nfs, mount.nfs4 (link to mount.nfs), nfsconf, nfsdclnts, nfsiostat, nfsstat, rpc.mountd, rpc.nfsd, rpc.statd, rpcdebug, 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

exportfs | maintains a list of NFS exported file systems
fsidd | offers a local UNIX domain socket interface for all NFS userspace to query the reexport database
mountstats | displays NFS client per-mount statistics
mount.nfs | is used to mount a network share using NFS
mount.nfs4 | is used to mount a network share using NFSv4
nfsconf | can be used to test for and retrieve configuration settings from a range of nfs-utils configuration files
nfsdclnts | prints information about NFS clients
nfsiostat | reports input/output statistics for network filesystems
nfsstat | displays statistics kept about NFS client and server activity
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
rpcdebug | sets or clears the kernel's NFS client and server debug flags
showmount | displays 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

- Prev

  Net-tools-2.10

- Next

  Configuring for Network Filesystems

- Up
- Home