Bug 676020

Summary: After using virt-resize with an ntfs partition windows is not booting
Product: [Community] Virtualization Tools Reporter: Javier Ramirez <javilinux>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: javilinux, mbooth, moihn, raud, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-30 15:14:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Javier Ramirez 2011-02-08 16:18:59 UTC
Description of problem:
Using the procedure described below I used virt-resize to increase the expand a windows virtual disk, but the Vrtual Machine is not booting

Version-Release number of selected component (if applicable):
fedora-release-14-1.noarch
libguestfs-1.8.1-1.fc14.x86_64
libvirt-cim-0.5.8-2.fc13.x86_64
kernel-2.6.35.10-74.fc14.x86_64
libguestfs-tools-1.8.1-1.fc14.x86_64
libvirt-0.8.3-2.fc14.x86_64
libvirt-devel-0.8.3-2.fc14.x86_64
libvirt-client-0.8.3-2.fc14.x86_64
libvirt-python-0.8.3-2.fc14.x86_64
libguestfs-tools-c-1.8.1-1.fc14.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Shut down the VM:
# virsh list --all | grep WinXP
  - WinXP                shut off
2. Locate the disk source:
# virsh dumpxml WinXP | xpath /domain/devices/disk/source
Found 1 nodes:
-- NODE --
<source file="/var/lib/libvirt/images/WinXP.img" />
3. Check the filesystems inside that disk image:
# virt-filesystems --long --parts --blkdevs -h -a /var/lib/libvirt/images/WinXP.img 
Name       Type       Size  Parent
/dev/sda1  partition  8.0G  /dev/sda
/dev/sda   device     8.0G  -
4. Create a new disk image bigger than original:
# virsh vol-create-as default WinXPBig.img 15G
Vol WinXPBig.img created
5. Resize the new image expanding the partition:
# virt-resize --expand /dev/sda1 WinXP.img WinXPBig.img
Summary of changes:
/dev/sda1: partition will be resized from 8.0G to 15.0G
/dev/sda1: content will be expanded using the 'ntfsresize' method
Copying /dev/sda1 ...
[############################################################################]----]
Expanding /dev/sda1 using the 'ntfsresize' method
6. Edit the VM XML configuration file to boot from the new disk:
# virsh edit WinXP
Domain WinXP XML configuration edited.
# virsh dumpxml WinXP | xpath /domain/devices/disk/source
Found 1 nodes:
-- NODE --
<source file="/var/lib/libvirt/images/WinXPBig.img" />

7. Boot the new VM
  
Actual results:
Not bootable Windows VM, after starting the VM it get stucked with the message "Booting from Hard Disk..."

Expected results:
Bootable Windows VM

Additional info:

Comment 1 Matthew Booth 2011-02-11 11:10:06 UTC
Javier,

Thanks for the report. Unfortunately Rich is out for a few weeks, so there's unlikely to be any movement on this soon.

Comment 2 Richard W.M. Jones 2011-03-02 07:49:00 UTC
It looks like we've clobbered the boot loader.

Can you try again, adding the --debug option so we get
to see everything that virt-resize is really doing?

Comment 3 Richard W.M. Jones 2011-04-12 17:12:49 UTC
Also please try with the latest virt-resize
from libguestfs 1.9.18.  It has been rewritten,
and it no longer moves the first partition which
should make it less likely to clobber the bootloader.

Comment 4 Javier Ramirez 2011-04-26 19:54:55 UTC
Hi Richard,

Unfortunately I can not reproduce the issue any more since I do not have the necessary files.

Sorry about it.

Regards.

Comment 5 Richard W.M. Jones 2011-04-26 20:36:23 UTC
OK, well let's leave this bug open for a while in case
other people experience the same problem.

Comment 6 moihn 2012-01-17 14:43:01 UTC
I meet the same problem on RHEL 6.2 system.
[root@localhost ~]# rpm -qa | grep guestfs
libguestfs-tools-1.7.17-26.el6.x86_64
libguestfs-1.7.17-26.el6.x86_64
libguestfs-winsupport-1.0-7.el6.x86_64
libguestfs-tools-c-1.7.17-26.el6.x86_64
[root@localhost ~]# rpm -qa | grep winsupport
libguestfs-winsupport-1.0-7.el6.x86_64

I just shutdown a winxp VM, and get the disk qemu-img resized with 4G extra space. Then virt-resize it using the same command, and I meet the same error output when booting the VM with new disk.

I googled around, it seems to be related to wrong BPB in the bootable partition /dev/sda1.

This problem can be easily reproduced with a fresh installed winxp VM, and just shutdown it and try to increase disk NTFS partition size using qemu-img and virt-resize.

Do you have any idea?

Comment 7 Richard W.M. Jones 2012-01-17 14:57:14 UTC
This has been fixed in the latest virt-resize *upstream*.
Please try the version in Fedora 16 or above.

Comment 8 moihn 2012-01-17 16:11:42 UTC
(In reply to comment #7)
> This has been fixed in the latest virt-resize *upstream*.
> Please try the version in Fedora 16 or above.

Thanks, Richard.

Do you mean that in RHEL6 series, there will not be an update or fix for this problem? Actually, we have some VM running on our RHEL6 cluster meeting the same issue.

Anyway, I now workaround it by using guestfish and customized libguestfs application written by me, instead of virt-resize in RHEL6.

Comment 9 Richard W.M. Jones 2012-01-17 16:19:33 UTC
Hopefully this will be fixed in RHEL 6.3 (bug 719879).

Comment 10 Richard W.M. Jones 2012-11-30 15:14:02 UTC
Closing based on comment 9 and lack of feedback otherwise.