[parted-devel] [PATCH] parted: improve snapping to boundaries of free space

Phil Susi psusi at ubuntu.com
Thu Feb 9 14:43:42 UTC 2017


On 2/8/2017 9:45 AM, Petr Uzel wrote:
>> If you create a partition in the middle of a wide open free space, why
>> shouldn't it become slightly larger to fit the alignment?
> 
> Hm, you lost me. If you create a new partition in the middle of wide
> open free space, there will be no snapping involved. The problematic

The only time snapping is not involved is when you happen to specify an
exact byte or sector boundary that happens to already be aligned.
Whether there is free space after or before the region you selected,
parted tries to snap the boundaries to the nearest aligned grain,
preferring to go slightly larger rather than smaller, if there is free
space to allow it.

> situation this patch is trying solve comes when the newly created
> partition is supposed to be small and close to other existing
> partitions. Then because of the old snapping logic the resulting
> partition could end up much smaller than what the user has expected.

You mean if they are trying to create a partition that is 1.4 MiB (
assuming 1 mib alignment ), it would snap to 1 MiB and thus, be 30%
smaller than they requested?  This seems a bit of a contrived case, and
IIRC there was some logic in there to see if the snap moved it by a
significant amount, and if so, threw a warning asking the user if they
are OK with that or if they want their original position.




More information about the parted-devel mailing list