freeBSD13 NFS share

Hello everyone. Can someone tell me what is wrong with my /etc/export which looks like this
Code:
/pub    -mapall=nfsshare    -alldirs
And when I try to mount from MacOSX somehow mount not "/pub" folder but "/" and in read-only mode. What is wrong? Thanks in advance
 
Last edited by a moderator:
I have a very bright idea - if my current file system is ZFS then should I use zfs share export file /etc/zfs/export?
 
Here is the export for a fileserver on my network.
/etc/export
Code:
/files -maproot=root -network 192.168.0.0/16
This shares /files directory across my network as NFS.
mount
/dev/mirror/gm0p1 on /files (ufs, NFS exported, local, soft-updates)

You need to have rpc and other stuff running too.
/etc/rc.conf
Code:
### NFS Server ###
rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_flags="-rn"
mountd_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
#
### NFS Client ####
#nfs_client_enable="YES"
#nfs_client_flags="-n 4"
#rpc_lockd_enable="YES"
#rpc_statd_enable="YES"
#

I use UFS on my fileservers. They are just small embedded boxes with 2TB SSD mirrored.
None of this is exposed to the outside world.

I dunno about zfs or Mac.
 
Nothing helped ((( Finaly I reinstalled OS with UFS instead of ZFS and simple NFS with /etc/export works correctly
 
Nothing helped ((( Finaly I reinstalled OS with UFS instead of ZFS and simple NFS with /etc/export works correctly
Sorry about that.
Klarasysyems did explain it.

For example, this line from /etc/exports:

/usr/ports -maproot=root 192.168.15.0/24
is equivalent to this command:

zfs set sharenfs=’on,-maproot=root,192.168.15.0/24’ mypool/usr/ports

ZFS filesystems use 'zfs set...' The former/first is for UFS. There is a file in /etc where one defines the authorized IPs or networks too. Not hosts!
 
I'm glad someone else is having the same problem on 13. I've just migrated a server to 13.2 and I can't get NFS shares to work at all on ZFS. Was OK on 12.0 to 12.1, it was mothballed for a physical move so never got updated beyond 12.1 .

To set NFS sharing on my ZFS pool...

sudo zfs set sharenfs='on,rw=192.168.1.0/24,-alldirs' zroot/iocage/jails/wormwood/root

The relevant bit in /var/log/messages shows:

Code:
Apr 24 02:10:42 hp2 mountd[86829]: can't get address info for host on
Apr 24 02:10:42 hp2 mountd[86829]: bad host on, skipping
Apr 24 02:10:42 hp2 mountd[86829]: can't get address info for host rw=192.168.1.0/24
Apr 24 02:10:42 hp2 mountd[86829]: bad host rw=192.168.1.0/24, skipping
Apr 24 02:10:42 hp2 mountd[86829]: bad exports list line '/zroot/iocage/jails/wormwood/root    on rw=192.168.1.0/24 -alldirs': no valid entries

To check shares on my ZFS pool...

Code:
sudo zfs get sharenfs | grep on
zroot/iocage/jails/wormwood/root                                  sharenfs  on,rw=192.168.1.0/24,-alldirs  local
 
Ihts'm glad someone else is having the same problem on 13. I've just migrated a server to 13.2 and I can't get NFS shares to work at all on ZFS. Was OK on 12.0 to 12.1, it was mothballed for a physical move so never got updated beyond 12.1 .

To set NFS sharing on my ZFS pool...

sudo zfs set sharenfs='on,rw=192.168.1.0/24,-alldirs' zroot/iocage/jails/wormwood/root

The relevant bit in /var/log/messages shows:

Apr 24 02:10:42 hp2 mountd[86829]: can't get address info for host on Apr 24 02:10:42 hp2 mountd[86829]: bad host on, skipping Apr 24 02:10:42 hp2 mountd[86829]: can't get address info for host rw=192.168.1.0/24 Apr 24 02:10:42 hp2 mountd[86829]: bad host rw=192.168.1.0/24, skipping Apr 24 02:10:42 hp2 mountd[86829]: bad exports list line '/zroot/iocage/jails/wormwood/root on rw=192.168.1.0/24 -alldirs': no valid entries

To check shares on my ZFS pool...

sudo zfs get sharenfs | grep on zroot/iocage/jails/wormwood/root sharenfs on,rw=192.168.1.0/24,-alldirs local
That's the way to go.
 
I am glad that I am not alone with this problem. I have tried a variety of quoted options for the sharenfs options list but I always get 'bad host' in the log.

Using documentation from:

I will try each of the following exports in turn later:

zfs set sharenfs=on zdata/usr/rwtest
zfs set sharenfs=ON zdata/usr/rwtest
zfs set sharenfs="-alldirs,-maproot=root,-network=192.168.1.0/24" zdata/usr/rwtest
zfs set sharenfs=’on,-maproot=root,192.168.1.0/24’ zdata/usr/rwtest
zfs set sharenfs='ON,-maproot=root,192.168.1.0/24’ zdata/usr/rwtest
zfs set sharenfs=’on,-maproot=root,192.168.1.0/24’ zdata/usr/
zfs set sharenfs='on,ro=192.168.1.0/24,-alldirs' zdata/rotest
zfs set sharenfs='on,ro=192.168.1.0/24,-alldirs' zdata/usr/rotest
zfs set sharenfs='on,ro=192.168.1.0/24,-alldirs' /zroot/iocage/jails/wormwood/root/rotest
zfs set sharenfs='on,rw=192.168.1.0/24,-alldirs' zdata/rwtest
zfs set sharenfs='on,rw=192.168.1.0/24,-alldirs' zdata/usr/rwtest
zfs set sharenfs='on,rw=192.168.1.0/24,-alldirs' /zroot/iocage/jails/wormwood/root/rwtest
zfs set sharenfs='on,192.168.1.86' zdata/rwtest
zfs set sharenfs='on,192.168.1.86' zdata/usr/rwtest
zfs set sharenfs='on,192.168.1.86' /zroot/iocage/jails/wormwood/root/rwtest
 
sudo zfs set sharenfs='on,rw=192.168.1.0/24,-alldirs' zroot/iocage/jails/wormwood/root

The relevant bit in /var/log/messages shows:
Apr 24 02:10:42 hp2 mountd[86829]: bad exports list line '/zroot/iocage/jails/wormwood/root on rw=192.168.1.0/24 -alldirs': no valid entries

You get "bad exports list line" because of <ip>/prefix. It requires the "network" flag:
Code:
zfs set sharenfs=network=192.168.1.0/24,alldirs zroot/iocage/jails/wormwood/root
 
  • Thanks
Reactions: vmb
You get "bad exports list line" because of <ip>/prefix. It requires the "network" flag

Thanks, that worked!
I guess 'on' isn't required if 'network=" is specified.
I am certain yesterday that I tried '-network=" and it didn't work with or without 'on' being specified.
I guess the Handbook could do with some improvement with some more examples.
 
Checking the history, every time I used '-network' I also had the 'on,' keyword present and they didn't work together.
Leaving out 'on,' and using 'network=' instead of '-network=' works.
 
My current setting:
/etc/exports:
Code:
/tank/share -mapall=shareuser,network 192.168.XX/24
/backup/TimeMachine -mapall=shareuser,network 192.168.XX/24
V4: /
And /etc/rc.conf:
Code:
###NFS
rpcbind_enable="YES"
rpcbind_flags="-h 192.168.xx.xx"
mountd_enable="YES"
mountd_flags="-h 192.168.xx.xx"
nfs_server_enable="yes"
nfs_server_flags="-u -t -h 192.168.xx."
nfsv4_server_enable="YES"
Works well under FeeBSD 13 and MacOS 13. Didn't touch anything regarding ZFS.

But I given up using NFS because can't make NFS share automount worked under macos.
 
I realize this thread is over a year old, but having just run into a similar issue which lead me to this thread, I just wanted to point something out.

Code:
zfs set sharenfs="blah blah,-network=192.168.0.0/24" tank/test

produced this in /etc/zfs/exports

Code:
/tank/test  blah blah -network 192.168.0.0

It threw out the netmask, but...

Code:
zfs set sharenfs="blah blah,-network=192.168.0.0,-mask=255.255.255.0" tank/test

Produces the correctly formed entry of...

Code:
/tank/test  blah blah -network 192.168.0.0 -mask 255.255.255.0

...in /etc/zfs/exports and everything works. So I'm not sure using the "/" CIDR in the "network" notation is correct or reliable.
 
Back
Top