ねら~ITエンジニア雑記

やきうのお兄ちゃんが綴るOracle Databaseメインのブログ

Linux で NFS を設定

まずは NFS Server側を設定する。NFS Server側の「/etc/exports」を編集。

vi /etc/exports
/mntnfs 192.168.1.0/255.255.255.0(rw,sync,no_root_squash)

NFS Server の nfs service を再起動して 「/etc/exports」の内容をロード

/sbin/service nfs stop
/sbin/service nfs start

次は NFS Client側の設定。NFS Client側の「/etc/fstab 」を編集

vi /etc/fstab
192.168.1.100:/mntnfs /nfs1 nfs rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,vers=3,timeo=600 0 0

mountコマンドでファイルシステムとしてマウントする。

mount /nfs1
df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             61923368  27146012  31631832  47% /
192.168.1.100:/mntnfs
                     151385280  10027872 133667424   7% /nfs1

以下、参照リンク。

Red Hat Linux 7.2: オフィシャル Red Hat Linuxリファレンスガイド
NFSサーバー設定ファイル

http://www.jp.redhat.com/manual/Doc72/RH-DOCS/rhl-rg-ja-7.2/s1-nfs-server-config.html

Red Hat Linux 7.2: オフィシャル Red Hat Linuxリファレンスガイド
NFSクライアント設定ファイル

http://www.jp.redhat.com/manual/Doc72/RH-DOCS/rhl-rg-ja-7.2/s1-nfs-client-config.html

/etc/fstabに記述されている数字の意味
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/756fstabnum.html

NFS サーバを使用したクライアントからのファイルマウント
http://tooljp.com/linux/doc/02filesystem/004nfs/index.html