Multiple entries in ZFS "sharenfs" property?

Willem Jan Withagen wjw at digiware.nl
Sun Aug 2 20:56:49 UTC 2015


On 2-8-2015 20:08, Lev Serebryakov wrote:
> Hello Willem,
> 
> Sunday, August 2, 2015, 1:49:54 PM, you wrote:
>>>   Is it possible to put multiple entries (for multiple networks) into
>>> "sharenfs" property for ZFS filesystem?
> 
>> Something like?
>>          
>> I think I just did it by putting the text between '' 's:
>>         ' <volume>
> 
>> Which then ends up in /etc/zfs/exports:
>> /home/wjw  -alldirs -maproot=0 -network 192.168.10.0 -mask 255.255.252.0
>  I need 4 such lines per FS (with different -network / -mask arguments). One line works. Four lines don't.

Hi Lev,

Nope, that doesn't work, as far as I can tell.
You'd have to revert to editting /etc/exports.

Or hack on 'zfs set sharenfs' to generate multiple lines, in some sort
of format. Like making ';' a line separator, and then prefix each part
with the volume we are modifying.

Place to give it a go are in:
cddl/compat/opensolaris/misc/fsshare.c:213
        if (share) {
                fprintf(newfd, "%s\t%s\n", mountpoint,
                    translate_opts(shareopts));
        }
And there split the shareopts on the split char (eg. ';') in several
shareopts and then loop over them. Disadvantage is that the max length
op the options is: MAXPATHLEN. So you can easily run out of space if you
have many exports to do.

-WjW




More information about the freebsd-fs mailing list