From owner-freebsd-fs@FreeBSD.ORG Fri Sep 3 11:24:04 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AADBD10657B5 for ; Fri, 3 Sep 2010 11:24:04 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 30D058FC13 for ; Fri, 3 Sep 2010 11:24:03 +0000 (UTC) Received: by eyx24 with SMTP id 24so1095794eyx.13 for ; Fri, 03 Sep 2010 04:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=TSt4gZPD0Zm+mHt4XDFPXwZlYSNp9fzqeQYfXyeRSVI=; b=urigIB2kWQ5gTxr3SK05Cyx6JOkw23WDSNvaBgLe7ug62AeI7FwIMputsYeM6YGfzn nADzTo6VEQZAqoQLBOMIFJZCbdRTtVOM/+lpq0E8f3zEX1nbJMiROM49QBKyF8vv7Sdb zRYqZ6G2pLirET+oc2RUquUchopyjquAosDE0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=DdxON1BPKue3ObPugTpeM7KCWnGN7HA8VRBlMjDJjo2emNdxb+72jqDa5ciD59HESV CQ/izhdVMr3sVaP98m8OKxmkg7wf3RgfC1MTRXe6qHosO/WGYDm4y5aQwcEak3goEtAX w2UPxbU4HTESfjLpE6Joxe4XJ+x4JCvkoWOnU= Received: by 10.213.20.19 with SMTP id d19mr673198ebb.1.1283511673486; Fri, 03 Sep 2010 04:01:13 -0700 (PDT) Received: from localhost ([212.98.186.134]) by mx.google.com with ESMTPS id z55sm2520086eeh.3.2010.09.03.04.01.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 03 Sep 2010 04:01:12 -0700 (PDT) Date: Fri, 3 Sep 2010 14:01:08 +0300 From: Gleb Kurtsou To: Phillip Nordwall Message-ID: <20100903110107.GA2084@tops> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-fs@freebsd.org Subject: Re: ZFS mount_unionfs or ZFS overlay X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 11:24:04 -0000 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) > :/zmnts/www on /jails/www (unionfs, local) > > /jails/www on /jails/web0 (nullfs, local, read-only) > :/zmnts/web0 on /jails/web0 (unionfs, local) > /jails/www on /jails/web1 (nullfs, local, read-only) > :/zmnts/web1 on /jails/web1 (unionfs, local) > . > . > . > > /jails/www on /jails/webn (nullfs, local, read-only) > :/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