On 3/1/2023 8:22 AM, Bernd Boeckmann via Freedos-devel wrote:
Hello,
I am now reaching a state where I think that FDISK not any longer breaks the
partition layouts created by itself.
However, there is at least still one MAJOR flaw when dealing with partition
layouts created by other partition managers:
If there exists an extended partition with a start address not aligned to
cylinder boundaries, the position and size determination for logical drives is
completely messed up.
For example: While continuing to cylinder-align the logical partitions, this is
only reflected by the CHS values and not by the corresponding LBA sector
numbers. CHS and LBA sectors get out of sync because of some wired mix of doing
LBA and CHS calculation. A problematic line is for example:
https://github.com/boeckmann/fdisk/blob/2c7da2178c097792c3642e73eeb319330e122c71/SOURCE/FDISK/PCOMPUTE.C#L189
Here the relative starting sector gets set unconditionally. But that is wrong
in case the extended partition does not start on a cylinder boundary while the
logical still gets aligned to it.
I must confess that I do not really know how to solve this issue without being
in danger to completely break everything and want to ask:
a) If someone has an idea of a clever solution without rewriting the (sadly
large) calculation routines.
b) If it would be ok (at least as an interim solution) to make FDISK refuse
handling disks with such type of partition layout, because the user must have
another partition manager to create such layouts anyway. While not being
optimal, I think this is better than letting FDISK break things.
Greetings, Bernd
The reason why partition boundaries are aligned on cylinder boundaries
is that a lot of other OSes also rely on that. Some don't. That's why
you can't just change that behavior without creating problems elsewhere.
So this needs to be taken into account when calculating LBA. And
specially today, there is no reason to whine about a couple dozen
sectors or so.
Tread carefully, there be dragons... đŸ˜‰
Ralf
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel