nfs の 設定 ”nfs”は 既に存在してます今回はそれを使用可能にします。サー バー側は 192.168.0.5 クライアント側は 192.168.0.8 とします。ネットワーク は 192.168.0.0 の プライベートネットワークで使用し、Mac Windows とは netatalk, samba にて ファイルの受渡しを行ってます nfs は linux の 機器 間でのファイルの受け渡しを行うものです。外部向けサーバーには 設置しませ ん。内部の linux 機器のみとします。
From
http://www.linux.or.jp/JF/JFdocs/NFS-HOWTO/
 NFS サーバの設置にあたって編集しなければならない 
主要な設定ファイルは 3 つあります。 
/etc/exports, /etc/hosts.allow, /etc/hosts.deny です。
 /etc/exports のエントリは、 以下のような形式になっています:
 directory machine1(option11,option12) machine2(option21,option22)
directory
    共有させたいディレクトリです。ボリューム全体でも良いですし、 
そうでなくてもかまいません。あるディレクトリを共有させると、 
それ以下のすべてのディレクトリも (同じファイルシステムにある限り) 
同様に共有されます。 
machine1 and machine2
    そのディレクトリにアクセスするクライアントマシンです。 
マシンは DNS アドレスまたは IP アドレスで指定できます 
(例: machine.company.com とか 192.168.0.8)。 
IP アドレスを使うほうがより信頼性が高く安全です。
optionxx
- 
ro: このディレクトリは読み出し専用で共有されます。 
クライアントは書き込むことはできません。これがデフォルトです。
 - 
rw: クライアントマシンは読み出しと 書き込み両方のアクセスを
このディレクトリに行います。
 - 
no_root_squash: デフォルトでは、 
root ユーザによるファイル要求は、 すべてサーバ上では 
nobody ユーザによってなされたものとして扱われます。 
(正確に言うと、要求の UID のマップ先はサーバにおける 
ユーザ "nobody" の UID に依存します。
クライアントの ものではありません。)
 - 
no_root_squash を選ぶと、 クライアントマシンの root は、 
サーバシステムでも root としての同じレベルのアクセスを 
サーバのファイルに行うことになります。 
これはセキュリティに多大な影響を及ぼす可能性がありますが、 
ライアントで行う管理作業にエクスポートされた
ディレクトリを 含めたいような場合には、これが必要になるでしょう。 
適切な理由がなければ、このオプションは指定すべきではありません。
 - 
no_subtree_check: ボリュームの一部だけをエクスポートする場合、 
subtree checking と呼ばれるルーチンが、 クライアントから
要求されたファイルが そのボリュームの適切な場所にあるかどうかを調べます。 
ボリューム全体をエクスポートする場合は、 このチェックを無効にしておくと
転送が高速になります。 
 
今回の/etc/exportsはこれでゆく
/home/nyan/ntarou 192.168.0.8(rw)
portmap 関連の 動作確認
server:~# ps ax | grep portmap
   54 ?        S      0:00 /usr/sbin/rpc.portmap
server:~# rpcinfo -p 
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100005    1   udp    665  mountd
    100005    1   tcp    668  mountd
    100005    2   udp    665  mountd
    100005    2   tcp    668  mountd
    100005    3   udp    665  mountd
    100005    3   tcp    668  mountd
    100003    2   udp   2049  nfs
    100021    1   udp  32770  nlockmgr
    100021    3   udp  32770  nlockmgr
マウント方法の例
mount master.foo.com:/home /mnt/home
今回は
mount -t nfs 192.168.0.5:/home/nyan/ntarou /mnt umount /mnt
nfsd の起動以降に /etc/exports を変更した場合は、exportfs コマンドでそれを NFS に伝えたでしょうか。 exports を確実に再読み込みさせるには、 exportfs -ra コマンドを入力しましょう。
/etc/exports を 修正 再読み込み
non@server:~/nfs$ cp /etc/exports .
non@server:~/nfs$ emacs exports &
server:~# cd /etc/
server:/etc# mv exports 015_exports 
server:/etc# diff -s exports 015_exports 
4d3
< /home/nyan/ntarou 192.168.0.8(rw)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
server:/etc# exportfs -ra
exportfs: /etc/exports [4]: No 'sync' or 'async' \
option specified for export "192.168.0.8:/home/nyan/ntarou".
  Assuming default behaviour ('sync').
  NOTE: this default has changed from previous versions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/etc/hosts.allow ファイル に portmap: 192.168.3.0/255.255.255.0 を追 記した、これで 192.168.0.8 側から マウント出来るはずだが
cliant:~# mount -t nfs 192.168.0.5:/home/nyan/ntarou/ /mnt/ mount: RPC: Unable to receive; errno = Connection refused cliant:~# rpcinfo -p 192.168.0.5 No remote programs registered.
No Remote Programs Registered というエラーが出たときは、 サーバの /etc/hosts.allow ファイルと /etc/hosts.deny ファイルを調べて、 クライアントのアクセスが本当に許可されているか確認してください ref portmap: 192.168.3.0/255.255.255.0
どうもこれではまずいよ うだ
non@server:~/nfs$ cp /etc/hosts.allow . non@server:~/nfs$ emacs hosts.allow & server:/etc# diff -s hosts.allow 016_hosts.allow 12d11 < ALL : 192.168.0.0/255.255.255.0: allow ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
サーバー側 の /etc/hosts.allow を 修正後 After /etc/hosts.allow Changed Server side
cliant:~# mount -t nfs 192.168.0.5:/home/nyan/ntarou/ /mnt/
cliant:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb2              4668476   2675720   1751784  61% /
/dev/hda6              1154276    324484    771160  30% /var/data
192.168.0.5:/home/nyan/ntarou/
                       4960464   2453072   2251344  53% /mnt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
マウント可能となる。
cliant:~# ls -l /mnt/
total 16
-rw-r--r--    1 non       users         188 Sep 25 09:07 exports
-rw-r--r--    1 non       root          407 Sep 25 09:50 hosts.allow
-rw-r--r--    1 non       users        3883 Sep 25 10:07 q_nfs001
drwxr-xr-x    4 root     root         4096 Sep 25 10:06 win_01/
cliant:~# mv /mnt/exports /home/non/public_html/5001_inst_html/801_nfs/
cliant:~# mv /mnt/hosts.allow /home/non/public_html/5001_inst_html/801_nfs/
cliant:~# mv /mnt/q_nfs001 /home/non/public_html/5001_inst_html/801_nfs/
cliant:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb2              4668476   2675740   1751764  61% /
/dev/hda6              1154276    324484    771160  30% /var/data
192.168.0.5:/home/nyan/ntarou/
                       4960464   2453392   2251024  53% /mnt
cliant:~# umount /mnt/
cliant:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hdb2              4668476   2675740   1751764  61% /
/dev/hda6              1154276    324484    771160  30% /var/data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
サーバー側で /etc/hosts.allowが portmap: 192.168.0.8 では 動作しない、 ので 変更した。これにより取り敢えずファイルの移動は可能となる。問題点と して/etc/hosts.allow の内容の見直し必要!