GNU bug report logs - #71790
parted -s emits a warning when shrinking a partition

Previous Next

Package: parted;

Reported by: Sean Warner <plica2006 <at> gmail.com>

Date: Thu, 27 Jun 2024 04:30:03 UTC

Severity: normal

Full log


Message #8 received at 71790 <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: Sean Warner <plica2006 <at> gmail.com>
Cc: 71790 <at> debbugs.gnu.org
Subject: Re: bug#71790: parted -s emits a warning when shrinking a partition
Date: Thu, 27 Jun 2024 08:28:55 -0700
On Wed, Jun 26, 2024 at 11:51:38PM +0100, Sean Warner wrote:
> I am also having this bug reported in 2017:
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879555
> 
> $ parted -v
> parted (GNU parted) 3.6
> Copyright (C) 2023 Free Software Foundation, Inc.
> License GPLv3+
> Written by
> <http://git.debian.org/?p=parted/parted.git;a=blob_plain;f=AUTHORS>.
> 
> $ cat /etc/lsb-release 
> DISTRIB_ID="ManjaroLinux"
> DISTRIB_RELEASE="24.0.2"
> DISTRIB_CODENAME="Wynsdey"
> 
> -- If increasing the size of a partition the following command works
> but if shrinking a partition it gives a warning "Warning: Shrinking a
> partition can cause data loss, are you sure you want to continue?" and
> the command just exits back to the command prompt and no changes are
> made to the partition.
> 
> sudo parted -s /dev/loop0 resizepart 1 46280703s
> 
> I assumed that parted -s would automatically supply a default value of
> 'Yes' in this instance?

No, in script mode parted defaults to the safe option. Automatically
saying yes will lead to data loss so it defaults to know. I admit the
message is misleading, this is because of how parted handles warnings
like this and it could use some improvement.

I don't really have any suggestion for working around this other than
doing it in interactive mode.

> input-tty <-- But is this safe to keep using if not documented? Any
> plans to make ---pretend-input-tty an official "thing" in Parted?

No, it's there for the tests. But there's no plan to remove it since the
tests depend on it. But I really don't recommend automating things that
could lose data.

Brian

-- 
Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart





This bug report was last modified 1 year and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.