On Wed, Jun 04, 2014 at 10:02:55AM +0100, Richard W.M. Jones wrote:
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.
It seems udev_settle() doesn't help in the case. I think I need to digg
more of the code for a sulation.
Can you come up with a minimal reproducer (eg. using just guestfish
commands)? If so, then file a bug.
No, because guestfish doens't support adding logical partition but the
problem is reproduced with logical partition only.
>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.
Cool!
Hu