Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jan 2018 12:15:27 +0000
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: Dualboot and ZFS
Message-ID:  <367901b3-a413-01f2-ecaa-479668b4b232@FreeBSD.org>
In-Reply-To: <20180116112814.GA18197@admin.sibptus.transneft.ru>
References:  <20180115051308.GA45168@admin.sibptus.transneft.ru> <VI1PR02MB12007D071EA5398373D2189CF6EB0@VI1PR02MB1200.eurprd02.prod.outlook.com> <20180115125241.GB60956@admin.sibptus.transneft.ru> <VI1PR02MB1200C7F0066F361E60A6CBEDF6EB0@VI1PR02MB1200.eurprd02.prod.outlook.com> <20180115144747.GA65526@admin.sibptus.transneft.ru> <VI1PR02MB120018D174817F8FFB2981D5F6EB0@VI1PR02MB1200.eurprd02.prod.outlook.com> <20180115151526.GA66342@admin.sibptus.transneft.ru> <a7920f859b666cff48f4f73ee1b2f954@dweimer.net> <20180116034929.GB89443@admin.sibptus.transneft.ru> <alpine.BSF.2.21.1801160934560.69908@mail.fig.ol.no> <20180116112814.GA18197@admin.sibptus.transneft.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--e540c1PmjuHjN6jDr8OAomM12byYm9vZ5
Content-Type: multipart/mixed; boundary="kBjtiSOwA2CfDSHPGeh1IR1N10F4O8MJP";
 protected-headers="v1"
From: Matthew Seaman <matthew@FreeBSD.org>
To: freebsd-questions@freebsd.org
Message-ID: <367901b3-a413-01f2-ecaa-479668b4b232@FreeBSD.org>
Subject: Re: Dualboot and ZFS
References: <20180115051308.GA45168@admin.sibptus.transneft.ru>
 <VI1PR02MB12007D071EA5398373D2189CF6EB0@VI1PR02MB1200.eurprd02.prod.outlook.com>
 <20180115125241.GB60956@admin.sibptus.transneft.ru>
 <VI1PR02MB1200C7F0066F361E60A6CBEDF6EB0@VI1PR02MB1200.eurprd02.prod.outlook.com>
 <20180115144747.GA65526@admin.sibptus.transneft.ru>
 <VI1PR02MB120018D174817F8FFB2981D5F6EB0@VI1PR02MB1200.eurprd02.prod.outlook.com>
 <20180115151526.GA66342@admin.sibptus.transneft.ru>
 <a7920f859b666cff48f4f73ee1b2f954@dweimer.net>
 <20180116034929.GB89443@admin.sibptus.transneft.ru>
 <alpine.BSF.2.21.1801160934560.69908@mail.fig.ol.no>
 <20180116112814.GA18197@admin.sibptus.transneft.ru>
In-Reply-To: <20180116112814.GA18197@admin.sibptus.transneft.ru>

--kBjtiSOwA2CfDSHPGeh1IR1N10F4O8MJP
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: quoted-printable

On 16/01/2018 11:28, Victor Sudakov wrote:
> Do you know how to create a beadm-friendly zroot manually (like the one=

> created automatically by bsdinstall)?=20

This is not particularly difficult.  First, you need to consider the
standard directory structure and mentally divide the ZFSes containing
this content into two classes:

   * The Kernel, kernel modules, binaries, shared libraries, application
     and system configuration files that would be affected by a system
     upgrade.

   * Working data, temporary files, documents, log files etc. which
     would not be affected by a system upgrade.

The first type should be part of the boot environment files, the second
type outside it.  If necessary you may need to create additional ZFSes
to divide content appropriately.

For my systems this works out to a breakdown like this:

   / --> BE
     (This includes /boot, /etc)

   /tmp --> not.  Not a ZFS.  I usually use a tmpfs for /tmp
   /dev --> not.  Not a ZFS.  Uses devfs

   /home --> not.  I generally remove the symlink from /usr/home and
                   make /home a first class ZFS directly.

   /usr --> BE
   /usr/local --> BE
   /usr/obj --> BE
   /usr/src --> BE
   /usr/ports --> not
   /usr/ports/distfiles --> not

   /var --> BE
   /var/crash --> not
   /var/db --> BE
   /var/db/pkg --> BE
   /var/db/postgres --> not
   /var/empty --> not
   /var/log --> not
   /var/run --> not
   /var/tmp --> not
   /var/mail --> not

Plus various other ZFSes for jails and poudriere etc.   Now, assuming
your root zpool is called zroot, and the BE name is '11.1-RELEASE-p6'
you will want to create ZFSes like so:

   ZFS                                Mountpoint        Canmount
   zroot                              /                 no
   zroot/ROOT                         /ROOT             no

   zroot/ROOT/11.1-RELEASE-p6         /                 yes
   zroot/ROOT/11.1-RELEASE-p6/usr     /usr              yes
   zroot/ROOT/11.1-RELEASE-p6/var     /var              yes
   zroot/ROOT/11.1-RELEASE-p6/var/db  /var/db           yes

   ...etc...

   zroot/home                         /home             yes
   zroot/var                          /var              no
   zroot/var/log                      /var/log          yes
   zroot/var/db                       /var/db           no
   zroot/var/db/postgres              /var/db/postgres  yes

   ...etc...

Note the trick of creating two different ZFSes with the same mountpoint,
where one is actually mounted and contains files, and the other is never
mounted, contains nothing and only serves to provide the inheritance of
values for child ZFSes.  This allows mounting a filesystem from outside
the BE (eg. /var/log) beneath a directory from within the BE (eg. /var)

If this seems overly complex, well, it is.  That's the price you pay for
taking the familiar Unix filesystem hierarchy and adapting it to
filesystem semantics developed decades later.  If we were starting from
scratch laying out an OS based on ZFS we'd certainly arrange things a
bit more conveniently for use with boot environments.

	Cheers,

	Matthew



--kBjtiSOwA2CfDSHPGeh1IR1N10F4O8MJP--

--e540c1PmjuHjN6jDr8OAomM12byYm9vZ5
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKoBAEBCgCSFiEEGfFU7L8RLlBUTj8wAFE/EOCp5OcFAlpd7N9fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDE5
RjE1NEVDQkYxMTJFNTA1NDRFM0YzMDAwNTEzRjEwRTBBOUU0RTcUHG1hdHRoZXdA
ZnJlZWJzZC5vcmcACgkQAFE/EOCp5Oejig/+NlmbeP7C7ttJypNCCeCCE2+ORYdd
A+4hSyqyLzwG/QGjfnu8PXy4SiqGRGW1BZ6rpGflGMr8rHKMWTS4CCwjT0KJEU1U
dMtZPMK87cEHVT74IflrlArqECdQRUSRUyiDCl8Tj0URS3EtYuRREGcjSmIHbBJs
JJPPzcLSEinhCklyLVO89ABU53aasGWrSPVa0Bc7TUtaF4t022+29mOKJ4yaBFuN
pWnsRoVbtmB3Tg2bjiOb1vQBAIVq78dZgd/OD9p4LW++2tRI3HgOMyVpgoKQWMyg
95V2DULDVpAA1KkGKGMznki9Yk/FovreEGm2FENk8jm3wbog04GSrXFq8/YNbZOV
c3i3bhR0whrF8nHAxw5KEDeVVIHL3H+F1BSpPqGoF5wPHmOAHHF7E697sQAVtAge
MzZCJM3fXGiDYLt624ycMg63Pyndu0J0CjCR3IwVIqF6jzjOZSGL3k2XnIdG1FfM
STGhxXB8A96zdjXpsBVMhCHMh623n9SqPMrWsa1/6yCWFR0bY4f4fQOQFnHkBI1j
XkS1O4xymUeI+gcyJIpRqsdSYwVOZsjsgTKE3ZNGwqj+JEZjvwaU2FnrWLYHkU/g
LZrlIEjVW65Xd1CtUgH/mA6+08Je4jJic4yNN+icJQd8rgA4eHmVm6uh4fY9GOYn
4rk9/NoKETkYNKk=
=0+xS
-----END PGP SIGNATURE-----

--e540c1PmjuHjN6jDr8OAomM12byYm9vZ5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?367901b3-a413-01f2-ecaa-479668b4b232>