Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Sep 2010 14:54:06 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Boris Samorodov <bsam@ipt.ru>
Cc:        freebsd-current@FreeBSD.org, freebsd-arch@FreeBSD.org
Subject:   Re: gptboot rewrite, bootonce, etc.
Message-ID:  <20100920125406.GD2410@garage.freebsd.pl>
In-Reply-To: <16411667@ipt.ru>
References:  <20100917234542.GE1902@garage.freebsd.pl> <16411667@ipt.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

--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/--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100920125406.GD2410>