Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Sep 2010 14:01:08 +0300
From:      Gleb Kurtsou <gleb.kurtsou@gmail.com>
To:        Phillip Nordwall <phillip.nordwall@gmail.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: ZFS mount_unionfs or ZFS overlay
Message-ID:  <20100903110107.GA2084@tops>
In-Reply-To: <AANLkTimFTBJGsGitgT%2Bs6fHuczQ=QY_RV7yxELDxAYUz@mail.gmail.com>
References:  <AANLkTimFTBJGsGitgT%2Bs6fHuczQ=QY_RV7yxELDxAYUz@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On (02/09/2010 14:45), Phillip Nordwall wrote:
> I'm trying to do a mount_unionfs of a zfs file system over another
> filesystem and am getting an Operation not supported. If I try to do a zfs
> mount -O (for an overlay) I get the following error: no overlay mounts
> support on FreeBSD, ignoring.
> 
> I'm thinking about digging into the code (guided by The Design and
> Implementation of the FreeBSD Operating Sytem) to find out how to make zfs
> union mounts work, but I figured I should ask here if there is a good reason
> why it is not currently implemented.
> 
> My goal is to have the following mount setup.
> 
> tank0/base on /zmnts/base (zfs, local)
> tank0/www on /zmnts/www (zfs, local)
> tank0/web0 on /zmnts/web0 (zfs, local)
> tank0/web1 on /zmnts/web1 (zfs, local)
> .
> .
> .
> tank0/webn on /zmnts/webn (zfs, local)
> /zmnts/base on /jails/base (nullfs, local)
> /jails/base on /jails/www (nullfs, local, read-only)
> <above>:/zmnts/www on /jails/www (unionfs, local)
> 
> /jails/www on /jails/web0 (nullfs, local, read-only)
> <above>:/zmnts/web0 on /jails/web0 (unionfs, local)
> /jails/www on /jails/web1 (nullfs, local, read-only)
> <above>:/zmnts/web1 on /jails/web1 (unionfs, local)
> .
> .
> .
> 
> /jails/www on /jails/webn (nullfs, local, read-only)
> <above>:/zmnts/webn on /jails/webn (unionfs, local)
> 
> 
> This would allow me to have a hierarchy of "inherited" jails where I could
> update any level and the levels below it would be updated, but also allow
> each level to override any or all files from a higher level.  It also would
> allow for snapshotting any level, cloning it, performing a union mount below
> another level followed by the unmounting of a level it is now over. This
> gives much more power than just using a single nullfs layer.
> 
> If you have any reason why I shouldn't do this, please let me know.
If you are going to implement it I'd suggest to look at implementing
per-jail private mounts.

What I suggest is that each jail has /zmnts/base on it's root (mounted
in root jail) and private /zmnts/www, i.e jailN has tank0/webN mounted
on /zmnts/www. The jail should have deadfs mounted on /zmnts/www if
nothing was mounted (to simplify implementation). It's a bit different
from your setup and there would be no union mounts but it would let you
avoid nullfs overhead.

The only drawback is that filesystem can be mounted only once, and you
would have to mount snapshots to perform administrative tasks on
tank0/webN, or add support for multiple mounts to zfs, or develop a
stacked pseudo filesystem to show all private mounts under /zmnts/www in
root jail.

I was told that "somebody" is likely to be already working on it, but
wasn't able to find who is it. I'm going to implement it myself, but
busy with other tasks, unless someone is willing to sponsor it.

Thanks,
Gleb.
> 
> Philip Nordwall
> Senior Systems Analyst/Programmer
> Computer Science Department
> Western Washington University



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