- OpenVZのVPSで動かすNFSサーバ | おもむくがままにを参考。
-
RPM resource unfs3(x86-64)
- unfs3-0.9.22-2.el6.rf.x86_64.rpm
- unfs3-0.9.22-2.el5.rf.x86_64.rpm
- unfs3-0.9.22-1.el5.rf.i386.rpm
/etc/exports
/var/log 192.168.11.0/24(ro,async,no_root_squash)
/tmp 192.168.11.0/24(ro,async,no_root_squash)
syntaxチェック
$ /usr/sbin/unfsd -T
- 何も出力されなければOK
unfsd起動
$ sudo service portmap start
$ sudo /usr/sbin/unfsd
/etc/rc.localにスタートアップ登録
/usr/sbin/unfsd -T && runuser -l root -c "/usr/sbin/unfsd"
設定ファイル作った
puppet
class unfs3::centos5() {
package { ['unfs3']:
ensure => installed,
}
service { 'portmap':
ensure => running,
enable => true,
}
file { '/etc/exports':
owner => 'root',
group => 'root',
mode => 644,
notify => Reload['unfs3'],
source => "puppet:///etc/exports";
}
file { '/etc/init.d/unfs3':
owner => 'root',
group => 'root',
mode => 755,
source => "puppet:///etc/init.d/unfs3";
}
file { ['/etc/rc0.d/K86unfs3',
'/etc/rc1.d/K86unfs3',
'/etc/rc2.d/S14unfs3',
'/etc/rc3.d/S14unfs3',
'/etc/rc4.d/S14unfs3',
'/etc/rc5.d/S14unfs3',
'/etc/rc6.d/K86unfs3']:
ensure => link,
target => '/etc/init.d/unfs3',
}
reload { 'unfs3':
command => '/usr/sbin/unfs3 -T && /etc/init.d/unfs3 restart',
}
}
/etc/init.d/unfs3
# !/bin/sh
unfsd_configtest() {
if [ ! -r /etc/exports ]; then
exit
elif ! grep -v -e '^#' -e '^$' /etc/exports | grep -q '/' ; then
exit # no uncommented shares in /etc/exports
fi
if [ -x /usr/sbin/unfsd ]; then
/usr/sbin/unfsd -T
fi
}
unfsd_start() {
unfsd_configtest
echo -n "Starting UNFS server daemon(s):"
if [ -x /sbin/portmap ]; then
if ! ps axc | grep -q portmap ; then
echo -n " /sbin/portmap"
/sbin/portmap
fi
if [ -x /usr/sbin/unfsd ]; then
echo " /usr/sbin/nfsd"
/usr/sbin/unfsd
fi
else
echo "WARNING: Cannot start RPC portmapper daemon needed for UNFS."
echo " /sbin/portmap (a required daemon) is not executable"
echo " or is not present on your system."
echo
fi
}
unfsd_stop() {
echo "Stopping UNFS server daemon..."
killall unfsd 2> /dev/null
sleep 1
killall -9 unfsd 2> /dev/null # make sure :)
}
unfsd_restart() {
unfsd_stop
sleep 1
unfsd_start
}
case "$1" in
'start')
unfsd_start
;;
'stop')
unfsd_stop
;;
'restart')
unfsd_restart
;;
'configtest')
unfsd_configtest
;;
*)
echo "usage $0 start|stop|restart|configtest"
esac