GNU bug report logs - #24167
Way to tell parted to resize partition to max size?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: parted; Reported by: Petter Reinholdtsen <pere@HIDDEN>; dated Sat, 6 Aug 2016 07:00:02 UTC; Maintainer for parted is bug-parted@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Aug 2016 23:36:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 12 19:36:40 2016
Received: from localhost ([127.0.0.1]:55573 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bYM0G-00035z-Ft
	for submit <at> debbugs.gnu.org; Fri, 12 Aug 2016 19:36:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53969)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <Tom_Roche@HIDDEN>) id 1bYM0E-00035n-Kj
 for submit <at> debbugs.gnu.org; Fri, 12 Aug 2016 19:36:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Tom_Roche@HIDDEN>) id 1bYM08-0000Ig-GF
 for submit <at> debbugs.gnu.org; Fri, 12 Aug 2016 19:36:33 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:53227)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <Tom_Roche@HIDDEN>) id 1bYM08-0000IV-Cq
 for submit <at> debbugs.gnu.org; Fri, 12 Aug 2016 19:36:32 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44935)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <Tom_Roche@HIDDEN>) id 1bYM06-00063M-4X
 for bug-parted@HIDDEN; Fri, 12 Aug 2016 19:36:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Tom_Roche@HIDDEN>) id 1bYM02-0000I9-Sa
 for bug-parted@HIDDEN; Fri, 12 Aug 2016 19:36:30 -0400
Received: from pb-smtp2.pobox.com ([64.147.108.71]:54131
 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <Tom_Roche@HIDDEN>) id 1bYM02-0000Hu-MY
 for bug-parted@HIDDEN; Fri, 12 Aug 2016 19:36:26 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-smtp2.pobox.com (Postfix) with ESMTP id A1301350B7;
 Fri, 12 Aug 2016 19:36:23 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to
 :subject:reply-to:date:message-id:mime-version:content-type; s=
 sasl; bh=KkMtA2o2UE7gJ1qJ7blO9IFsPlU=; b=LMFV9uh49T/h0oK3+DAK45S
 eFYGplyw0WyGJZXF6TrVP9R9u+Wcv0o8pwzw8cE3QlA5I5CwWU//IpC+tIZyv9vk
 yaN7rXn4w1iiNM9Q8lALz+zruMFYiEaMy2OJ59WfBBsmqXJU2oQyJoMNiBUOthoM
 IItkOxgJtidvs4VzmMGM=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject
 :reply-to:date:message-id:mime-version:content-type; q=dns; s=
 sasl; b=QZ6YroVgSnQe10M8MTkRNEJBgX9v+kBUOw+WeS70zG7EnjUEEOFJDNJQ
 otEG6UMP4rN+uxSvJFbe5yVorFGr/b//Dim6n+g62PD4o1UWC13/HVzMTNKfpR0J
 XrZKdIVWL20DnGsrTG7TdqiqKPUJf5C00vwF3TYCLcuMyd/7Z/M=
Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-smtp2.pobox.com (Postfix) with ESMTP id 98ADD350B6;
 Fri, 12 Aug 2016 19:36:23 -0400 (EDT)
Received: from tlrW510.pobox.com (unknown [173.20.44.153])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by pb-smtp2.pobox.com (Postfix) with ESMTPSA id E6CFF350B5;
 Fri, 12 Aug 2016 19:36:22 -0400 (EDT)
From: Tom Roche <Tom_Roche@HIDDEN>
To: bug-parted@HIDDEN, 
Subject: Re: bug#24167: Way to tell parted to resize partition to max size?
User-Agent: GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
Date: Fri, 12 Aug 2016 16:36:21 -0700
Message-ID: <8760r5ftl6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 94296E46-60E5-11E6-A549-EE617A1B28F4-07218935!pb-smtp2.pobox.com
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.4 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: bug-parted@HIDDEN, Tom Roche <Tom_Roche@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.4 (----)


[footnotes after .sig]

Petter Reinholdtsen[1]
> With btrfs I can do like this to extend to the end of the partition:

>   btrfs filesystem resize max /

> Could parted be changed to allow something similar?  Perhaps

>   resizepart 1 max

WARNING: I have not tried this! but I believe you want `-1`, e.g.

    resizepart 1 -1

I am basing this on the knowledge that

    sudo parted ${DRIVE_DEV} --script -- mkpart primary 0 -1

I concur (presuming it works :-) that note of the semantics of `-1` should be added to the manual, e.g. here[2] and here[3]. Note the manual[2] does state clearly

>> When growing a partition you will want to grow the filesystem afterwards, but
>> when shrinking, you need to shrink the filesystem before the partition. 

HTH, Tom Roche <Tom_Roche@HIDDEN>

[1]: http://lists.gnu.org/archive/html/bug-parted/2016-08/msg00001.html
[2]: https://www.gnu.org/software/parted/manual/parted.html#resizepart
[3]: https://www.gnu.org/software/parted/manual/parted.html#mkpart




Information forwarded to bug-parted@HIDDEN:
bug#24167; Package parted. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 Aug 2016 06:59:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 06 02:59:13 2016
Received: from localhost ([127.0.0.1]:57083 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bVvZh-0002BL-K7
	for submit <at> debbugs.gnu.org; Sat, 06 Aug 2016 02:59:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57455)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pre@HIDDEN>) id 1bVvZ4-00029v-6e
 for submit <at> debbugs.gnu.org; Sat, 06 Aug 2016 02:58:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pre@HIDDEN>) id 1bVvYy-0004zw-7m
 for submit <at> debbugs.gnu.org; Sat, 06 Aug 2016 02:58:28 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:41384)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pre@HIDDEN>) id 1bVvYy-0004zq-4n
 for submit <at> debbugs.gnu.org; Sat, 06 Aug 2016 02:58:28 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48426)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pre@HIDDEN>) id 1bVvYv-0000zw-RN
 for bug-parted@HIDDEN; Sat, 06 Aug 2016 02:58:26 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <pre@HIDDEN>) id 1bVvYr-0004zH-K4
 for bug-parted@HIDDEN; Sat, 06 Aug 2016 02:58:24 -0400
Received: from mail-out5.uio.no ([129.240.10.17]:46194)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <pre@HIDDEN>) id 1bVvYr-0004z6-CO
 for bug-parted@HIDDEN; Sat, 06 Aug 2016 02:58:21 -0400
Received: from mail-mx4.uio.no ([129.240.10.45])
 by mail-out5.uio.no with esmtp (Exim 4.80.1)
 (envelope-from <pre@HIDDEN>) id 1bVvYe-000621-JT
 for bug-parted@HIDDEN; Sat, 06 Aug 2016 08:58:08 +0200
Received: from diskless.uio.no ([129.240.6.26])
 by mail-mx4.uio.no with esmtp  (Exim 4.80)
 (envelope-from <pre@HIDDEN>)
 id 1bVvYe-0004Fq-5Q; Sat, 06 Aug 2016 08:58:08 +0200
Received: from pre by diskless.uio.no with local (Exim 4.72)
 (envelope-from <pre@HIDDEN>)
 id 1bVvYd-0003kI-OW; Sat, 06 Aug 2016 08:58:07 +0200
From: Petter Reinholdtsen <pere@HIDDEN>
To: bug-parted@HIDDEN
Subject: Way to tell parted to resize partition to max size?
User-Agent: Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1
 (i586-pc-linux-gnu)
Date: Sat, 06 Aug 2016 08:58:07 +0200
Message-ID: <2fltweyz8n4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-UiO-Ratelimit-Test: rcpts/h 6 msgs/h 3 sum rcpts/h 8 sum msgs/h 3 total
 rcpts 35329 max rcpts/h 80 ratelimit 0
X-UiO-Spam-info: not spam, SpamAssassin (score=-6.5, required=5.0,
 autolearn=disabled, RP_MATCHES_RCVD=-1.532, UIO_MAIL_IS_INTERNAL=-5, uiobl=NO,
 uiouri=NO)
X-UiO-Scanned: D848C64923EDAEB17A97320452875EF9EFE82CC2
X-UiO-SPAM-Test: remote_host: 129.240.6.26 spam_score: -64 maxlevel 80
 minaction 0 bait 0 mail/h: 3 total 11608 max/h 60 blacklist 0 greylist 1
 ratelimit 0
X-UiOonly: 0892F78D994573FBA6D0AB555309AE6B725CB557
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 06 Aug 2016 02:59:11 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)


Hi.

I checked the manual page, texinfo documentation and the source, but
were unable to find a way to do this.

Is there a way to tell parted to resize a partition to the maximum
possible.  In other words, to the end of the disk or until it meet a new
partition on the disk geometry?

With btrfs I can do like this to extend to the end of the partition:

  btrfs filesystem resize max /

Could parted be changed to allow something similar?  Perhaps

  resizepart 1 max

I had a look at the code, and suspect something like this might work,
but I do not know the parted inner workings enough to figure out where
to get the max_end value.


--- parted-3.2.orig/parted/parted.c
+++ parted-3.2/parted/parted.c
@@ -1522,6 +1522,7 @@ do_resizepart (PedDevice** dev, PedDisk*
         PedSector               start, end, oldend;
         PedGeometry             *range_end = NULL;
         PedConstraint*          constraint;
+        char                    *end_raw;
         int rc = 0;
 
         if (!disk) {
@@ -1543,8 +1544,12 @@ do_resizepart (PedDevice** dev, PedDisk*
 
         start = part->geom.start;
         end = oldend = part->geom.end;
-        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, NULL))
-                goto error;
+        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_raw))
+                if (0 == strcmp('max', end_raw) {
+                        end = max_end;
+                } else {
+                        goto error;
+                }
         /* Do not move start of the partition */
         constraint = constraint_from_start_end_fixed_start (*dev, start, range_end);
         if (!ped_disk_set_partition_geom (disk, part, constraint,



-- 
Happy hacking
Petter Reinholdtsen




Acknowledgement sent to Petter Reinholdtsen <pere@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-parted@HIDDEN. Full text available.
Report forwarded to bug-parted@HIDDEN:
bug#24167; Package parted. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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