On Wed, Nov 06, 2013 at 10:58:06AM +0800, Xinglong Wu wrote:I can see why this would happen.
> 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.
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.
It won't fix your problem, but there is a newer version of libguestfs
> 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
available for RHEL 6 users:
https://www.redhat.com/archives/libguestfs/2013-May/msg00100.html
Virt-resize cannot resize individual logical partitions. It can only
> 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?
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