Long time Linux user, I've been trying out FreeBSD for a new NAS server.

On the Linux server that is being replaced, I have a pair of NFS mounts, the first read-write and a second read-only. The physical location of the shared folders is on the same RAID file system.

The idea of this approach is to stage new files via the rw share, then an administrator subsequently moves the staged files to the ro share, for future access and no risk of deletion.

On Linux (with /dev/md0 mounted at /data/shares), the /etc/exports file would be something like:


When setting up FreeBSD, I created a root ZFS raidz2 pool at /data:

zpool create data raidz2 /dev/ada0 /dev/ada1 /dev/ada2 /dev/ada3 /dev/ada4

and then the shares dataset at /data/shares:

zfs create data/shares

I then created a similar /etc/exports file with FreeBSD syntax for the shares:

/data/shares/rw -network=
/data/shares/ro -ro -network=

However, this just results in a single rw share and an error message in /var/log/messages:

mountd[63092]: can't change attributes for /data/shares/ro: netcred already exists for given addr/mask
mountd[63092]: bad exports list line '/data/shares/ro -ro -network'

Further research reveals that the FreeBSD NFS documentation says the following.

A client can only be specified once per file system. For example, if /usr is a single file system, these entries would be invalid as both entries specify the same host:

# Invalid when /usr is one file system
/usr/src   client
/usr/ports client

The correct format for this situation is to use one entry:

/usr/src /usr/ports  client

However, this syntax does not work, as the two entries will have the same configuration, i.e. both will be read-write or both will be read-only.

It thus appears that:

  • Linux NFS configures at the share level for each client host;
  • FreeBSD NFS configures on the entire file system for each client host.

This appears to be leading to a dead end. The only way to achieve this use case is via different ZFS datasets (something I want to avoid).

In conclusion, some questions.

  1. Why does FreeBSD not allow multiple shares within the same overlapping network?
  2. Is this likely to be changed in the future, as it prevents valid use cases from being achieved?
  3. Are there any work arounds to this, other than using multiple ZFS datasets?

Perhaps this question will not result in any satisfactory resolution to the problem, but at least it will be available for others that may run into the same issue when migrating from Linux to FreeBSD.

  • Your surmisal is generally correct: FreeBSD exports filesystems, not merely directories. I'm not sure I entirely understand your intent, but you might make the RW share a real ZFS filesystem, and make the RO share a mounted snapshot of the filesystem. Why does the RW share need to duplicate the files already present in the RO share?
    – Jim L.
    Aug 27 '20 at 20:58

Ok. So "why"? Because mountd manages filesystems. While an NFS client can request a director (if permitted), the mountd code only keeps track of the filesystems.

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.