How to allow RO and RW setting for NFS share at the same time for subnet and IP on this subnet?

OS Version:TrueNAS-SCALE-24.04.2

Can’t add the same folder to NFS share twice for

10.0.0.0/24 - RO
10.0.0.22/32 - RW

Custom NFS options not available in GUI.

P.S. TrueNAS-CORE allows you to add the same folder to the NFS share twice.

I’m doing exactly that via the WebUI on True Nas Scale.

What error are you seeing?

I found that for IPs is works, but for network and IP error about overlap:

ERROR - This or another NFS share exports /mnt/mdata/NFS/test to 10.0.0.0/24 and overlaps host 10.0.0.22 (host IP: 10.0.0.22)

on CORE
cat /etc/exports:

/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.0/24
/mnt/mdata/nfs/test -maproot="root" 10.0.0.22

Ah yes. You can’t have overlaps.
For example I wanted two addresses in my /24 to have rw and all others to have ro. It isn’t possible via the WebUI

1 Like

You can maybe cheat this by breaking up the subnet in the statements here, kinda jank, but should work.

/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.0/29  # .0 to .7
/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.8/30  # .8 to .11
/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.12/30 # .12 to .15
/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.16/30 # .16 to .19
/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.24/29 # .24 to .31
/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.32/26 # .32 to .63
/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.64/26 # .64 to .127
/mnt/mdata/nfs/test -ro -maproot="root" -network 10.0.0.128/25 # .128 to .255

# Specific read-write rule for .22
/mnt/mdata/nfs/test -maproot="root" 10.0.0.22                # Read-write access for .22

You’ll miss some IPs in there, specifically 20,21 and 23 would not be able to mount. You can add them individually.

But in the exports file, you should be able to cheat this way as it has no idea what your routing table looks like and doesn’t care what the clients netmask is IIRC.

1 Like