[parted-devel] "Error: Can't have a partition outside the disk!"

Richard W.M. Jones rjones at redhat.com
Sun Sep 26 16:42:21 UTC 2010


On Wed, Sep 22, 2010 at 01:37:50PM -0700, Brian C. Lane wrote:
> As an alternative can you resize the partitions before you truncate the
> disk image?

We're not touching the original disk image:

http://libguestfs.org/virt-resize.1.html

We _could_ snapshot the original image however which would allow us to
"modify" it without actually modifying it.

> > This is combined with another bug in parted where 'parted mklabel'
> > completely overwrites the first sector, instead of just updating the
> > (MBR) partition table.  The alternative approach would be to use
> > 'parted mklabel' to write a new partition table, but since this
> > destroys the bootloader, we cannot use this method either.
> 
> The bootloader is part of the MBR on sector 0, so I don't see this as a
> bug. mklabel sets up the disk for the selected partitioning scheme,
> removing existing partitions and bootloaders.

The bootloader and partition table are pretty separate.  Just because
they happen to live in the same sector doesn't mean they are the same
structure.  parted really shouldn't touch the bootloader at all when
it creates the partition table.

In any case I'll probably write a small utility which just zaps the
partition table without touching the rest of the bootloader.  Seems
like the easiest way rather than working around the foibles of parted.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html



More information about the parted-devel mailing list