From owner-freebsd-fs@FreeBSD.ORG Wed May 2 05:28:21 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 44253106566C; Wed, 2 May 2012 05:28:21 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail17.syd.optusnet.com.au (mail17.syd.optusnet.com.au [211.29.132.198]) by mx1.freebsd.org (Postfix) with ESMTP id C7DA28FC0A; Wed, 2 May 2012 05:28:20 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c220-239-251-180.belrs5.nsw.optusnet.com.au [220.239.251.180]) by mail17.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q425SCYs012073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 2 May 2012 15:28:13 +1000 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.5/8.14.4) with ESMTP id q425SBkb079276; Wed, 2 May 2012 15:28:11 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.5/8.14.5/Submit) id q425SBdx079275; Wed, 2 May 2012 15:28:11 +1000 (EST) (envelope-from peter) Date: Wed, 2 May 2012 15:28:11 +1000 From: Peter Jeremy To: Matthew Seaman Message-ID: <20120502052811.GA71211@server.vk2pj.dyndns.org> References: <20120430210711.GA50280@server.vk2pj.dyndns.org> <4F9F8888.3030104@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: <4F9F8888.3030104@FreeBSD.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.21 (2010-09-15) 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: Wed, 02 May 2012 05:28:21 -0000 --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=3Dno= auto" >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. =20 --=20 Peter Jeremy --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk+gxesACgkQ/opHv/APuIdSSgCguG6ZPZRm+nEBUrPo3rfOdTHa W4MAoL6cp+JytfNKqEwBbPPnaGdqUDc5 =3/GS -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ--