Subject: Re: bug#21522: assertion metadata_length > 0 in add_logical_part_metadata failed

From: Phil Susi <[email-masked]>
Date: Thu, 24 Sep 2015 13:21:50 -0400

On 9/24/2015 11:56 AM, Brian C. Lane wrote:
> Are you sure? According to
> https://en.wikipedia.org/wiki/Extended_boot_record the EBR is at the
> start of each logical partition, and chains to the next. I suppose it is
> possible that would work since it has separate pointers for the
> partition and the next EBR but none of the authoritative diagrams I've
> seen show that. eg.
> https://technet.microsoft.com/en-us/library/cc977219.aspx also shows the
> EBR at the start of the logical partition.

Yes, it should work anywhere, and it seems that both the linux kernel
partition table parser and fdisk are fine with it.  I'm pretty sure that
DOS was also fine with such an arrangement, though anyone sane has
always put it just before the logical partition like all of the diagrams
show.  What I wonder is why has this not been an issue before, and why
is it one now?  That is, since it seems no partitioning tools have ever
done this before, which one is doing it now?

I've also been looking at the parted code for writing the partition
table and I'm beating my head against the desk now because I swear, it
can't possibly work the way it is.  What am I missing here?

It *should* be writing the EBR for the next logical partition to start -
1, or prev->end + 1.  Instead, it does this:

geom = ped_geometry_new (disk->dev, part->prev->geom.start,
                         part->geom.end - part->prev->geom.start + 1);

That says put it in the boot sector of the previous logical partition,
doesn't it?