%general-entities; ]> $LastChangedBy$ $Date$ NFS-Utils-&nfs-utils-version; NFS Utilities 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. &lfs84_checked; Package Information Download (HTTP): Download (FTP): Download MD5 sum: &nfs-utils-md5sum; Download size: &nfs-utils-size; Estimated disk space required: &nfs-utils-buildsize; Estimated build time: &nfs-utils-time; NFS Utilities Dependencies Required , Optional (libdevmapper for NFSv4 support), libnfsidmap (for NFSv4 support), (for NIS client support), , or libgssapi, and librpcsecgss (for GSS and RPC security support) and Required (runtime) User Notes: 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 ---> [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. In BLFS we assume that nfs v3 will be used. If the server offers nfs v4 (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 v3 server. Even if neither end of the connection supports nfs v4, 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. NFS Utilities Installation of NFS Utilities Before you compile the program, ensure that the nobody user and nogroup group have been created as done in the current LFS book. You can add them by running the following commands as the root user: groupadd -g 99 nogroup && useradd -c "Unprivileged Nobody" -d /dev/null -g nogroup \ -s /bin/false -u 99 nobody The classic uid and gid values are 65534 which is also -2 when interpreted as a signed 16-bit number. These values impact other files on some filesystems that do not have support for sparse files. The nobody and nogroup values are relatively arbitrary. The impact on a server is nil if the exports file is configured correctly. If it is misconfigured, an ls -l or ps listing will show a uid or gid number of 65534 instead of a name. The client uses nobody only as the user running rpc.statd. Install NFS Utilities by running the following commands: ./configure --prefix=/usr \ --sysconfdir=/etc \ --sbindir=/sbin \ --disable-nfsv4 \ --disable-gss && make This package does not come with a working test suite." Now, as the root user: make install && mv -v /sbin/start-statd /usr/sbin && chmod u+w,go+r /sbin/mount.nfs && chown nobody.nogroup /var/lib/nfs Command Explanations --disable-nfsv4: This allows the package to be built when libnfsidmap has not been installed. --disable-gss: Disables support for RPCSEC GSS (RPC Security). 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 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 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. /etc/exportfs <phrase revision="sysv">Boot Script</phrase> <phrase revision="systemd">Systemd Units</phrase> Install the /etc/rc.d/init.d/nfs-server init script NFSv4 server units included in the package to start the server at boot. 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 nfs-server Now create the /etc/sysconfig/nfs-server configuration file: cat > /etc/sysconfig/nfs-server << "EOF" PORT="2049" PROCESSES="8" KILLDELAY="10" EOF The above parameters may be optionally placed in /etc/sysconfig/rc.site. /etc/sysconfig/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. /etc/default/nfs-utils 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 specifiy other options. If you are using systemd, you may need to enable autofs v4 in your kernel, and add the option comment=systemd.automount. Some machines need this, because systemd tries to mount the external fs's before the network is up, others do not need it. An alternative is for root to run mount -a. /etc/fstab <phrase revision="sysv">Boot Script</phrase> <phrase revision="systemd">Systemd Units</phrase> The following boot script is systemd units are not required if the nfs-server script is units are installed. Install the /etc/rc.d/init.d/nfs-client init script units included in the package to start the client services at boot. make install-nfs-client nfs-client To automatically mount nfs filesystems, clients will also need to install the netfs bootscript as described in . netfs Contents Installed Programs Installed Libraries Installed Directories exportfs, mountstats, mount.nfs, mount.nfs4 (link to mount.nfs), nfsiostat, nfsstat, osd_login, 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) None /var/lib/nfs Short Descriptions exportfs maintains a list of NFS exported file systems. exportfs mountstats displays NFS client per-mount statistics. mountstats mount.nfs is used to mount a network share using NFS mount.nfs mount.nfs4 is used to mount a network share using NFSv4 mount.nfs4 nfsiostat reports input/output statistics for network filesystems. nfsiostat nfsstat displays statistics kept about NFS client and server activity. nfsstat osd_login is a script that is a part of the autologin feature mandated by the pnfs-objects standard. osd_login rpc.mountd implements the NFS mount protocol on an NFS server. rpc.mountd rpc.nfsd implements the user level part of the NFS service on the server. rpc.nfsd 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. rpc.statd rpcdebug sets or clears the kernel's NFS client and server debug flags. rpcdebug showmount displays mount information for an NFS server. showmount sm-notify is used to send Network Status Monitor reboot messages. sm-notify 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. start-statd umount.nfs is used to unmount a network share using NFS umount.nfs umount.nfs4 is used to unmount a network share using NFSv4 umount.nfs4