[Parted-maintainers] Bug#419473: parted: Raw partition resizing support

Thadeu Lima de Souza Cascardo cascardo at minaslivre.org
Sun Apr 15 22:09:48 UTC 2007


Package: parted
Version: 1.7.1-5.1
Severity: wishlist

The following patch adds a 'rawresize' command, which allows raw
partition resizing.


-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.20-git14-20070219 (PREEMPT)
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US.ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages parted depends on:
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libncurses5                 5.5-5        Shared libraries for terminal hand
ii  libparted1.7-1              1.7.1-5.1    The GNU Parted disk partitioning s
ii  libreadline5                5.2-2        GNU readline and history libraries

parted recommends no packages.

-- no debconf information
-------------- next part --------------
--- /tmp/BxwBwbvkBd/parted-1.7.1/parted/parted.c	2007-03-06 06:08:52.000000000 -0300
+++ /tmp/dEReYjRtJz/parted-1.7.1/parted/parted.c	2007-04-15 18:20:01.000000000 -0300
@@ -1569,7 +1569,7 @@
 }
 
 static int
-do_resize (PedDevice** dev)
+do_realresize (PedDevice** dev, int raw)
 {
         PedDisk                 *disk;
         PedPartition            *part = NULL;
@@ -1585,7 +1585,7 @@
 
         if (!command_line_get_partition (_("Partition number?"), disk, &part))
                 goto error_destroy_disk;
-        if (part->type != PED_PARTITION_EXTENDED) {
+        if (part->type != PED_PARTITION_EXTENDED && !raw) {
                 if (!_partition_warn_busy (part))
                         goto error_destroy_disk;
         }
@@ -1602,7 +1602,7 @@
         snap_to_boundaries (&new_geom, &part->geom, disk,
                             range_start, range_end);
 
-        if (part->type == PED_PARTITION_EXTENDED) {
+        if (part->type == PED_PARTITION_EXTENDED || raw) {
                 constraint = constraint_from_start_end (*dev,
                                 range_start, range_end);
                 if (!ped_disk_set_partition_geom (disk, part, constraint,
@@ -1650,6 +1650,16 @@
         return 0;
 }
 
+static int do_resize (PedDevice** dev)
+{
+  return do_realresize (dev, 0);
+}
+
+static int do_rawresize (PedDevice** dev)
+{
+  return do_realresize (dev, 1);
+}
+
 static int
 do_rm (PedDevice** dev)
 {
@@ -2020,6 +2030,17 @@
                          _(resize_fs_type_msg), NULL), 1));
 
 command_register (commands, command_create (
+        str_list_create_unique ("rawresize", _("rawresize"), NULL),
+        do_rawresize,
+        str_list_create (
+_("rawresize NUMBER START END                  resize partition NUMBER but not "
+"its file system"),
+NULL),
+        str_list_create (_(number_msg),
+                         _(start_end_msg),
+                         _(resize_fs_type_msg), NULL), 1));
+
+command_register (commands, command_create (
         str_list_create_unique ("rm", _("rm"), NULL),
         do_rm,
         str_list_create (


More information about the Parted-maintainers mailing list