A. Configuring the NFS Server
Step 1A. Configure NFS Server, start the NFS service
Add the following lines to /etc/rc.conf
# ----------- add this to rc.conf ------
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 4"
mountd_flags="-r"
mountd_enable="YES"
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
# ----------- end ------------------------
Step 2A. Add the directories we want to share to /etc/exports
#vim /etc/exports
add:
/usr/home/fileserver/drive -maproot=root 10.0.0.10 10.0.0.20
/home/vmdk -network=10.105.0.0/16(rw) =>mount with subnet and permission (rw)
This will export /usr/home/fileserver/drive directory and allow other systems to access this partition as with root permisions.
If you omit -maproot=root parameter you will still see the partition from other systems but will be read only.
10.0.0.10 and 10.0.0.20 are machines that are allowed to mount NFS server resources.
Step 3A. Start the NFS server services
Do the following steps from command line, with root account
#rpcbind
#nfsd -u -t -n 4
#mountd -r
Important! After you change /etc/exports file you must reload mountd service.
You can acompilish that by doing:
#/etc/rc.d/mountd onereload
After you've followed all steps when debuging it is useful to look in /var/log/messages, usualy if something is not properly configured, messages from there will help you to debug easely.
B. Configuring the NFS Client
Step 1B. Add service in /etc/rc.conf to start as boot and start the NFS client
Add the following lines to /etc/rc.conf
# ----------- add (append) to /etc/rc.conf -----------------
nfs_client_enable="YES"
nfs_client_flags="-n 4"
#------------ end of file --------------------------------------
Start the NFS client:
#nfsiod -n 4
Step 2.B Mount NFS Server resource on client machine
#mount -v 10.0.0.5:/home/fileserver/drive /mnt/server
If you want this resource to be mounted automaticaly you can place a record in /etc/fstab.
If you are not sure if NFS Server will be available started) all the time you can mount the resource at boot, with a script, or you can use amd to automout the directory where the resource will be mounted.
====================================
http://www.freebsdonline.com/content/view/608/506/