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:
/data/shares/rw 192.168.1.0/24(rw) /data/shares/ro 192.168.1.0/24(ro)
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=192.168.1.0/24 /data/shares/ro -ro -network=192.168.1.0/24
However, this just results in a single rw share and an error message in /var/log/messages:
mountd: can't change attributes for /data/shares/ro: netcred already exists for given addr/mask mountd: 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.
- Why does FreeBSD not allow multiple shares within the same overlapping network?
- Is this likely to be changed in the future, as it prevents valid use cases from being achieved?
- 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.