Loader, MBR and the boot process

Robert Noland rnoland at FreeBSD.org
Tue Jan 26 01:34:13 UTC 2010


On Mon, 2010-01-25 at 09:45 +0000, Matthew Seaman wrote:
> Andriy Gapon wrote:
> > on 25/01/2010 04:41 Robert Noland said the following:
> >> On Mon, 2010-01-25 at 07:57 +1100, Mark Andrews wrote:
> >>>      offset  The offset of the start of the partition from the beginning of
> >>>              the drive in sectors, or * to have bsdlabel calculate the correct
> >>>              offset to use (the end of the previous partition plus one, ignor-
> >>>              ing partition `c'.  For partition `c', * will be interpreted as
> >>>              an offset of 0.  The first partition should start at offset 16,
> >>>              because the first 16 sectors are reserved for metadata.
> >> Ok, now this has my attention... My gut feeling right now is that this
> >> is a bug in geom_part_bsd.  I don't understand why the label isn't
> >> protected.  (Adding -b 16 when adding the swap partition fixes this)
> >> Another project to goes on my list...
> >>
> >> If anyone knows why this is done like this... please share.
> > 
> > I presume that this is for purely historic reasons.
> > 
> 
> I believe this has been known about since 5.x days:
> 
>    http://www.freebsd.org/cgi/query-pr.cgi?pr=72812
> 
> As far as I recall, sometime around 6.1-RELEASE this should have been
> fixed.  It certainly seems to be the case that it is harmless to have 
> a plain swap partition start at offset 0, but anything else, like encrypted
> swap or putting a filesystem there needs the 16 sector offset.

When the first partition (whatever it is), starts at offset 0, if you dd
into that partition you wipe out the label entirely, which just doesn't
make sense to me.  Trying to manage this in the file system code and the
swap pager or whatever other consumer might make use of the partition
seems like madness to me.

robert.

> 	Cheers,
> 
> 	Matthew
> 
-- 
Robert Noland <rnoland at FreeBSD.org>
FreeBSD



More information about the freebsd-questions mailing list