Date: Wed, 2 May 2012 15:28:11 +1000 From: Peter Jeremy <peterjeremy@acm.org> To: Matthew Seaman <matthew@FreeBSD.org> Cc: freebsd-fs@FreeBSD.org Subject: Re: ZFS with multiple boot/root pools Message-ID: <20120502052811.GA71211@server.vk2pj.dyndns.org> In-Reply-To: <4F9F8888.3030104@FreeBSD.org> References: <20120430210711.GA50280@server.vk2pj.dyndns.org> <4F9F8888.3030104@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <matthew@FreeBSD.org> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120502052811.GA71211>