Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Aug 2013 14:59:29 -0400
From:      J David <j.david.lists@gmail.com>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        "Andrey V. Elsukov" <bu7cher@yandex.ru>, freebsd-stable@freebsd.org
Subject:   Re: Problem with zfsloader on 9.2-BETA2
Message-ID:  <CABXB=RRDj_%2B0spjuhvNfuEy-OwqROO4y2BLQrXeBXw0XFr_zrg@mail.gmail.com>
In-Reply-To: <5202006B.5060708@FreeBSD.org>
References:  <CABXB=RRhVDdKCidwnrji1qR41Rx7uvs2Lx1ZPF1FREOHcnm5bg@mail.gmail.com> <51FD5709.7050306@FreeBSD.org> <CABXB=RS4HSmtPHrw%2BcniTaL_63JS5fA3OcB91y-mCN1DmUKs5Q@mail.gmail.com> <5200C7A3.3070403@yandex.ru> <CABXB=RRU9f%2BFmSV=SCmKoaEjhpDptkD5i-v0YVm=gYBEH63Scw@mail.gmail.com> <5202006B.5060708@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 7, 2013 at 4:08 AM, Andriy Gapon <avg@freebsd.org> wrote:
> Could you please hack gpt_checkhdr() in sys/boot/common/part.c to print all the
> relevant values for this check and try bootparttest again?

Your wish is my command:

--- common/part.c.orig	2013-08-05 19:00:49.536868414 +0000
+++ common/part.c	2013-08-07 18:34:09.277972724 +0000
@@ -184,7 +184,7 @@
 	if (hdr->hdr_entries < 128 ||
 	    hdr->hdr_entsz < sizeof(struct gpt_ent) ||
 	    sectorsize % hdr->hdr_entsz != 0) {
-		DEBUG("invalid entry size or number of entries");
+		DEBUG("invalid entry size (%u/%lu) or number of entries (%u)",
hdr->hdr_entsz, sizeof(struct gpt_ent), hdr->hdr_entries);
 		return (NULL);
 	}
 	hdr->hdr_lba_start = le64toh(hdr->hdr_lba_start);

$ sudo ./bootparttest da2
GEOM provider "da2" opened
Mediasize: 1000204886016 Bytes (1953525168 sectors)
Sectorsize: 512 Bytes
da2: read 1 blocks from the offset 0 [+0]
da2: read 1 blocks from the offset 1 [+0]
ptable_open: PMBR detected
da2: read 1 blocks from the offset 1 [+0]
gpt_checkhdr: invalid entry size (128/128) or number of entries (9)
da2: read 1 blocks from the offset 1953525167 [+0]
gpt_checkhdr: invalid entry size (128/128) or number of entries (9)
Partition table detected: None

So it looks like this check is tripping because of hdr->hdr_entries (9 < 128).

If I change the minimum to 9 instead of 128, I get the following:

$ sudo ./bootparttest da2
GEOM provider "da2" opened
Mediasize: 1000204886016 Bytes (1953525168 sectors)
Sectorsize: 512 Bytes
da2: read 1 blocks from the offset 0 [+0]
da2: read 1 blocks from the offset 1 [+0]
ptable_open: PMBR detected
da2: read 1 blocks from the offset 1 [+0]
da2: read 2 blocks from the offset 2 [+0]
da2: read 1 blocks from the offset 1953525167 [+0]
ptable_gptread: new GPT partition added
Partition table detected: GPT
  da2p1: FreeBSD ZFS               931G

That looks like it's reading it.  So is "128 partitions is the
minimum" more of a guideline than an actual rule?  Maybe "be
restrictive with what you generate but permissive in what you accept"
would apply here.

Unfortunately since I am currently resilvering one of the drives with
a fresh gpart-built table, I won't be in a position to reboot this
machine for awhile to see if a zfsloader built with this change would
boot the pool.  But it seems like it might.

Thanks!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABXB=RRDj_%2B0spjuhvNfuEy-OwqROO4y2BLQrXeBXw0XFr_zrg>