Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2012 08:18:09 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        "Andrey V. Elsukov" <ae@freebsd.org>
Cc:        Warren Block <wblock@wonkity.com>, Pawel Jakub Dawidek <pjd@freebsd.org>, current@freebsd.org, Andriy Gapon <avg@freebsd.org>
Subject:   Re: CFR: backup GPT header support in pmbr and loader(8) (Re: Handbook mirroring section)
Message-ID:  <201206140818.10058.jhb@freebsd.org>
In-Reply-To: <4FD9D4DF.9090609@FreeBSD.org>
References:  <4FCF3021.5070802@FreeBSD.org> <20120610.224813.710171778841273502.hrs@allbsd.org> <4FD9D4DF.9090609@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, June 14, 2012 8:11:11 am Andrey V. Elsukov wrote:
> On 10.06.2012 17:48, Hiroki Sato wrote:
> > ae> Yes, i also have thought about this and this should work for most GEOM 
classes,
> > ae> but i revised again PMBR code and it seems that it will not work 
anyway :)
> > ae> Our PMBR doesn't use backup GPT header and table, and it doesn't 
verify
> > ae> correctness of primary GPT.
> > ae>
> > ae> From the other side, there are three situations when we use GPT:
> > ae> 1. FreeBSD is only one system on the disk and we use PMBR and gptboot 
to boot it.
> > ae>
> > ae> In case if we will fix PMBR your patch will help.
> > 
> >  I created the attached patchset for the loader and pmbr to support
> >  backup GPT header when the primary one is corrupted.  Can anyone test
> >  and/or review it?
> > 
> >  The pmbr program now checks the GPT signature, and if failed it tries
> >  to search the backup header from the last LBA.  When GEOM metadata is
> >  found at the last LBA, the second last will be checked.  The
> >  loader(8) program also supports the same algorithm to search the
> >  backup header.
> 
> Hi,
> 
> I have tested your patch and discovered yet another problem.
> Actually the loader(8) doesn't read backup GPT header and table and
> this stops booting when primary header or table damaged
> (pmbr and gptboot works as expected in this case).
> The libi386/biosdisk.c should be modified to add this support.
> 
> Also, our PMBR image doesn't contain any partition entries and
> writing it to the disk with dd(1) makes the system unbootable.
> What you think if we will add one partition entry to the PMBR image?
> I modified your patch (the last hunk added) and it is attached.

That is on purpose.  It is the responsibility of gpart to create the partition 
entry, not to hardcode one in pmbr.S.  You aren't supposed to dd pmbr to the 
disk, but use gpart to install it as bootcode.

-- 
John Baldwin



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