Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: wd1: mbr partition exceeds disk size
On Thu, Apr 14, 2011 at 12:44:17AM +0200, Thomas Klausner wrote:
> On Wed, Apr 13, 2011 at 08:33:38PM +0000, Michael van Elst wrote:
> > Replace the disklabel code with something sensible :)
>
> Ok, no :)
>
> > You start with wdgetdefaultlabel that clips at 2TB, the maximum.
> > Then you look for a NetBSD partition in the MBR and get the warning
> > because the MBR shows more sectors than the clipped disklabel.
>
> But fdisk output and disklabel output agree (see my previous email),
> what am I missing?
You miss one sector :)
MBR:
start 1, size 4294967295 (2097152 MB, Cyls 0-267349/89/4)
disklabel:
total sectors: 4294967295
subr_disk_mbr.c:
/* Check end of partition is inside disk limits */
if ((uint64_t)ext_base + le32toh(dp->mbrp_start) +
le32toh(dp->mbrp_size) > a->lp->d_secperunit) {
/* This mbr doesn't look good.... */
a->msg = "mbr partition exceeds disk size";
/* ...but don't report this as an error (yet) */
return SCAN_CONTINUE;
ext_base is the start of an extended partition (and 0 for a primary
partition).
So the MBR partition is one sector too large. This seems to be caused
by the gpt tool. In create.c and migrate.c you find:
mbr->mbr_part[0].part_start_lo = htole16(1);
if (last > 0xffffffff) {
mbr->mbr_part[0].part_size_lo = htole16(0xffff);
mbr->mbr_part[0].part_size_hi = htole16(0xffff);
} else {
mbr->mbr_part[0].part_size_lo = htole16(last);
mbr->mbr_part[0].part_size_hi = htole16(last >> 16);
}
That's correct, but it describes a partition size of exactly 2TB
while the disklabel can only represent a disk size of 2TB-512.
Greetings,
--
Michael van Elst
Internet: mlelstv%serpens.de@localhost
"A potential Snark may lurk in every tree."
Home |
Main Index |
Thread Index |
Old Index