[Libguestfs] virt-resize: support to MBR logical partitions and some question

Richard W.M. Jones rjones at redhat.com
Wed Jun 4 09:02:55 UTC 2014


On Wed, Jun 04, 2014 at 10:21:41AM +0800, Hu Tao wrote:
> Hi,
> 
> I'm adding support to resizing logical partitions(patch is in progess).
> But encounter an error when adding a logical partition in dest image:
> 
>   virt-resize: libguestfs error: part_add: parted: /dev/sdb: Warning: The resulting partition is not properly aligned for best performance.
>   Error: Error informing the kernel about modifications to partition /dev/sdb5 -- Device or resource busy.  This means Linux won't know about any changes you made to /dev/sdb5 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
>   Error: Failed to add partition 5 (Device or resource busy)
> 
> The error is actually no harm since the logical partition has been added
> successfully, and I don't want to inform kernel at all. But it prevents
> virt-resize from adding further logical partitions.
> 
> I can ignore the error when adding logical partitions manually using parted.
> The question is, is there any way to ignore such errors in virt-resize?

This may indicate a bug in the daemon.

Normally after parted runs, it tries to get the kernel to re-read
partition tables.  This can fail because for several reasons -- for
example, because a partition is mounted (and for many other reasons,
including udev and/or the kernel just getting confused.

We try to avoid this if we can by various tricks, eg. see use of
udev_settle function in the daemon.

Can you come up with a minimal reproducer (eg. using just guestfish
commands)?  If so, then file a bug.

>From virt-resize code you can catch and ignore exceptions, but this is
potentially dangerous since it doesn't distinguish between this
"harmless" error and other actual errors.

I'm on holiday at the moment, but I'll try to offer help and advice on
modifying virt-resize when I can.  I'm back next week.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list