[Parted-maintainers] Bug#380226: NTFS (partition) not recreated correctly after resize: incorrect start sector

Bas Zoetekouw bas at debian.org
Sun Oct 1 17:37:15 UTC 2006


Hi!

Following the instructions by Frans to reproduce the bug, I tried to
track this bug down.  The problem seems to be that parted explicitly
aligns the partitions at cylinder boundaries.

I added lots of print command to the source, and it turns out that the
starting sector of the partition is changed from 2048 to 63 in the call
to _partition_align() in line 1932 of libparted/disk.c (of current
version 1.7.1-2.1).  This call eventually calls msdos_partition_align()
of libparted/labels/dos.c, which explicitly aligns the partition to the
BIOS cylinder boundaries.  I checked that before the
_align(part,&bios_geom,constraint) call in msdos_partition_align(), the
partition geometry is still ok (ie starts at sector 2048), but after the
call it is broken (ie starts at sector 63).

I assume this is done by design to keep compatibility with pre-LBA dos
systems or something like that.  A possible quick fix would to simply
comment out the call to the bios alignment, like in the patch below.
This works perfectly in the testing environment as described by Frans,
and I assume that it would also be fine for most modern pc systems,
but I'm not sure if there are consequences for other (legacy) systems.
This should probably be taken up with upstream;  he might have a more
satisfying solution to the problem.


Regards,
Bas.

--- parted-1.7.1/libparted/labels/dos.c.eerst        2006-10-01 17:28:19.323144040 +0000
+++ parted-1.7.1/libparted/labels/dos.c      2006-10-01 17:29:32.225998809 +0000
@@ -1930,8 +1930,10 @@
 
        partition_probe_bios_geometry (part, &bios_geom);
 
+       /*
        if (_align (part, &bios_geom, constraint))
                return 1;
+       */
        if (_align_no_geom (part, constraint))
                return 1;
  




-- 
Kind regards,
+--------------------------------------------------------------------+
| Bas Zoetekouw              | GPG key: 0644fab7                     |
|----------------------------| Fingerprint: c1f5 f24c d514 3fec 8bf6 |
| bas at o2w.nl, bas at debian.org |              a2b1 2bae e41f 0644 fab7 |
+--------------------------------------------------------------------+ 




More information about the Parted-maintainers mailing list