If you take a virtual disk and truncate it, then likely some
partitions in the partition table will be off the end of the disk.

However parted refuses to start up in this case.  It says:

  Error: Can't have a partition outside the disk!

even if you are trying to do something sensible such as deleting a
partition which is outside the disk.

I can't really see a "good" way to solve this, since it happens in the
depths of the constraints/geometry code.  The attached patch just
deletes the error check, on the basis that parted should confine
itself to partition tables and not worry about the size of the disk.
Discuss ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
>From 864ae5b4d6ed596a4d489a6cda52be844d3f010e Mon Sep 17 00:00:00 2001
From: Richard Jones <[email protected]>
Date: Tue, 14 Sep 2010 15:07:52 +0100
Subject: [PATCH] geom: Don't check if partition is inside the disk.

---
 libparted/cs/geom.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/libparted/cs/geom.c b/libparted/cs/geom.c
index 636a966..aa7c3dc 100644
--- a/libparted/cs/geom.c
+++ b/libparted/cs/geom.c
@@ -163,13 +163,6 @@ ped_geometry_set (PedGeometry* geom, PedSector start, 
PedSector length)
                           " (start sector=%jd length=%jd)"), start, length);
                return 0;
        }
-       if (start < 0 || start + length - 1 >= geom->dev->length) {
-               ped_exception_throw (
-                       PED_EXCEPTION_ERROR,
-                       PED_EXCEPTION_CANCEL,
-                       _("Can't have a partition outside the disk!"));
-               return 0;
-       }
 
        geom->start = start;
        geom->length = length;
-- 
1.7.1

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to