zfs sharenfs

Hi all,

I am playing with zfs sharenfs and I came across a problem. Unless I put a single host/network, I don't get any export after showmount -e
I presume because the syntax is not quite right... What I need to do is to export:

Code:
/media 192.168.3.0/24 192.168.4.3 192.168.4.21

So not just a network, but also some other hosts. Is it possible to do this with zfs feature? What I tried is the following:

Code:
zfs set sharenfs="-network=192.168.3.0,-mask=255.255.255.0,-alldirs,192.168.4.2" stuff/installs

But it doesn't like it.
 
You don't need commas. Try the following:

Code:
zfs set sharenfs="-alldirs -network=192.168.3.0/24 192.168.4.2" stuff/installs
 
Ok, it doesn't work because it's invalid export syntax.

Code:
zfs set sharenfs="-alldirs -network=192.168.3.0/24" stuff/installs

This works for me, but I don't know how you are going to handle the single host. Nevertheless this has nothing to do with the sharenfs property per se, we need someone with more experience in the syntax.
 
  • Thanks
Reactions: Oko
Hmm, the man page doesn't list a "=" sign in the network spec. If I understand the sharenfs property, whatever syntax /etc/exports handles should work in zfs set sharenfs="..." on a "per line" basis.

man exports said:
/u2 -maproot=root friends
/u2 -alldirs -network cis-net -mask cis-mask

Looks like in /etc/exports you would create two lines. One specifying the range of addresses to export to and another line to specify any singular hosts. Try issuing two, separate zfs set sharenfs="..." commands.
 
sharenfs only works for the "simple" case, as it only holds a single line of text, and thus, only generates a single line in the /etc/zfs/exports file.

If you want to do anything involving more than 1 line of text in an exports(5) file, then you need to do it manually via /etc/exports
 
phoenix said:
sharenfs only works for the "simple" case, as it only holds a single line of text, and thus, only generates a single line in the /etc/zfs/exports file.

If you want to do anything involving more than 1 line of text in an exports(5) file, then you need to do it manually via /etc/exports

This makes sense.
Unfortunately if you run zfs set... only the last one would be valid.
 
Code:
myhost 17:16 [/root] -root- zfs set sharenfs="-alldirs -network=192.168.0.0/17" softnext/data
Unsupported share protocol: 1.
myhost 17:18 [/root] -root- zfs list
NAME            USED  AVAIL  REFER  MOUNTPOINT
softnext        185G  39.6G   449M  /
softnext/data  8.55G   197G  8.55G  /data
softnext/home   164K  39.6G   164K  /home
softnext/usr   1.32G  39.6G  1.32G  /usr
softnext/var   86.2M  39.6G  86.2M  /var
Didn't work to me :D
 
Back
Top