From owner-freebsd-fs@FreeBSD.ORG Wed May 2 07:26:11 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD8B8106564A; Wed, 2 May 2012 07:26:11 +0000 (UTC) (envelope-from andrnils@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 100878FC08; Wed, 2 May 2012 07:26:10 +0000 (UTC) Received: by bkvi17 with SMTP id i17so274414bkv.13 for ; Wed, 02 May 2012 00:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=koMIYi+AdEQIZj15kr2fptCfFHlQAIeMY3uZjvQvhlk=; b=Q6ohRtAciUpjKqgICba3gUtVlnoK9jzJmvB2fMpm6l6Dqo1xOVAVtyp6xssvoKJgMt gnjxAyTMqfb5/fDL9LEikU2EcwfBUPHVtHuSFVraT3beY7DxmCiVAtkJ0HT0JfloVG0a SRdLZN4SrmSD5QjiSdaazRxzgyh9Q0CDCVKlJUSJ4IbOzsVsZA6XYmQYrMS6TxZmdg3K OdABT0PgILrMAxOzGxPeB4kXK++aRJrPxOJCLssqhLeKgGyOSbcMlBENjXf4Ub57rM6w DtTe3qUgAvo9+HTQLkjryk7ZyckSGTsT0dV9CiUciynwuSS6yjeF2K/6H6/E4ZokWAC2 6YqA== MIME-Version: 1.0 Received: by 10.204.152.75 with SMTP id f11mr9384698bkw.136.1335943570095; Wed, 02 May 2012 00:26:10 -0700 (PDT) Received: by 10.204.197.67 with HTTP; Wed, 2 May 2012 00:26:10 -0700 (PDT) In-Reply-To: <20120502052811.GA71211@server.vk2pj.dyndns.org> References: <20120430210711.GA50280@server.vk2pj.dyndns.org> <4F9F8888.3030104@FreeBSD.org> <20120502052811.GA71211@server.vk2pj.dyndns.org> Date: Wed, 2 May 2012 09:26:10 +0200 Message-ID: From: Andreas Nilsson To: Peter Jeremy Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-fs@freebsd.org, Matthew Seaman Subject: Re: ZFS with multiple boot/root pools 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: Wed, 02 May 2012 07:26:11 -0000 On Wed, May 2, 2012 at 7:28 AM, Peter Jeremy wrote: > On 2012-May-01 07:54:00 +0100, Matthew Seaman wrote: > >On 30/04/2012 22:07, Peter Jeremy wrote: > >> Can anyone suggest a way to configure a zpool or set of filesystems > >> so that they will only be mounted if the root filesystem is within > >> the zpool. > > > >Not exactly that, but this should suffice. > > It sounds good but I can't make it work. > > >Suppose your two pools are zpool1 and zpool2. You have several ZFSes on > >each pool, all of which should be set to the default[*] that they are > >all mounted relative to the top level ZFS -- either zpool1/ or zpool2/ > >-- so to avoid overlaps, all you need to do is mount the top level ZFS > >at a unique path. > > Yep. To go further, assume there are also zpool{1,2}/var filesystems, > one of which should be mounted as /var. The mountpoint for zpool{1,2}/var > can be one of: > A) legacy > This requires an entry in each /etc/fstab for /var > B) inherited > This depends on the value of mountpoint for zpool{1,2}: > a) legacy > Same as (A) above. > b) inherited > The mountpoint will be set to /zpool{1,2}/var > c) Set to some arbitrary value, say /foo > The mountpoint will be set to /foo/var > C) /var > This results is two /var filesystems unless one is marked > "canmount=noauto" > > >One way of doing this is to set the mountpoints for the top level > >zpool1/ and zpool2/ to legacy, and create /etc/fstab in each pool like so: > > > >in zpool1/ > > > >zpool1 / zfs rw 0 0 > >zpool2 /ROOT/zpool2 zfs rw 0 0 > > Following the breakdown above, this implies I'd also need an entry in > /etc/fstab: > zpool1/var /var zfs rw 0 0 > > >Another way of doing this is to realise that the vfs.root.mountfrom > >property in /boot/loader.conf overrides any internal settings in the > >zpools. This means that you can set the mountpoint for zpool1/ and > >zpool2/ to some distinct values, say, /ROOT/zpool1 and /ROOT/zpool2 > > Whilst this overrides the mountpoint for the root filesystem, it has > no effect on other filesystems in the pool. In particular, the > mountpoint for zpool1/var remains /zpool1/var and the "zfs mount -a" > fails because there's no /zpool1 > > >If vfs.root.mountfrom is set to zfs:zpool1 then that zpool will be > >mounted as the root filesystem at / and zpool1/usr, zpool1/var etc. etc. > >will all be mounted in the expected locations relative to that. > > Unfortunately my experiments on a 10-current box show this doesn't > happen. Inheriting a mountpoint means that the filesystem's > mountpoint is set to the parent's nominal mountpoint (ie zpool{1,2}), > not the actual mountpoint (ie /), with the filesystem name appended. > > >Apart from the wrinkle of having two different zpools, this is > >essentially how ZFS boot environments work. > > Except that beadm/manageBE does a lot of other juggling to switch > between BEs. > > >http://www.infracaninophile.co.uk/articles/install-on-zfs/ but there are > >several other treatments around. > > I've had a look through those notes and you are still specifying > mountpoints for (eg) zroot/ROOT/9.0-RELEASE/usr - which implies you > wind up with multiple /usr's mounted. > > -- > Peter Jeremy > Would it work for you to import the second pool with with the altroot property set? Like zpool import -o altroot=/zpool2 zpool2 /Andreas