gptboot rewrite, bootonce, etc.
Pawel Jakub Dawidek
pjd at FreeBSD.org
Mon Sep 20 12:54:30 UTC 2010
On Sun, Sep 19, 2010 at 09:10:52PM +0400, Boris Samorodov wrote:
> Hi!
>
> On Sat, 18 Sep 2010 01:45:42 +0200 Pawel Jakub Dawidek wrote:
>
> > 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.
>
> > Well, how hard can it be?
>
> > 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.
>
> > Here is the patch for review and test:
>
> > http://people.freebsd.org/~pjd/patches/gptboot.patch
>
> Great! Since I need to have both i386 and amd64 at my box
> here are my test results:
> -----
> [~]bsam at alya% uname -a
> FreeBSD alya 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r212758M: Sat Sep 18 16:13:38 MSD 2010
> bsam at alya:/space/FreeBSD/base/head/obj/space/FreeBSD/base/head/src/sys/ALYA amd64
>
> [~]bsam at 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 at 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)
>
> [~]bsam at alya% gpart show
> => 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)
>
> [~]bsam at alya% gpart set -a bootme -i 2 ad4
> bootme set on ad4p2
> [~]bsam at alya% gpart set -a bootonce -i 5 ad4
> bootonce set on ad4p5
> [~]bsam at alya% gpart show
> => 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)
> -----
>
> Install i386 kernel/world to ad4p5, successful reboot, get i386
> system. Next reboot (get amd64 system back):
> -----
> [~]bsam at alya% gpart show
> => 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)
> -----
>
> All seems to work fine.
Great, thanks for testing!
> > Any comments or suggestions?
>
> 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.
--
Pawel Jakub Dawidek http://www.wheelsystems.com
pjd at FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20100920/8f25e542/attachment.pgp
More information about the freebsd-arch
mailing list