FreeBSD8.1RでZFS(&NFS Export)
作成したZFSボリュームをNFSでExportしたときの記録です。
- FreeBSD8.1R
- ZFSボリューム名 tank
NFSサーバ機能とZFS機能がonに、ZFSボリュームのsharenfs機能がoffになっていることを確認します。
gauntlet# grep nfs /etc/rc.conf nfs_server_enable="YES" nfsv4_server_enable="YES" FreeBSD# grep ZFS /etc/rc.conf zfs_enable="YES" FreeBSD# zfs get sharenfs tank NAME PROPERTY VALUE SOURCE tank sharenfs off default
ZFSボリュームのプロパティでsharenfsをonにします。
gauntlet# zfs set sharenfs=on tank gauntlet# zfs get sharenfs tank NAME PROPERTY VALUE SOURCE tank sharenfs on local
mountdが自動でリロードされますので、showmount -eで確認します。
gauntlet# showmount -e Exports list on localhost: /tank Everyone
RPCにnfsdが登録されているかを確認します。
gauntlet# rpcinfo -p program vers proto port service 100000 4 tcp 111 rpcbind 100000 3 tcp 111 rpcbind 100000 2 tcp 111 rpcbind 100000 4 udp 111 rpcbind 100000 3 udp 111 rpcbind 100000 2 udp 111 rpcbind 100000 4 local 111 rpcbind 100000 3 local 111 rpcbind 100000 2 local 111 rpcbind 100005 1 udp 935 mountd 100005 3 udp 935 mountd 100005 1 tcp 935 mountd 100005 3 tcp 935 mountd gauntlet#
...おや?nfsdが登録されていません。/var/log/messageを見てみると以下のようなメッセージが。
gauntlet nfsd[1154]: Can't open /var/db/nfs-stablerestart
nfs-stablerestartがないらしいので、touchで作り、nfsdを再起動します。
gauntlet# touch /var/db/nfs-stablerestart gauntlet# /etc/rc.d/nfsd restart nfsd not running? Starting nfsd. gauntlet# rpcinfo -p program vers proto port service 100000 4 tcp 111 rpcbind 100000 3 tcp 111 rpcbind 100000 2 tcp 111 rpcbind 100000 4 udp 111 rpcbind 100000 3 udp 111 rpcbind 100000 2 udp 111 rpcbind 100000 4 local 111 rpcbind 100000 3 local 111 rpcbind 100000 2 local 111 rpcbind 100005 1 udp 935 mountd 100005 3 udp 935 mountd 100005 1 tcp 935 mountd 100005 3 tcp 935 mountd 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs gauntlet#