Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jul 2010 19:19:22 +0200
From:      Joan Picanyol i Puig <lists-freebsd@biaix.org>
To:        freebsd-geom@freebsd.org
Subject:   unlikely secondary GPT LBA
Message-ID:  <20100727171922.GC4458@grummit.biaix.org>

next in thread | raw e-mail | index | archive | help
[please honour MFT, not subscribed]

Hi,

Trying to setup a 8.1-RELEASE system such that:

1. glabeled discs
2. two of this previous discs are gmirrored
3. this mirror is gparted 

Taking order into account I go like:

#!/bin/sh
glabel label -v escota /dev/da1
gmirror label -v system /dev/label/escota
# create GPT partition table
gpart create -s GPT /dev/mirror/system
# add boot partition, aligning it's end to 1MB boundary
gpart add -b 64 -s 1984 -t freebsd-boot -l boot /dev/mirror/system
# install boot code unto boot partition
gpart bootcode -p /boot/gptboot -i 1 mirror/system
# create 2GB root partition
gpart add -b 2048 -s 4194304 -t freebsd-ufs -l std-root mirror/system
# create 10GB partition
gpart add -b 4196352 -s 20971520 -t freebsd-ufs -l apps mirror/system
# create 10GB partition
gpart add -b 25167872 -s 20971520 -t freebsd-ufs -l std-var mirror/system

Things kind of make sense, because I store the last 2MB of my disk at
every step with 'dd if=/dev/da1 of=/tmp/foobar oseek=488255488' and then
I can see how it's being altered:

charlie# cmp /tmp/da1.zeroed /tmp/da1.labeled
/tmp/da1.zeroed /tmp/da1.labeled differ: char 2096641, line 1
charlie# cmp /tmp/da1.labeled /tmp/da1.mirrored
/tmp/da1.labeled /tmp/da1.mirrored differ: char 2096129, line 1
charlie# cmp /tmp/da1.mirrored /tmp/da1.gpted
/tmp/da1.mirrored /tmp/da1.gpted differ: char 2095617, line 1
charlie# cmp /tmp/da1.gpted /tmp/da1.gpted.full
/tmp/da1.gpted /tmp/da1.gpted.full differ: char 2079233, line 1

So far so good: glabel & gmirror each take one sector for their
metadata, the secondary GPT header takes another sector, and once
partitioned we use an extra 16Kb.

However, gpart is not happy:

GEOM: da1: the secondary GPT table is corrupt or invalid.
GEOM: da1: using the primary only -- recovery suggested.

And to my surprise I find:

Primary GPT header:
00000200  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
00000210  7c 89 1f 33 00 00 00 00  01 00 00 00 00 00 00 00  ||..3............|
00000220  fd 3f 1a 1d 00 00 00 00  22 00 00 00 00 00 00 00  |.?......".......|
00000230  dc 3f 1a 1d 00 00 00 00  b8 69 7f ec cd 98 df 11  |.?.......i......|
00000240  8d 0b 00 30 48 f0 15 52  02 00 00 00 00 00 00 00  |...0H..R........|
00000250  80 00 00 00 80 00 00 00  97 02 0f ce 00 00 00 00  |................|
00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Secondary GPT header:
00004000  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
00004010  6d a1 f5 62 00 00 00 00  fd 3f 1a 1d 00 00 00 00  |m..b.....?......|
00004020  01 00 00 00 00 00 00 00  22 00 00 00 00 00 00 00  |........".......|
00004030  dc 3f 1a 1d 00 00 00 00  b8 69 7f ec cd 98 df 11  |.?.......i......|
00004040  8d 0b 00 30 48 f0 15 52  dd 3f 1a 1d 00 00 00 00  |...0H..R.?......|
00004050  80 00 00 00 80 00 00 00  97 02 0f ce 00 00 00 00  |................|
00004060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

I must be misunderstanding something, because I see this as gpart
deciding that my secondary GPT header is at LBA FD3F1A1D00000000 which
way past the end of my disk.

What am I missing?
-- 
pica



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