NFS-Utils-2.1.1

NFS Utilities の概要

NFS Utilities パッケージは、カーネルの NFS 機能を利用するために必要な、ユーザー空間のサーバーおよびクライアントツールを提供します。 NFS は、ネットワーク越しにファイルシステムを共有するためのプロトコルです。

本パッケージは LFS-8.1 において正しくビルドでき動作することが確認されています。

パッケージ情報

NFS Utilities の依存パッケージ

必須

libtirpc-1.0.2

任意

SQLite-3.20.0 and libnfsidmap (for NFSv4 support), MIT Kerberos V5-1.15.1 or libgssapi, and librpcsecgss (for GSS and RPC security support) and libcap-2.25 with PAM

必須 (実行時)

rpcbind-0.2.4

ユーザー情報: http://wiki.linuxfromscratch.org/blfs/wiki/nfs-utils

カーネルの設定

カーネル設定として以下のオプションを (クライアント、サーバーのサポートを適宜選択し) 有効にしておくことが必要です。 もしこれを行っていない場合はカーネルを再コンパイルします。

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

上記のオプションを選択する際には、そこに現れるサブオプションについても適切なものを選択してください。

[注記]

注記

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.

NFS Utilities のインストール

本プログラムをビルドするためには LFS ブックに基づくシステム構築において nobody ユーザーと nogroup グループを生成しておくことが必要です。 root ユーザーになって以下のコマンドを実行することで、それらを生成することができます。

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.

以下のコマンドを実行して NFS Utilities をビルドします。

sed -i '/fcntl.h/a#include <stdint.h>' support/nsm/rpc.c &&

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

root ユーザーになって以下を実行します。

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

The tests for this package require that the package be installed and configured as specified below. In addition, the the daemon from rpcbind-0.2.4 needs to be running and the tests need to be run as the root user.

ビルド結果をテストする場合は root ユーザーになって make check を実行します。

コマンド説明

sed ... support/nsm/rpc.c: This sed it required to fix a build issue with glibc-2.26 and later.

--without-tcp-wrappers: This option is needed because TCP Wrappers is not in BLFS.

--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 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 /home directory over the local network, the following line may be added:

/home 192.168.0.0/24(rw,subtree_check,anonuid=99,anongid=99)
[注記]

注記

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

Install the /etc/rc.d/init.d/nfs-server init script included in the blfs-bootscripts-20170731 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
[注記]

注記

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

Boot Script
[注記]

注記

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-20170731 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 ネットワークファイルシステムの設定.

Contents

Installed Programs: 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)
Installed Libraries: None
Installed Directories: /var/lib/nfs

Short Descriptions

exportfs

maintains a list of NFS exported file systems.

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

nfsiostat

reports input/output statistics for network filesystems.

nfsstat

displays statistics kept about NFS client and server activity.

osd_login

is a script that is a part of the autologin feature mandated by the pnfs-objects standard.

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

最終更新日: 2017-08-19 04:42:43 +0900