[parted-devel] [PATCH] parted: fix the resizepart command logic
    Phil Susi 
    psusi at ubuntu.com
       
    Tue Apr 18 13:29:44 UTC 2017
    
    
  
On 3/31/2017 6:31 AM, Wang Dong wrote:
> When to resize a partition in interactive mode, if user provides an end
> point which is before the old end point, parted will raise a warning
> of data loss. But parted will modify the disk information even before
> the response from user. Further more, if user finally declines to resize
> at last, the disk information in memory will not be committed to device,
> and will be different from that on device. This might lead to some confusion.
> Becaus user will only see the disk in memory but not the real on device.
> 
> Now in the same situation, parted will raise warning first and decide whether
> to change the disk information according user's response.
Good catch, but not quite the right implementation.  The reason the in
memory disk layout was changed first is because doing so might result in
the end not being exactly where the user requested it, so that must be
done before checking if the end shrank.  Before I made the PedDisk
persist across commands, simply not committing the modified disk and
discarding it was sufficient.  Now this command will need to duplicate
it, modify the temporary copy, and if the exception says to bail out,
discard that temporary copy.
    
    
More information about the parted-devel
mailing list