<?xml version="1.0" encoding="ISO-8859-1"?>
<!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-download-http "&sourceforge-repo;/nfs/nfs-utils-&nfs-utils-version;.tar.bz2">
  <!ENTITY nfs-utils-download-ftp  " ">
  <!ENTITY nfs-utils-md5sum        "1e2f3c1ed468dee02d00c534c002ea10">
  <!ENTITY nfs-utils-size          "772 KB">
  <!ENTITY nfs-utils-buildsize     "16 MB">
  <!ENTITY nfs-utils-time          "0.1 SBU">
]>

<sect1 id="nfs-utils" xreflabel="nfs-utils-&nfs-utils-version;">
  <?dbhtml filename="nfs-utils.html"?>

  <sect1info>
    <othername>$LastChangedBy: ken $</othername>
    <date>$Date: 2015-02-22 15:08:20 -0500 (Sun, 22 Feb 2015) $</date>
  </sect1info>

  <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>

    &lfs77_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"/>
    </para>

    <bridgehead renderas="sect4">Optional</bridgehead>
    <para role="optional">
      <xref linkend="libevent"/>,
      <xref linkend="sqlite"/> and
      <ulink url="http://www.citi.umich.edu/projects/nfsv4/linux/">libnfsidmap</ulink> (for NFSv4 support),
      <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 linkend="rpcbind"/>
    </para>

    <para condition="html" role="usernotes">User Notes:
    <ulink url="&blfs-wiki;/nfs-utils"/></para>

  </sect2>

  <sect2 role="kernel" id='nfs-utils-kernel'>
    <title>Kernel Configuration</title>

    <para>Enable the following options in the kernel configuration
    and recompile the kernel if necessary:</para>

<screen><literal>File systems  ---&gt;
  [*] Network File Systems  ---&gt;         [CONFIG_NETWORK_FILESYSTEMS]
    &lt;*/M&gt; NFS client support             [CONFIG_NFS_FS]
    &lt;*/M&gt; NFS server support             [CONFIG_NFSD]</literal></screen>

    <para>Select the appropriate sub-options that appear when the above options
    are selected.</para>

    <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="root"><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>

    <!-- already fixed upstream -->
    <para>Fix an issue that would prevent <command>rpd.statd</command> from
    starting:</para>

<screen><userinput>sed -i "/daemon_init/s:\!::" utils/statd/statd.c</userinput></screen>

    <para>Install <application>NFS Utilities</application> by running
    the following commands:</para>

<screen><userinput>./configure --prefix=/usr          \
            --sysconfdir=/etc      \
            --without-tcp-wrappers \
            --disable-nfsv4        \
            --disable-gss &amp;&amp;
make</userinput></screen>

    <para>If your <filename class="directory">/usr</filename> directory
    is NFS mounted, you should install the executables in
    <filename class="directory">/sbin</filename> by passing
    an additional parameter <option>--sbindir=/sbin</option> to the
    above <command>./configure</command> command.</para>

    <para>To test the results, issue: <command>make check</command>.</para>

    <para>Now, as the <systemitem class="username">root</systemitem> user:</para>

<!-- dev note: make statduser=$(whoami) DESTDIR=<DESTDIR> install -->

<screen role='root'><userinput>make install</userinput></screen>

  </sect2>

  <sect2 role="commands">
    <title>Command Explanations</title>

    <para><parameter>--without-tcp-wrappers</parameter>: This option is
    needed because TCP Wrappers is not in BLFS.</para>

    <para><parameter>--disable-nfsv4</parameter>: Disables support
    for NFS version 4.</para>

    <para><parameter>--disable-gss</parameter>: Disables support for
    RPCSEC GSS (RPC Security).</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="http://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="root"><userinput>/home <replaceable>192.168.0.0/24</replaceable>(rw,subtree_check,anonuid=99,anongid=99)</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>Boot Script</title>

        <para>Install the <filename>/etc/rc.d/init.d/nfs-server</filename>
        init script included in the <xref linkend="bootscripts"/> package
        to start the server at boot.</para>

<screen role="root"><userinput>make install-nfs-server</userinput></screen>

        <indexterm zone="nfs-utils nfs-utils-server-init">
          <primary sortas="f-nfs-server">nfs-server</primary>
        </indexterm>

        <para>Now create the <filename>/etc/sysconfig/nfs-server</filename>
        configuration file:</para>

<screen role="root"><userinput>cat &gt; /etc/sysconfig/nfs-server &lt;&lt; "EOF"
<literal>PORT="2049"
PROCESSES="8"
QUOTAS="no"
KILLDELAY="10"</literal>
EOF</userinput></screen>

        <note><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">
          <primary
          sortas="e-etc-sysconfig-nfs-server">/etc/sysconfig/nfs-server</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="root"><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. 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
      specifiy other options.</para>

      <para>If you are using systemd, you may need to enable autofs v4 in your kernel,
      and add the option <literal>comment=systemd.automount</literal>. Some machines
      need this, because systemd tries to mount the external fs&apos;s before the network
      is up, others do not need it. An alternative is for <systemitem
      class="username">root</systemitem> to run <command>mount -a</command>.</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>Boot Script</title>

        <note><para>The following boot script is not required if the
        nfs-server script is installed.</para></note>

        <para>Install the <filename>/etc/rc.d/init.d/nfs-client</filename> init
        script included in the <xref linkend="bootscripts"/> 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>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">
          <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, 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)</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="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="mountnfs">
        <term><command>mount.nfs</command></term>
        <listitem>
          <para>Used to mount a network share using NFS</para>
          <indexterm zone="nfs-utils mountnfs">
            <primary sortas="b-mountnfs">mount.nfs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="mountnfs4">
        <term><command>mount.nfs4</command></term>
        <listitem>
          <para>Used to mount a network share using NFSv4</para>
          <indexterm zone="nfs-utils mountnfs4">
            <primary sortas="b-mountnfs4">mount.nfs4</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="nfsiostat-nfs-utils">
        <term><command>nfsiostat</command></term>
        <listitem>
          <para>Report 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>

      <varlistentry id="rpcmountd">
        <term><command>rpc.mountd</command></term>
        <listitem>
          <para>implements the NFS mount protocol on an NFS server.</para>
          <indexterm zone="nfs-utils rpcmountd">
            <primary sortas="b-rpcmountd">rpc.mountd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="rpcnfsd">
        <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 rpcnfsd">
            <primary sortas="b-rpcnfsd">rpc.nfsd</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="rpcstatd">
        <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 rpcstatd">
            <primary sortas="b-rpcstatd">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="umountnfs">
        <term><command>umount.nfs</command></term>
        <listitem>
          <para>Used to unmount a network share using NFS</para>
          <indexterm zone="nfs-utils umountnfs">
            <primary sortas="b-umountnfs">umount.nfs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="umountnfs4">
        <term><command>umount.nfs4</command></term>
        <listitem>
          <para>Used to unmount a network share using NFSv4</para>
          <indexterm zone="nfs-utils umountnfs4">
            <primary sortas="b-umountnfs4">umount.nfs4</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
