[parted-devel] [PATCH v2] parted: Fix resizepart command

Phil Susi psusi at ubuntu.com
Thu Sep 21 13:29:12 UTC 2017


On 9/21/2017 5:16 AM, Sebastian Parschauer wrote:
> In script mode the resizepart warnings about the busy partition
> and shrinking the partition are shown. Parted fails in this case.
> So skip that in script mode and just do what is requested. Do that
> directly in _partition_warn_busy() to also fix do_rm().

We don't want to suppress the warnings in script mode.  Even if the
default is to proceed anyway, it is good to see the warnings in logs.

> -        if (part->geom.end < oldend)
> +        if (!opt_script_mode && (part->geom.end < oldend))
>                  if (ped_exception_throw (
>                              PED_EXCEPTION_WARNING,
>                              PED_EXCEPTION_YES_NO,
> 

This removes the prohibition on scripts accidentally shrinking a
partition and likely destroying data.  I'm not sure that I like that,
but it at least should be mentioned in the NEWS, and again, even if we
proceed by default, it is good to at least print the warning.

I always intended to come up with some way for a script that really
wants to shrink an in use partition to indicate that so as to bypass
this check, but otherwise to keep an errant script from trashing data.
Unfortunately because of the libparted/parted dichotomy, I haven't been
able to come up with a decent way of doing that.  Without the ability to
do that, perhaps it does make sense to allow it, even though it
increases risk of data loss, since otherwise a script that wants to do
this can't.




More information about the parted-devel mailing list