From owner-freebsd-fs@FreeBSD.ORG Tue May 1 06:54:16 2012 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 4C3E41065673 for ; Tue, 1 May 2012 06:54:16 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id C453F8FC0C for ; Tue, 1 May 2012 06:54:15 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [IPv6:2001:8b0:151:1:fa1e:dfff:feda:c0bb]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.5/8.14.5) with ESMTP id q416s8Rf079487 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 1 May 2012 07:54:08 +0100 (BST) (envelope-from matthew@FreeBSD.org) X-DKIM: OpenDKIM Filter v2.5.2 smtp.infracaninophile.co.uk q416s8Rf079487 Authentication-Results: smtp.infracaninophile.co.uk/q416s8Rf079487; dkim=none (no signature); dkim-adsp=none Message-ID: <4F9F8888.3030104@FreeBSD.org> Date: Tue, 01 May 2012 07:54:00 +0100 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20120420 Thunderbird/12.0 MIME-Version: 1.0 To: Peter Jeremy References: <20120430210711.GA50280@server.vk2pj.dyndns.org> In-Reply-To: <20120430210711.GA50280@server.vk2pj.dyndns.org> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9895976D0FC0F79BE8893513" X-Virus-Scanned: clamav-milter 0.97.4 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lucid-nonsense.infracaninophile.co.uk Cc: freebsd-fs@FreeBSD.org 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: Tue, 01 May 2012 06:54:16 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9895976D0FC0F79BE8893513 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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. 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. 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 in zpool2/ zpool2 / zfs rw 0 0 zpool1 /ROOT/zpool1 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 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. zpool2 will be mounted at /ROOT/zpool2 as defined in the zpool2 settings. zpool2/usr will be mounted at /ROOT/zpool2/usr etc. etc. To flip to mounting the other zpool at the root, you just need to tell the boot loader to use the other zpool. There is no need to put anything into /etc/fstab in this case. Apart from the wrinkle of having two different zpools, this is essentially how ZFS boot environments work. You should be able to adapt one or other of the various recipes for using boot environments on the net to suit. I have some notes at http://www.infracaninophile.co.uk/articles/install-on-zfs/ but there are several other treatments around. Cheers, Matthew [*] Use 'zfs inherit mountpoint zpool/whatever' to reset to this default behaviour if needed. --=20 Dr Matthew J Seaman MA, D.Phil. PGP: http://www.infracaninophile.co.uk/pgpkey --------------enig9895976D0FC0F79BE8893513 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+fiI8ACgkQ8Mjk52CukIwmYQCgkYaMSEogmR2U+/bNn2g+9JYQ szcAn1mM7HtkkwczHv0YfCU689B74j1Q =Wvtu -----END PGP SIGNATURE----- --------------enig9895976D0FC0F79BE8893513--