Hu Tao
2014-Jun-04 02:21 UTC
[Libguestfs] virt-resize: support to MBR logical partitions and some question
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? Regards, Hu Tao
Richard W.M. Jones
2014-Jun-04 09:02 UTC
Re: [Libguestfs] virt-resize: support to MBR logical partitions and some question
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 ispotentially 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
Hu Tao
2014-Jun-09 09:36 UTC
Re: [Libguestfs] virt-resize: support to MBR logical partitions and some question
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
Hu Tao
2014-Jul-15 07:45 UTC
Re: [Libguestfs] virt-resize: support to MBR logical partitions and some question
Hi Rich, 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. > > Can you come up with a minimal reproducer (eg. using just guestfish > commands)? If so, then file a bug.guestfish just works with my patch(attached): --- [root@f20-x64 libguestfs-git]# rm -f delme.img && truncate -s 5G delme.img && ./run guestfish -a delme.img <<EOF run part-init /dev/sda msdos part-add /dev/sda extended 512 -1 part-add /dev/sda logical 2049 -1 EOF [root@f20-x64 libguestfs-git]# fish/guestfish -a delme.img <<EOF run list-partitions EOF /dev/sda1 /dev/sda5 --- But virt-resize doesn't. The error message is: Setting up initial partition table on test.img ... 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) This is the same as I reported earlier. At this time /dev/sdb has been added successfully despite of the error message. But the bad is I can't write to /dev/sdb5, aka copy /dev/sda5 to /dev/sdb5. The error message is: --- Setting up initial partition table on test.img ... Copying /dev/sda1 ... 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00 Copying /dev/sda2 ... 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00 Copying /dev/sda3 ... Copying /dev/sda5 ... virt-resize: libguestfs error: copy_device_to_device: copy_device_to_device_stub: /dev/sdb5: No such file or directory --- The solution could be: 1. as the error message suggests, rebooting. But I don't known how since it runs in an applicance if I'm right. 2. fix parted informing the kernel about modifications to partitions. Do you have any insight of this? If you think this is a possible solution I'll start invetigate it. Regards, Hu
Seemingly Similar Threads
- Re: virt-resize: support to MBR logical partitions and some question
- [PATCH v3 0/7] add support to resize MBR logical partitions
- [PATCH v2 00/13] virt-resize: add support for resizing MBR logical partitions
- Re: [PATCH v3 5/7] resize: add function mbr_part_type
- Re: [PATCH v2 08/13] resize: add function mbr_part_type