Date: Wed, 2 May 2012 09:26:10 +0200 From: Andreas Nilsson <andrnils@gmail.com> To: Peter Jeremy <peterjeremy@acm.org> Cc: freebsd-fs@freebsd.org, Matthew Seaman <matthew@freebsd.org> Subject: Re: ZFS with multiple boot/root pools Message-ID: <CAPS9%2BSt7V4u8FS26AdEz7k3SJmz44%2BuD%2BgKmuv8GiAOQ8KO-JA@mail.gmail.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 2, 2012 at 7:28 AM, Peter Jeremy <peterjeremy@acm.org> wrote: > 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=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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPS9%2BSt7V4u8FS26AdEz7k3SJmz44%2BuD%2BgKmuv8GiAOQ8KO-JA>