NFSクライアント

前提

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

nfsパッケージのインストール

 yum install nfs-utils
 yum install autofs

マウントポイント作成

 mkdir -p /var/mnt/share01

マウントする

 mount -t nfs 192.168.1.100:/var/export/share01 /var/mnt/share01

起動時に自動的にマウントする1 - /etc/fstab

 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.

参考

起動時に自動的にマウントする2 - autofs

/etc/auto.master

 /var/mnt /etc/auto.var.mnt
  • auto.masterファイルにマウントポイントの親になるディレクトリ(/var/mnt)を指定する。さらにそのマウントポイントの詳細を記述するファイル名(/etc/auto.var.mnt)を指定する。

/etc/auto.var.mnt

 share01 -fstype=nfs 192.168.1.100:/var/export/share01
  • 指定したauto.var.mntファイルにマウントポイントになるディレクトリ(share01)を指定し、マウント実行に必要な情報を指定する。
  • これで、cd /var/mnt/share01 とすると、/var/mnt/share01がマウントされ、share01内のファイルを参照出来るようになる。

参考


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

Last-modified: 2017-10-23 (月) 12:27:08