UNFS3(User-space NFSv3 Server)

NFSサーバ側のセットアップ

UNFS3のインストール

 wget http://packages.sw.be/unfs3/unfs3-0.9.22-1.el5.rf.x86_64.rpm
 rpm -ivh unfs3-0.9.22-1.el5.rf.x86_64.rpm

起動スクリプトの作成

/etc/rc.d/init.d/unfsd:

 #!/bin/bash
 # -*- mode: shell-script; coding: UTF-8 -*-
 #
 # chkconfig: 235 99 10
 # description: Start or stop the unfs3 server
 #
 ### BEGIN INIT INFO
 # Provides: unfsd
 # Required-Start: $network
 # Required-Stop: $network
 # Default-Start: 2 3 4 5
 # Default-Stop: 0 1 6
 # Description: Start or stop the unfs3 server
 ### END INIT INFO
 
 description="unfs3 NFS server"
 lockfile="/var/lock/subsys/unfsd"
 pidfile="/var/run/unfsd.pid"
 
 case "$1" in
 'start')
 echo "Starting" ${description}
 /usr/sbin/unfsd -i ${pidfile}
 RETVAL=$?
 if [ "${RETVAL}" = "0" ]; then
 touch ${lockfile} >/dev/null 2>&1
 fi
 ;;
 'stop')
 echo "Shutting down" ${description}
 if [ -s ${pidfile} ]; then
 pid=`cat ${pidfile}`
 kill -TERM ${pid} 2>/dev/null
 sleep 2
 if kill -0 ${pid} 2>/dev/null; then
 kill -KILL ${pid}
 fi
 fi
 rm -f ${lockfile} ${pidfile}
 ;;
 'status')
 if [ -s ${pidfile} ]; then
 pid=`cat ${pidfile}`
 if kill -0 ${pid} 2>/dev/null; then
 echo "${description} (pid ${pid}) is running"
 RETVAL=0
 else
 echo "${description} is stopped"
 RETVAL=1
 fi
 else
 echo "${description} is stopped"
 RETVAL=1
 fi
 ;;
 'restart')
 $0 stop && $0 start
 RETVAL=$?
 ;;
 'condrestart')
 [ -f /var/lock/subsys/unfsd ] && $0 stop &&
 $0 start
 RETVAL=$?
 ;;
 *)
 echo "Usage: $0 {start|stop|restart|condrestart|status}"
 RETVAL=1
 ;;
 esac
 exit $RETVAL

公開ディレクトリの作成と設定

 mkdir /export/share01

/etc/exports:

 /export/share01 192.168.0.0/24(rw,sync,all_squash,anonuid=5000,anongid=5000)
  • anonuid=5000,anongid=5000 → サーバ群で共通のUID/GIDなユーザを作成しておく。
  • all_squash → ファイルオーナーを指定したユーザにする。

NFSツールのインストール

 yum install nfs-utils

NFSサーバ起動設定と起動

 chkconfig unfsd on
 chkconfig portmap on
 service portmap start
 service unfs start

NFSクライアント側のセットアップ

NFSツールのインストール

 yum install nfs-utils

マウントポイントの作成

 mkdir /mnt/share01

ファイルシステムのマウント設定

 192.168.0.10:/export/share01  /mnt/share01 nfs  bg,nfsvers=3,proto=tcp,intr,rsize=65536,wsize=65536 0 0

NFSクライアント起動設定と起動

 chkconfig portmap on
 chkconfig netfs on
 service portmap start
 service netfs start

NFS公開ディレクトリのマウント

 mount -t nfs 192.168.0.10:/export/share01 /mnt/share01

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

Last-modified: 2011-11-08 (火) 05:09:34