glfs/networking/netprogs/nfs-utils.xml
2024-01-19 22:39:35 +01:00

718 lines
24 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY nfs-utils-root "&kernel-dl;/linux/utils/nfs-utils" >
<!ENTITY nfs-utils-download-http "&nfs-utils-root;/&nfs-utils-version;/nfs-utils-&nfs-utils-version;.tar.xz">
<!ENTITY nfs-utils-download-ftp " ">
<!ENTITY nfs-utils-md5sum "907f95977ccf7a522ee32af1534f0e4c">
<!ENTITY nfs-utils-size "712 KB">
<!ENTITY nfs-utils-buildsize "18 MB (with tests)">
<!ENTITY nfs-utils-time "0.2 SBU (with tests)">
]>
<sect1 id="nfs-utils" xreflabel="nfs-utils-&nfs-utils-version;">
<?dbhtml filename="nfs-utils.html"?>
<title>NFS-Utils-&nfs-utils-version;</title>
<indexterm zone="nfs-utils">
<primary sortas="a-Nfs-utils">NFS Utilities</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to NFS Utilities</title>
<para>
The <application>NFS Utilities</application> 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.
</para>
&lfs120_checked;
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing='compact'>
<listitem>
<para>
Download (HTTP): <ulink url="&nfs-utils-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url="&nfs-utils-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &nfs-utils-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &nfs-utils-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &nfs-utils-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &nfs-utils-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">NFS Utilities Dependencies</bridgehead>
<bridgehead renderas="sect4">Required</bridgehead>
<para role="required">
<xref linkend="libtirpc"/>,
<xref linkend="libevent"/>,
<xref linkend="rpcsvc-proto"/>, and
<xref linkend="sqlite"/>
</para>
<bridgehead renderas="sect4">Optional</bridgehead>
<para role="optional">
<xref linkend="cyrus-sasl"/> (for SASL authentication),
<xref linkend="lvm2"/> (libdevmapper for NFSv4 support),
<!--<xref linkend="libnfsidmap"/> (for NFSv4 support),
This is now built in, as of 2.2.1-->
<xref linkend="libnsl"/> (for NIS client support),
<xref linkend="openldap"/> (for LDAP authentication),
<xref linkend="mitkrb"/> or
<ulink url="http://www.citi.umich.edu/projects/nfsv4/linux/">
libgssapi
</ulink>, and
<ulink url="http://www.citi.umich.edu/projects/nfsv4/linux/">
librpcsecgss
</ulink> (for GSS and RPC security support), and
<xref linkend="libcap-pam"/>
</para>
<bridgehead renderas="sect4">Required (runtime)</bridgehead>
<para role="required">
<xref role="runtime" linkend="rpcbind"/>
</para>
<!-- NSS configuration isn't directly related to NFS, but left here in case
<bridgehead renderas="sect4">Optional (runtime for NIS clients)</bridgehead>
<para role="optional">
<ulink url="https://github.com/thkukuk/libnss_compat">libnss_compat</ulink>,
<ulink url="https://github.com/thkukuk/libnss_nis">libnss_nis</ulink>, and
<ulink url="https://github.com/thkukuk/libnss_nisplus">libnss_nisplus</ulink>
</para>
-->
</sect2>
<sect2 role="kernel" id='nfs-utils-kernel'>
<title>Kernel Configuration</title>
<para>
Enable the following options in the kernel configuration
(choose client and/or server support as appropriate) and recompile the
kernel if necessary:
</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="nfs-utils-kernel.xml"/>
<para>
Select the appropriate sub-options that appear when the above options
are selected.
</para>
<note>
<para>
In BLFS we assume that nfs v3 will be used. If the
<emphasis>server</emphasis> offers nfs v4 (for linux, CONFIG_NFSD_V4)
then auto-negotiation for v3 will fail and you will need to add
<literal>nfsver=3</literal> to the mount options. This also applies
if that option is enabled in the <emphasis>client's</emphasis> kernel,
for example in a distro trying to mount from a BLFS v3 server.
</para>
<para>
Even if neither end of the connection supports nfs v4, adding
<literal>nfsver=3</literal> is still beneficial because it prevents an
error message "NFS: bad mount option value specified: minorversion=1"
being logged on every mount.
</para>
</note>
<indexterm zone="nfs-utils nfs-utils-kernel">
<primary sortas="d-nfs-utils">NFS Utilities</primary>
</indexterm>
</sect2>
<sect2 role="installation" id='nfs-utils-install'
xreflabel='NFS Utilities Installation'>
<title>Installation of NFS Utilities</title>
<!--
<para>
Before you compile the program, ensure that the <systemitem
class="username">nobody</systemitem> user and <systemitem
class="groupname">nogroup</systemitem> group have been created as done in
the current LFS book. You can add them by running the following commands
as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="nodump"><userinput>groupadd -g 99 nogroup &amp;&amp;
useradd -c "Unprivileged Nobody" -d /dev/null -g nogroup \
-s /bin/false -u 99 nobody</userinput></screen>
<note>
<para>
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
<systemitem class="username">nobody</systemitem> and <systemitem
class="groupname">nogroup</systemitem> values are relatively arbitrary.
The impact on a server is nil if the <filename>exports</filename> file
is configured correctly. If it is misconfigured, an
<command>ls -l</command> or <command>ps</command> listing will show a
uid or gid number of 65534 instead of a name. The client uses
<systemitem class="username">nobody</systemitem> only as the user
running <command>rpc.statd</command>.
</para>
</note>
-->
<para>
Install <application>NFS Utilities</application> by running
the following commands:
</para>
<screen><userinput>./configure --prefix=/usr \
--sysconfdir=/etc \
--sbindir=/usr/sbin \
--disable-nfsv4 \
--disable-gss \
LIBS="-lsqlite3 -levent_core" &amp;&amp;
make</userinput></screen>
<!-- Test breakage: see
http://lists.linuxfromscratch.org/pipermail/blfs-book/2017-December/071861.html
<para>
This package does not come with a working test suite.
</para>
-->
<para>
Now, as the &root; user:
</para>
<!-- dev note: make statduser=$(whoami) DESTDIR=<DESTDIR> install -->
<screen role='root'><userinput>make install &amp;&amp;
chmod u+w,go+r /usr/sbin/mount.nfs &amp;&amp;
chown nobody:nogroup /var/lib/nfs</userinput></screen>
<para>
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.
</para>
<para>
To test the results, issue, as &root;:
</para>
<screen role="root" remap="test"><userinput>make check</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<!--
<para>
<command>sed ... support/nsm/rpc.c</command>: This sed it required
to fix a build issue with glibc-2.26 and later.
</para>
<para>
<parameter>- -disable-nfsv4</parameter>: This allows the package to be
built when libnfsidmap has not been installed.
</para>
nfs-utils now carries libnfsidmap
-->
<para>
<parameter>--disable-gss</parameter>: Disables support for
RPCSEC GSS (RPC Security).
</para>
<para>
<parameter>LIBS="-lsqlite3 -levent_core"</parameter>: is required for
the fsidd program.
</para>
<para>
<command>chown nobody:nogroup /var/lib/nfs</command>: The
rpc.statd program uses the ownership of this directory to set
it's UID and GID. This command sets those to unprivileged entries.
</para>
</sect2>
<sect2 role="configuration">
<title>Configuring NFS Utilities</title>
<sect3 id='nfs-utils-server-config'>
<title>Server Configuration</title>
<para>
<filename>/etc/exports</filename> contains the exported directories
on NFS servers. Refer to the <filename>exports.5</filename> manual page
for the syntax of this file. Also refer to the "NFS HowTo" available at
<ulink url="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 <filename class="directory">/home</filename>
directory over the local network, the following line may be added:
</para>
<screen role="nodump"><userinput>cat &gt;&gt; /etc/exports &lt;&lt; EOF
<replaceable>/home 192.168.0.0/24</replaceable>(rw,subtree_check,anonuid=99,anongid=99)
EOF</userinput></screen>
<note>
<para>
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.
</para>
</note>
<indexterm zone="nfs-utils nfs-utils-server-config">
<primary sortas="e-etc-exportfs">/etc/exportfs</primary>
</indexterm>
<sect4 id="nfs-utils-server-init">
<title><phrase revision="sysv">Boot Script</phrase>
<phrase revision="systemd">Systemd Units</phrase></title>
<para>
Install the
<phrase revision="sysv">
<filename>/etc/rc.d/init.d/nfs-server</filename>
init script
</phrase>
<phrase revision="systemd">NFSv4 server units</phrase>
included in the <xref linkend="bootscripts" revision="sysv"/>
<xref linkend="systemd-units" revision="systemd"/> package
to start the server at boot.
</para>
<screen role="root" revision="systemd"><userinput>make install-nfsv4-server</userinput></screen>
<para revision="systemd">
If you have disabled NFSv4 support, run the following command as the
<systemitem class="username">root</systemitem> user to omit the NFSv4
specific systemd units:
</para>
<!-- both -->
<screen role="root"><userinput>make install-nfs-server</userinput></screen>
<indexterm zone="nfs-utils nfs-utils-server-init" revision="sysv">
<primary sortas="f-nfs-server">nfs-server</primary>
</indexterm>
<para revision="sysv">
Now create the
<filename>/etc/sysconfig/nfs-server</filename> configuration file:
</para>
<screen role="root" revision="sysv"><userinput>cat &gt; /etc/sysconfig/nfs-server &lt;&lt; "EOF"
<literal>PORT="2049"
PROCESSES="8"
KILLDELAY="10"</literal>
EOF</userinput></screen>
<note revision="sysv">
<para>
The above parameters may be optionally placed in
<filename>/etc/sysconfig/rc.site</filename>.
</para>
</note>
<indexterm zone="nfs-utils nfs-utils-server-init" revision="sysv">
<primary
sortas="e-etc-sysconfig-nfs-server">/etc/sysconfig/nfs-server</primary>
</indexterm>
<para revision="systemd">
You can edit the <filename>/etc/default/nfs-utils</filename>
file to change the startup options for NFS daemons. Defaults
should be fine for most use cases.
</para>
<indexterm zone="nfs-utils nfs-utils-server-init" revision="systemd">
<primary sortas="e-etc-default-nfs-utils">/etc/default/nfs-utils</primary>
</indexterm>
</sect4>
</sect3>
<sect3 id='nfs-utils-client-config'>
<title>Client Configuration</title>
<para>
<filename>/etc/fstab</filename> contains the directories that
are to be mounted on the client. Alternately the partitions can be
mounted by using the <command>mount</command> command with the proper
options. To mount the <filename class="directory">/home</filename>
and <filename class="directory">/usr</filename> partitions, add the
following to the <filename>/etc/fstab</filename>:
</para>
<screen role="nodump"><userinput><replaceable>&lt;server-name&gt;</replaceable>:/home /home nfs rw,_netdev 0 0
<replaceable>&lt;server-name&gt;</replaceable>:/usr /usr nfs ro,_netdev 0 0</userinput></screen>
<para>
The options which can be used are specified in <command>man 5 nfs
</command>. 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 <literal>rw</literal> or
<literal>ro</literal>, <literal>_netdev</literal> if the filesystem is
to be automatically mounted at boot, or <literal>noauto</literal> (and
perhaps <literal>user</literal>) for other filesystems.
</para>
<para>
If the fileserver is not running a recent version of linux, you may
need to specify other options.
</para>
<para revision="systemd">
You may need to enable autofs v4 in your kernel, and add the option
<literal>comment=systemd.automount</literal>. Some machines may need
this because systemd tries to mount the external filesystems before
the network is up. An alternative is to run <command>mount -a</command>
as the <systemitem class="username">root</systemitem> user after the
system has started.
</para>
<indexterm zone="nfs-utils nfs-utils-client-config">
<primary sortas="e-etc-fstab">/etc/fstab</primary>
</indexterm>
<sect4 id="nfs-utils-client-init">
<title><phrase revision="sysv">Boot Script</phrase>
<phrase revision="systemd">Systemd Units</phrase></title>
<note>
<para>
The following <phrase revision="sysv">boot script is</phrase>
<phrase revision="systemd">systemd units are</phrase> not required
if the nfs-server <phrase revision="sysv">script is</phrase>
<phrase revision="systemd">units are</phrase> installed.
</para>
</note>
<para>
Install the
<phrase revision="sysv">
<filename>/etc/rc.d/init.d/nfs-client</filename> init script
</phrase>
<phrase revision="systemd">units</phrase> included in the
<xref linkend="bootscripts" revision="sysv"/>
<xref linkend="systemd-units" revision="systemd"/> package to start
the client services at boot.
</para>
<screen role="root"><userinput>make install-nfs-client</userinput></screen>
<indexterm zone="nfs-utils nfs-utils-client-config">
<primary sortas="f-nfs-client">nfs-client</primary>
</indexterm>
<para revision="sysv">
To automatically mount <systemitem class="filesystem">nfs
</systemitem> filesystems, clients will also need to install the
<filename>netfs</filename> bootscript as described in <xref
linkend="postlfs-config-netfs"/>.
</para>
<indexterm zone="nfs-utils nfs-utils-client-config" revision="sysv">
<primary sortas="f-netfs">netfs</primary>
</indexterm>
</sect4>
</sect3>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Libraries</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>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)</seg>
<seg>None</seg>
<seg>/var/lib/nfs</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="exportfs">
<term><command>exportfs</command></term>
<listitem>
<para>
maintains a list of NFS exported file systems
</para>
<indexterm zone="nfs-utils exportfs">
<primary sortas="b-exportfs">exportfs</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="fsidd">
<term><command>fsidd</command></term>
<listitem>
<para>
offers a local UNIX domain socket interface
for all NFS userspace to query the reexport database
</para>
<indexterm zone="nfs-utils fsidd">
<primary sortas="b-fsidd">fsidd</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="mountstats">
<term><command>mountstats</command></term>
<listitem>
<para>
displays NFS client per-mount statistics
</para>
<indexterm zone="nfs-utils mountstats">
<primary sortas="b-mountstats">mountstats</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="mount.nfs">
<term><command>mount.nfs</command></term>
<listitem>
<para>
is used to mount a network share using NFS
</para>
<indexterm zone="nfs-utils mount.nfs">
<primary sortas="b-mount.nfs">mount.nfs</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="mount.nfs4">
<term><command>mount.nfs4</command></term>
<listitem>
<para>
is used to mount a network share using NFSv4
</para>
<indexterm zone="nfs-utils mount.nfs4">
<primary sortas="b-mount.nfs4">mount.nfs4</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="nfsconf">
<term><command>nfsconf</command></term>
<listitem>
<para>
can be used to test for and retrieve configuration settings from
a range of nfs-utils configuration files
</para>
<indexterm zone="nfs-utils nfsconf">
<primary sortas="b-nfsconf">nfsconf</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="nfsdclnts">
<term><command>nfsdclnts</command></term>
<listitem>
<para>
prints information about NFS clients
</para>
<indexterm zone="nfs-utils nfsdclnts">
<primary sortas="b-nfsdclnts">nfsdclnts</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="nfsiostat-nfs-utils">
<term><command>nfsiostat</command></term>
<listitem>
<para>
reports input/output statistics for network filesystems
</para>
<indexterm zone="nfs-utils nfsiostat-nfs-utils">
<primary sortas="b-nfsiostat-nfs-utils">nfsiostat</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="nfsstat">
<term><command>nfsstat</command></term>
<listitem>
<para>
displays statistics kept about NFS client and server activity
</para>
<indexterm zone="nfs-utils nfsstat">
<primary sortas="b-nfsstat">nfsstat</primary>
</indexterm>
</listitem>
</varlistentry>
<!-- osd_login seems to no longer exist.
<varlistentry id="osd_login">
<term><command>osd_login</command></term>
<listitem>
<para>
is a script that is a part of the autologin feature
mandated by the pnfs-objects standard.
</para>
<indexterm zone="nfs-utils osd_login">
<primary sortas="b-osd_login">osd_login</primary>
</indexterm>
</listitem>
</varlistentry> -->
<varlistentry id="rpc.mountd">
<term><command>rpc.mountd</command></term>
<listitem>
<para>
implements the NFS mount protocol on an NFS server
</para>
<indexterm zone="nfs-utils rpc.mountd">
<primary sortas="b-rpc.mountd">rpc.mountd</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rpc.nfsd">
<term><command>rpc.nfsd</command></term>
<listitem>
<para>
implements the user level part of the NFS
service on the server
</para>
<indexterm zone="nfs-utils rpc.nfsd">
<primary sortas="b-rpc.nfsd">rpc.nfsd</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rpc.statd">
<term><command>rpc.statd</command></term>
<listitem>
<para>
is used by the NFS file locking service. Run on both sides,
client as well as server, when you want file locking enabled
</para>
<indexterm zone="nfs-utils rpc.statd">
<primary sortas="b-rpc.statd">rpc.statd</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rpcdebug">
<term><command>rpcdebug</command></term>
<listitem>
<para>
sets or clears the kernel's NFS client and server debug flags
</para>
<indexterm zone="nfs-utils rpcdebug">
<primary sortas="b-rpcdebug">rpcdebug</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="showmount">
<term><command>showmount</command></term>
<listitem>
<para>
displays mount information for an NFS server
</para>
<indexterm zone="nfs-utils showmount">
<primary sortas="b-showmount">showmount</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="sm-notify">
<term><command>sm-notify</command></term>
<listitem>
<para>
is used to send Network Status Monitor reboot messages
</para>
<indexterm zone="nfs-utils sm-notify">
<primary sortas="b-sm-notify">sm-notify</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="start-statd">
<term><command>start-statd</command></term>
<listitem>
<para>
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
</para>
<indexterm zone="nfs-utils start-statd">
<primary sortas="b-start-statd">start-statd</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="umount.nfs">
<term><command>umount.nfs</command></term>
<listitem>
<para>
is used to unmount a network share using NFS
</para>
<indexterm zone="nfs-utils umount.nfs">
<primary sortas="b-umount.nfs">umount.nfs</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="umount.nfs4">
<term><command>umount.nfs4</command></term>
<listitem>
<para>
is used to unmount a network share using NFSv4
</para>
<indexterm zone="nfs-utils umount.nfs4">
<primary sortas="b-umount.nfs4">umount.nfs4</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>