From owner-freebsd-arch@FreeBSD.ORG Mon Sep 20 09:12:56 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 1A4DC106566B; Mon, 20 Sep 2010 09:12:56 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id AB4918FC18; Mon, 20 Sep 2010 09:12:55 +0000 (UTC) Received: by qwg5 with SMTP id 5so3720691qwg.13 for ; Mon, 20 Sep 2010 02:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=jLsdUcSGx8R/8mFt7/4HmgLfgvhTfnG6dpDUULyCd98=; b=UC6l2Oy72V+lrUEMFOPQK5UZd/CPdFliK/9sDYpokIthnq2bhua2Kg1IddEBkxpVtM KV7HTDQWe40WKKw/RJOo2uNWc1o4aYGmAZ8ZmPPKhPdXACN0gN5XLU8YDBBH3K/HwQn4 G5P+CVKh5z6H3QT8YkDGHlSnszoGHcA5cLnQc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=OKH0ffXerfrczGGPxzScNqjxExG3ns3clOTPpH5SR1APyxeXmesedIRUfJj3WSaqUs A3XycnZvQqOlM2+D4ufDwXCt8MDeFCH7ub4M29A8LQ5vvrL+KyWLHQ4ZEPmCIgbwEQ// YkcMgwm5NxzAky/cCzORTKvksgygBJxqyIVFc= MIME-Version: 1.0 Received: by 10.229.192.4 with SMTP id do4mr5859346qcb.164.1284972416767; Mon, 20 Sep 2010 01:46:56 -0700 (PDT) Received: by 10.229.215.209 with HTTP; Mon, 20 Sep 2010 01:46:56 -0700 (PDT) In-Reply-To: <16411667@ipt.ru> References: <20100917234542.GE1902@garage.freebsd.pl> <16411667@ipt.ru> Date: Mon, 20 Sep 2010 09:46:56 +0100 Message-ID: From: krad To: Boris Samorodov Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-current@freebsd.org, Pawel Jakub Dawidek , 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 09:12:56 -0000 On 19 September 2010 18:10, 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@alya% uname -a > FreeBSD alya 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r212758M: Sat Sep 18 > 16:13:38 MSD 2010 > bsam@alya:/space/FreeBSD/base/head/obj/space/FreeBSD/base/head/src/sys/ALYA > amd64 > > [~]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) > > [~]bsam@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@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 > => 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@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. > > > 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. > > > Thank you! That's really great. > > -- > WBR, Boris Samorodov (bsam) > Research Engineer, http://www.ipt.ru Telephone & Internet SP > FreeBSD Committer, http://www.FreeBSD.org The Power To Serve > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > does it work for zfs boot as that would be really nice if it did?