Using FreeBSD 9, and created a ZFS file system like so

zfs create tank/project1
zfs set sharenfs=on tank/project1

There are many howto's on setting up NFSv3 on FreeBSD on the net, but I can't find any one NFSv4 and when the NFS share is done with ZFS.

E.g. this howto say I have to restart the (NFSv3) by nfsd -u -t -n 4, but I don't even have nfsd.

When I do

# echo /usr/ports/*/*nfs*
/usr/ports/net-mgmt/nfsen /usr/ports/net/nfsshell /usr/ports/net/pcnfsd /usr/ports/net/unfs3 /usr/ports/sysutils/fusefs-chironfs /usr/ports/sysutils/fusefs-funionfs /usr/ports/sysutils/fusefs-unionfs

I don't see any NFSv4 servers, which I could install with pkg_add.


How do I install and setup NFSv4, so I can mount the share from e.g. a Linux host?

1 Answer 1


NFSv4 is built in on FreeBSD (Experimental support in 8.x, production quality in 9.x and lter).
The nfsd should be located in /etc/rc.d/nfsd

You should first enable it within rc.conf file or running /etc/rc.d/nfsd onestart

1) Enable nfs
echo nfs_server_enable="YES" >> /etc/rc.conf

For NFSv4 you will also need the following:

echo nfsv4_server_enable="YES" >> /etc/rc.conf (To enable NFSv4)
echo nfsuserd_enable="YES" >> /etc/rc.conf (The NFS user/group info needed for v4)

2) Create directories and export them

# mkdir -p /mnt/{dir1,dir2}
# vi /etc/exports 

(add the following lines to the /etc/exports file)

/mnt/dir1  -alldirs  192.168.1.x/24
/mnt/dir2  -alldirs  192.168.1.x/24

3) restart nfsd either using /etc/rc.d/nfsd restart or service nfsd restart

See The section of the FreeBSD handbook dealing with NFS for more information.

  • 1
    This works perfectly fine with BSD FFS / UFS. It doesn't answer the question for ZFS though, unless I'm very mistaken. Sep 29, 2021 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.