User Tools

Site Tools



Build NFS Server


NOTE: the following is very lame. It allows anyone who can access the NFS share full read/write permissions. At the very least, you should limit the servers which can access the share in the second line of the exports file.

Code to set up server

# create the exports file
echo 'V4: /' >> /etc/exports
echo '/media/nfs -alldirs' >> /etc/exports
# enable (but don't start) NFSv4 daemon
echo 'nfs_server_enable="YES"' >> /etc/rc.conf
echo 'nfsv4_server_enable="YES"' >> /etc/rc.conf
echo 'nfsuserd_enable="YES"' >> /etc/rc.conf
echo 'rpcbind_enable="YES"' >> /etc/rc.conf
echo '# allow regular files to be mounted' >> /etc/rc.conf
echo 'mountd_flags="-r"' >> /etc/rc.conf
echo 'mountd_enable="YES"' >> /etc/rc.conf
# create a place to store the NFS exported data
mkdir /media/nfs
zfs create -o atime=off -o mountpoint=/media/nfs -o readonly=off storage/nfs
# note, zfs has an nfs parameter that we are not using here
# it uses zfs' way of creating and nfs share, basically using
# zfs set sharenfs=parameter,parameter,...
# takes over for the the exports file
chmod 777 /media/nfs
# start (or restart) the service
service nfsd restart
unix/freebsd/system_builds/nfsserver.txt · Last modified: 2019/03/01 22:52 by rodolico