NFS

Server

create folder for exporting

mkdir -p /home/nfs/public /home/nfs/private

vi /etc/exports

/home/nfs/public -maproot=root -network=140.116.245.193/26
/home/nfs/private -maproot=root -ro -network=140.116.245.193/26

everytime exports is edited, use service mountd reload to reload

if ufs is used, without adding new disk, bind folder to folder like so:

mkdir -p /var/nfs/public
mkdir -p /var/nfs/private
vi /etc/fstab

add following content to fstab, and remount by doing mount -a

/var/nfs/public  /usr/home/nfs/public  nullfs rw 0 0
/var/nfs/private /usr/home/nfs/private nullfs rw 0 0

if zfs is used, edit exports at /etc/zfs/exports, the exported path needs to be zfs dataset.

zfs create zroot/usr/home/nfs
zfs create zroot/usr/home/nfs/public
zfs create zroot/usr/home/nfs/private

service config

add following to rc.conf

rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_enable="YES"
mountd_flags="-r"

start service

start nfs server

service nfsd start

Client

sysrc nfs_client_enable="YES"

Start NFS client

service nfsclient start

add following content into /etc/fstab

# nfs
10.0.15.31:/home/nfs/public  /home/nfs/public	nfs       	rw,vers=3,proto=tcp 0 0
10.0.15.31:/home/nfs/private /home/nfs/private  nfs       	rw,vers=3,proto=tcp 0 0

create directory to be mount

mkdir -p /home/nfs/public /home/nfs/private
showmount <servername> -e