From owner-freebsd-arch@FreeBSD.ORG Mon Sep 20 12:54:29 2010 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E87081065673; Mon, 20 Sep 2010 12:54:29 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 28F258FC0A; Mon, 20 Sep 2010 12:54:29 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id A986945E8E; Mon, 20 Sep 2010 14:54:27 +0200 (CEST) Received: from localhost (pdawidek.whl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 6C4BF45E6F; Mon, 20 Sep 2010 14:54:22 +0200 (CEST) Date: Mon, 20 Sep 2010 14:54:06 +0200 From: Pawel Jakub Dawidek To: Boris Samorodov Message-ID: <20100920125406.GD2410@garage.freebsd.pl> References: <20100917234542.GE1902@garage.freebsd.pl> <16411667@ipt.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1sNVjLsmu1MXqwQ/" Content-Disposition: inline In-Reply-To: <16411667@ipt.ru> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: freebsd-current@FreeBSD.org, freebsd-arch@FreeBSD.org Subject: Re: gptboot rewrite, bootonce, etc. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2010 12:54:30 -0000 --1sNVjLsmu1MXqwQ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 19, 2010 at 09:10:52PM +0400, Boris Samorodov wrote: > Hi! >=20 > On Sat, 18 Sep 2010 01:45:42 +0200 Pawel Jakub Dawidek wrote: >=20 > > My company was in need for functionality similar to nextboot(8), but on > > boot loader level, so we can have two partitions we boot from where one > > is known to be good and the other is used for upgrades. We upgrade by > > dd(1)ing entire partition image onto unused partition, we mark it as > > try-to-boot-from-it-but-only-once, reboot and if we fail to boot from > > the new partition, we fall back to the old, good partition. If we > > succeed on the other hand, we mark the new partition as our boot > > partition and mark the other one as unused. >=20 > > Well, how hard can it be? >=20 > > After around two weeks of work, I ended up rewriting gptboot in large > > parts, reorganizing a lot of code, improving and extending gpart a bit > > and implementing desire functionality. >=20 > > Here is the patch for review and test: >=20 > > http://people.freebsd.org/~pjd/patches/gptboot.patch >=20 > Great! Since I need to have both i386 and amd64 at my box > here are my test results: > ----- > [~]bsam@alya% uname -a > FreeBSD alya 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r212758M: Sat Sep 18 16:1= 3:38 MSD 2010 > bsam@alya:/space/FreeBSD/base/head/obj/space/FreeBSD/base/head/src/sys/AL= YA amd64 >=20 > [~]bsam@alya% glabel status > Name Status Components > gptid/c6053c9b-abcc-11df-b740-00251124aff4 N/A ad4p1 > label/9-amd64 N/A ad4p2 > label/swap N/A ad4p3 > label/space N/A ad4p4 > label/9-i386 N/A ad4p5 > [~]bsam@alya% mount > /dev/label/9-amd64 on / (ufs, local) > devfs on /dev (devfs, local, multilabel) > /dev/label/space on /space (ufs, local) > /dev/md0 on /tmp (ufs, local, nosuid, soft-updates) > procfs on /proc (procfs, local) > linprocfs on /compat/linux/proc (linprocfs, local) > linsysfs on /compat/linux/sys (linsysfs, local) > fdescfs on /dev/fd (fdescfs) >=20 > [~]bsam@alya% gpart show > =3D> 34 490234685 ad4 GPT (234G) > 34 128 1 freebsd-boot (64K) > 162 41943040 2 freebsd-ufs (20G) > 41943202 8388608 3 freebsd-swap (4.0G) > 50331810 209715200 4 freebsd-ufs (100G) > 260047010 41943040 5 freebsd-ufs (20G) > 301990050 188244669 - free - (90G) >=20 > [~]bsam@alya% gpart set -a bootme -i 2 ad4 > bootme set on ad4p2 > [~]bsam@alya% gpart set -a bootonce -i 5 ad4 > bootonce set on ad4p5 > [~]bsam@alya% gpart show > =3D> 34 490234685 ad4 GPT (234G) > 34 128 1 freebsd-boot (64K) > 162 41943040 2 freebsd-ufs [bootme] (20G) > 41943202 8388608 3 freebsd-swap (4.0G) > 50331810 209715200 4 freebsd-ufs (100G) > 260047010 41943040 5 freebsd-ufs [bootonce,bootme] (20G) > 301990050 188244669 - free - (90G) > ----- >=20 > Install i386 kernel/world to ad4p5, successful reboot, get i386 > system. Next reboot (get amd64 system back): > ----- > [~]bsam@alya% gpart show > =3D> 34 490234685 ad4 GPT (234G) > 34 128 1 freebsd-boot (64K) > 162 41943040 2 freebsd-ufs [bootme] (20G) > 41943202 8388608 3 freebsd-swap (4.0G) > 50331810 209715200 4 freebsd-ufs (100G) > 260047010 41943040 5 freebsd-ufs (20G) > 301990050 188244669 - free - (90G) > ----- >=20 > All seems to work fine. Great, thanks for testing! > > Any comments or suggestions? >=20 > Only one for now. With current default syslog configuration > logging to local0.warning and local0.info goes nowhere. > It will be good if those messages have traces at the > default system. Good point. I changed those to local0.notice. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --1sNVjLsmu1MXqwQ/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyXWW4ACgkQForvXbEpPzS28wCdHvRBL/PrbRWM8ulvyvUFtCTN G0MAnjHV+NAA3H5dipoQs/0PemI9ezHF =eo7e -----END PGP SIGNATURE----- --1sNVjLsmu1MXqwQ/--