* NFSクライアント [#keabffbe]

** 前提 [#v0d570a1]
- OSはLinux CentOS6.3とする。
- nfsは標準パッケージを利用する。
- NFSサーバ192.168.1.100は/var/export/share01ディレクトリを公開している事とする。
- NFSクライアントは/var/mnt/share01に上の公開ディレクトリをマウントする事とする。

** nfsパッケージのインストール [#sdc7528c]
 yum install nfs-utils
 yum install autofs

** マウントポイント作成 [#hc97534f]
 mkdir -p /var/mnt/share01

** マウントする [#w015e4ec]
 mount -t nfs 192.168.1.100:/var/export/share01 /var/mnt/share01

** 起動時に自動的にマウントする1 - /etc/fstab [#eb52ae26]
 192.168.1.100:/var/export/share01    /var/mnt/share01   nfs    defaults 0 0
- defaultsはrw, suid, dev, exec, auto, nouser, asyncと等価。自動起動を止めるにはnoautoを指定する。
- fstabの記述の詳細はman fstabを参照する。

 The fifth field (fs_freq).
        This field is used for these filesystems by the dump(8) command to determine which filesystems need to  be  dumped.   If  the  fifth
        field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.
 
 The sixth field (fs_passno).
        This  field  is  used  by  the  fsck(8) program to determine the order in which filesystem checks are done at reboot time.  The root
        filesystem should be specified with a fs_passno of 1, and other filesystems should have a fs_passno  of  2.   Filesystems  within  a
        drive  will  be  checked  sequentially,  but filesystems on different drives will be checked at the same time to utilize parallelism
        available in the hardware.  If the sixth field is not present or zero, a value of zero is returned and fsck  will  assume  that  the
        filesystem does not need to be checked.

*** 参考 [#i392ead1]
- NFS クライアントの設定 https://access.redhat.com/site/documentation/ja-JP/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/s1-nfs-client-config.html

** 起動時に自動的にマウントする2 - autofs [#v515b37b]
*** /etc/auto.master [#y571fd48]
 /var/mnt /etc/auto.var.mnt
- auto.masterファイルにマウントポイントの親になるディレクトリ(/var/mnt)を指定する。さらにそのマウントポイントの詳細を記述するファイル名(/etc/auto.var.mnt)を指定する。
*** /etc/auto.var.mnt [#l4a53768]
 share01 -fstype=nfs 192.168.1.100:/var/export/share01
- 指定したauto.var.mntファイルにマウントポイントになるディレクトリ(share01)を指定し、マウント実行に必要な情報を指定する。
- これで、cd /var/mnt/share01 とすると、/var/mnt/share01がマウントされ、share01内のファイルを参照出来るようになる。

*** 参考 [#g904291e]
- autofs https://access.redhat.com/site/documentation/ja-JP/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/s1-nfs-client-config-autofs.html

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS