I originally reported this a couple years ago and "bumped" the thread six months ago. I never got any response.
libparted version 2.3 Debian Sid This is an example of the problem with ped_disk_get_max_partition_geometry(). With three partitions I ask libparted for a maximum geometry on the last two. In both cases it is smaller than it could be by a wide margin. This only seems to be a problem ith ms-dos partitions. **** FDISK OUTPUT **** Start: 1951415550 End : 1953520064 Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0000f013 Device Boot Start End Blocks Id System /dev/sdc1 2048 2097215 1047584 83 Linux /dev/sdc2 1951422464 1953520063 1048800 83 Linux /dev/sdc3 1949317120 1951415548 1049214+ 83 Linux **** libparted partion layout **** Type: 8 Start: 0 End: 62 Type: 4 Start: 63 End: 2047 Type: 0 <-- first partition Start: 2048 End: 2097215 Type: 4 Start: 2097216 End: 1949317119 Type: 0 <-- second partiton Start: 1949317120 End: 1951415548 Type: 4 Start: 1951415549 End: 1951422463 Type: 0 <-- third partition Start: 1951422464 End: 1953520063 Type: 4 Start: 1953520064 End: 1953520064 Type: 8 Start: 1953520065 End: 1953525167 **** results for max geometry -- constraint any **** Maximum geometry for 2nd partition Start: 2104515 End : 1951415549 The first partition ends at 2097215 but libparted puts the start of a maximized partition at 2104515 which is 7300 sectors or 3.7 megs later. Maximum geometry for 3rd partition Start: 1951415550 End : 1953520064 Here the beginning is right but the end at 1953520064 is short of 1953525167 by 5103 sectors or 2.6 meg. **** A different setup **** **** FDISK **** Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000e6efb Device Boot Start End Blocks Id System /dev/sdc1 976760832 1953520064 488379616+ 5 Extended /dev/sdc2 2048 390704370 195351161+ 83 Linux /dev/sdc3 390717440 402438236 5860398+ 83 Linux **** liblvm **** Start: 0 End: 62 Type: 4 Start: 63 End: 2047 Type: 0 Start: 2048 End: 390704370 Type: 4 Start: 390704371 End: 390717439 Type: 0 <--- partition to maximize Start: 390717440 End: 402438236 Type: 4 Start: 402438237 End: 976760831 Type: 2 Start: 976760832 End: 1953520064 Type: 9 Start: 976760832 End: 976760894 Type: 5 Start: 976760895 End: 1953520064 Type: 8 Start: 1953520065 End: 1953525167 **** results for max geometry -- constraint any **** Maximum geometry for partition number 2 Start: 390716865 End : 976751999 The partition has 13069 sectors or 6.7 megabytes of room before the start and yet only gets 575 sectors from libparted. After the end it can go to 976760832 but libparted puts the end at only 976751999 which is 8833 sectors short or 4.5 megs off. The results here are with a 1.0 TB drive but small drives can do the same. I have actually seen significantly worse rsults but I haven't been able to replicate them yet. Thank you for looking into this issue.