Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jan 2010 00:36:52 +0100
From:      Marco van Tol <marco@tols.org>
To:        freebsd-fs@freebsd.org
Subject:   Re: zfs sharenfs to multiple subnets - found a dirty looking hack
Message-ID:  <20100101233652.GA1111@donald.home.tols.org>
In-Reply-To: <20091229012443.GF43739@cicely7.cicely.de>
References:  <20091228225228.GA1114@donald.home.tols.org> <20091229012443.GF43739@cicely7.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 29, 2009 at 02:24:44AM +0100, Bernd Walter wrote:
> On Mon, Dec 28, 2009 at 11:52:28PM +0100, Marco van Tol wrote:
> > Hi there,
> > 
> > I would like to refer to a thread in this list about zfs exporting to
> > multiple subnets using sharenfs.  The thread I mean is this one:
> > http://lists.freebsd.org/pipermail/freebsd-fs/2008-September/005158.html
> > I wasn't subscribed at the time, so I'm just referencing to the thread.
> > 
> > I was testing and needed to also export a filesystem to multiple subnets,
> > and found something out that may or may not be allowed.
> > 
> > What happens is you start to type
> > zfs set sharenfs="<arguments>
> > and don't close the double quote.  The result on the following lines will
> > literally make it to /etc/zfs/exports, and make it work as desired.
> > 
> > A full session would look like: 
> > (Bear with me for typo's, I didn't copy-paste)
> > 
> > zfs set sharenfs="-maproot=root -network 10.0.0.0/24
> > > /path/to/mountpoint	-maproot=root -network 192.168.0.0/24
> > > /path/to/mountpoint	-maproot=root -network 172.16.0.0/24"	pool0/space
> > 
> > This translates to an /etc/zfs/exports like:
> > ----< cut here >----
> > /path/to/mountpoint	-maproot=root -network=10.0.0.0/24
> > /path/to/mountpoint	-maproot=root -network=192.168.0.0/24
> > /path/to/mountpoint	-maproot=root -network=172.16.0.0/24
> > ----< cut here >----
> > 
> > The resulting "zfs get sharenfs" looks like:
> > ----< cut here >----
> > pool0/space	sharenfs	-maproot=root -network=10.0.0.0/24
> > /path/to/mountpoint	-maproot=root -network=192.168.0.0/24
> > /path/to/mountpoint	-maproot=root -network=172.16.0.0/24	local
> > ----< cut here >----
> > 
> > This all makes it work so that it exports the pool to multiple subnets,
> > possibly with their own properties.
> > 
> > Question is however, how desirable is it that this works? ;-)
> 
> The really cool thing about using zfs property instead of manual
> exports line is the ability to inherit export options, but since
> you need to write the path into the argument...

True.

> It would be nice however if the export-file creator would parse the
> newline and automatically prepend the path to each line.

Mm well, to be really honest, it would be nice to be able to export to
multiple subnets through the use of zfs properties in a documented and
supported way. :-)

For all those experimenting with the hack I wrote above, make sure you write
the /path/to/mountpoint without typo's.  If you do for starters it won't
have the desired effect, and for two if you change the property again your
/etc/zfs/exports file is screwed.

Just thought I should mention it. ;-)

Marco

-- 
Nothing takes the past away like the future
- Madonna in Nothing Really Matters



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100101233652.GA1111>