gmirror gm0 destroyed on shutdown; GPT corrupt

Rick C. Petty rick-freebsd2008 at kiwi-computer.com
Wed Jul 1 14:38:34 UTC 2009


On Tue, Jun 30, 2009 at 08:42:57PM -0700, Marcel Moolenaar wrote:
> 
> On Jun 30, 2009, at 3:25 PM, Rick C. Petty wrote:
> >
> >According to wikipedia, the GPT header contains:
> >	- (offset 40) First usable LBA for partitions
> >	- (offset 48) Last usable LBA
> 
> These do not represent the media size. They relate to
> the region of the disk that can be assigned to partitions.

According to wikipedia:

"The values for current and backup LBAs of the primary header should be the
second sector of the disk (1) and the last sector of the disk,
respectively."

And:	offset	contents
	------	--------
	24	Current LBA (location of this header copy)
	32	Backup LBA (location of the other header copy)
	40	First usable LBA for partitions (primary partition table last LBA + 1)
	48	Last usable LBA (secondary partition table first LBA - 1)

So that the media is from relative LBA 0 (the protective MBR) to LBA N-1, the
secondary GPT header, which is described in offset 32.  Offset 48 should
contain LBA N-2.  Therefore the media size N is the value of offset 32
minus the value of offset 24, plus 1 (for the MBR).  It seems pretty clear
cut to me.

-- Rick C. Petty


More information about the freebsd-geom mailing list