Hi, I'm using virt-resize to expand the primary partition (C:) in a Windows 2003 image. The command works fine but after expanding, when I boot into Windows 2003, all the other partitions (D:, E:, and F:) are lost. After using the disk management tool within Windows 2003, I can re-label the above three partitions and all the files are still there. But it is really annoying because every time you have to do some work by hand after expanding the disk size. As below is the details: Host OS: RHEL6.3 libguestfs: libguestfs-1.16.19-1.el6.x86_64 libguestfs-tools-c-1.16.19-1.el6.x86_64 libguestfs-winsupport-1.0-7.el6.x86_64 Guest OS partitions: C: /dev/sda1 primary D: /dev/sda5 logical E: /dev/sda6 logical F: /dev/sda7 logical Also, if I use virt-resize on logical partitions (i.e., D: E: or F:), the command runs fine but logical partitions don't actually expand. Exactly the same problem as descripted above shows up, and now, these logical partitions don't even change their sizes. Any suggestions? Xinglong
Richard W.M. Jones
2013-Nov-06 12:00 UTC
Re: [Libguestfs] virt-resize problem for Windows 2003
On Wed, Nov 06, 2013 at 10:58:06AM +0800, Xinglong Wu wrote:> Hi, > > I'm using virt-resize to expand the primary partition (C:) in a > Windows 2003 image. The command works fine but after expanding, when I boot > into Windows 2003, all the other partitions (D:, E:, and F:) are lost.I can see why this would happen. In the Windows registry, Windows stores drive letter mappings using a (basically crazy) system using the partition offset. It is described here: http://www.goodells.net/multiboot/partsigs.shtml "How does Windows XP remember drive letters?" We implement this in libguestfs: https://github.com/libguestfs/libguestfs/blob/aee6fc4863c170d08e572dbdcfcb6f328edfc013/src/inspect-fs-windows.c#L545 Virt-resize moves partitions around, so of course the partition offset changes and we don't update the registry to reflect this. As a result Windows cannot find the D:/E:/... partitions any longer. (I believe the C: drive probably works a bit differently, so the C: drive isn't "lost"). Anyway, we could conceivably fix up the Registry in virt-resize. You would need to file an RFE bug: http://libguestfs.org/guestfs-faq.1.html#how-do-i-propose-a-feature Patches would be even better, since I don't know when we'd get around to fixing such a complex corner-case.> After using the disk management tool within Windows 2003, I can re-label > the above three partitions and all the files are still there. But it is > really annoying because every time you have to do some work by hand after > expanding the disk size. As below is the details: > > Host OS: RHEL6.3 > libguestfs: libguestfs-1.16.19-1.el6.x86_64 > libguestfs-tools-c-1.16.19-1.el6.x86_64 > libguestfs-winsupport-1.0-7.el6.x86_64It won't fix your problem, but there is a newer version of libguestfs available for RHEL 6 users: https://www.redhat.com/archives/libguestfs/2013-May/msg00100.html> Guest OS partitions: > C: /dev/sda1 primary > D: /dev/sda5 logical > E: /dev/sda6 logical > F: /dev/sda7 logical > > Also, if I use virt-resize on logical partitions (i.e., D: E: or F:), the > command runs fine but logical partitions don't actually expand. Exactly the > same problem as descripted above shows up, and now, these logical > partitions don't even change their sizes. Any suggestions?Virt-resize cannot resize individual logical partitions. It can only resize the extended partition that contains the logical partitions. See: http://libguestfs.org/virt-resize.1.html#logical-partitions This is not expected to change any time soon. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Thanks for the reply! And sorry that I'm unable to provide such a patch at this stage, but filed the bug report. Hopefully the bug can fixed in the near future. Xinglong On Wed, Nov 6, 2013 at 8:00 PM, Richard W.M. Jones <rjones@redhat.com>wrote:> On Wed, Nov 06, 2013 at 10:58:06AM +0800, Xinglong Wu wrote: > > Hi, > > > > I'm using virt-resize to expand the primary partition (C:) in a > > Windows 2003 image. The command works fine but after expanding, when I > boot > > into Windows 2003, all the other partitions (D:, E:, and F:) are lost. > > I can see why this would happen. > > In the Windows registry, Windows stores drive letter mappings using a > (basically crazy) system using the partition offset. It is described here: > > http://www.goodells.net/multiboot/partsigs.shtml > "How does Windows XP remember drive letters?" > > We implement this in libguestfs: > > > https://github.com/libguestfs/libguestfs/blob/aee6fc4863c170d08e572dbdcfcb6f328edfc013/src/inspect-fs-windows.c#L545 > > Virt-resize moves partitions around, so of course the partition offset > changes and we don't update the registry to reflect this. As a result > Windows cannot find the D:/E:/... partitions any longer. (I believe > the C: drive probably works a bit differently, so the C: drive isn't > "lost"). > > Anyway, we could conceivably fix up the Registry in virt-resize. You > would need to file an RFE bug: > > http://libguestfs.org/guestfs-faq.1.html#how-do-i-propose-a-feature > > Patches would be even better, since I don't know when we'd get around > to fixing such a complex corner-case. > > > After using the disk management tool within Windows 2003, I can re-label > > the above three partitions and all the files are still there. But it is > > really annoying because every time you have to do some work by hand after > > expanding the disk size. As below is the details: > > > > Host OS: RHEL6.3 > > libguestfs: libguestfs-1.16.19-1.el6.x86_64 > > libguestfs-tools-c-1.16.19-1.el6.x86_64 > > libguestfs-winsupport-1.0-7.el6.x86_64 > > It won't fix your problem, but there is a newer version of libguestfs > available for RHEL 6 users: > > https://www.redhat.com/archives/libguestfs/2013-May/msg00100.html > > > Guest OS partitions: > > C: /dev/sda1 primary > > D: /dev/sda5 logical > > E: /dev/sda6 logical > > F: /dev/sda7 logical > > > > Also, if I use virt-resize on logical partitions (i.e., D: E: or F:), the > > command runs fine but logical partitions don't actually expand. Exactly > the > > same problem as descripted above shows up, and now, these logical > > partitions don't even change their sizes. Any suggestions? > > Virt-resize cannot resize individual logical partitions. It can only > resize the extended partition that contains the logical partitions. See: > > http://libguestfs.org/virt-resize.1.html#logical-partitions > > This is not expected to change any time soon. > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat > http://people.redhat.com/~rjones > virt-p2v converts physical machines to virtual machines. Boot with a > live CD or over the network (PXE) and turn machines into KVM guests. > http://libguestfs.org/virt-v2v >
Maybe Matching Threads
- Re: virt-resize problem for Windows 2003
- virt-resize Fatal error: exception Guestfs.Error("e2fsck_f
- Introducing an Alignment object in LLVM
- [OT] CentOS 5 and Inspiron 6400 [WAS: CentOS 5 - Issues with multimedia]
- Live migration with non-shared storage leads to corrupted file system