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

Brian C. Lane bcl at redhat.com
Wed Sep 22 20:37:50 UTC 2010


On Wed, Sep 22, 2010 at 12:04:38PM +0100, Richard W.M. Jones wrote:
> On Wed, Sep 15, 2010 at 05:47:23PM +0200, Jim Meyering wrote:

[snip]

> > What is your use case?  It seems rather unusual
> > to want to do something with existing partitions
> > once you have shrunk the underlying device.
> > IMHO, that is not enough of a reason to remove
> > the offending check altogether.
> 
> We want to shrink the disk, then recreate the partition table, but at
> the same time preserve the boot sector and boot loader.  To do this we
> copy the blocks at the start of the disk (up to just before the first
> partition), then attach to this disk and remove the existing
> partitions.  The parted program fails at this point.
> 

Can you explain why you are doing this? 

As an alternative can you resize the partitions before you truncate the
disk image?

> 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.

> 
> So there is no way for us, using the 'parted' program, to do what we
> want.
> 

It would help me understand this if you could explain some background as
to why you are trying to do things this way.

-- 
Brian C. Lane / Anaconda Team
Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 517 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20100922/78704dac/attachment.pgp>


More information about the parted-devel mailing list