From owner-freebsd-questions@freebsd.org Tue Jan 16 12:15:43 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A483EBFF31 for ; Tue, 16 Jan 2018 12:15:43 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.117.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.infracaninophile.co.uk", Issuer "infracaninophile.co.uk" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id C4D6276B2A for ; Tue, 16 Jan 2018 12:15:42 +0000 (UTC) (envelope-from matthew@FreeBSD.org) Received: from liminal.local (unknown [IPv6:2001:8b0:151:1:853e:bad4:1055:25ea]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: m.seaman@infracaninophile.co.uk) by smtp.infracaninophile.co.uk (Postfix) with ESMTPSA id 9E8171141E for ; Tue, 16 Jan 2018 12:15:33 +0000 (UTC) Authentication-Results: smtp.infracaninophile.co.uk; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: smtp.infracaninophile.co.uk/9E8171141E; dkim=none; dkim-atps=neutral Subject: Re: Dualboot and ZFS To: freebsd-questions@freebsd.org References: <20180115051308.GA45168@admin.sibptus.transneft.ru> <20180115125241.GB60956@admin.sibptus.transneft.ru> <20180115144747.GA65526@admin.sibptus.transneft.ru> <20180115151526.GA66342@admin.sibptus.transneft.ru> <20180116034929.GB89443@admin.sibptus.transneft.ru> <20180116112814.GA18197@admin.sibptus.transneft.ru> From: Matthew Seaman Message-ID: <367901b3-a413-01f2-ecaa-479668b4b232@FreeBSD.org> Date: Tue, 16 Jan 2018 12:15:27 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180116112814.GA18197@admin.sibptus.transneft.ru> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="e540c1PmjuHjN6jDr8OAomM12byYm9vZ5" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2018 12:15:43 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --e540c1PmjuHjN6jDr8OAomM12byYm9vZ5 Content-Type: multipart/mixed; boundary="kBjtiSOwA2CfDSHPGeh1IR1N10F4O8MJP"; protected-headers="v1" From: Matthew Seaman 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> <20180115125241.GB60956@admin.sibptus.transneft.ru> <20180115144747.GA65526@admin.sibptus.transneft.ru> <20180115151526.GA66342@admin.sibptus.transneft.ru> <20180116034929.GB89443@admin.sibptus.transneft.ru> <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--