<div dir="ltr"><div>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. <br><br></div>Xinglong<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Nov 6, 2013 at 8:00 PM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, Nov 06, 2013 at 10:58:06AM +0800, Xinglong Wu wrote:<br>
> Hi,<br>
><br>
>      I'm using virt-resize to expand the primary partition (C:) in a<br>
> Windows 2003 image. The command works fine but after expanding, when I boot<br>
> into Windows 2003, all the other partitions (D:, E:, and F:) are lost.<br>
<br>
</div>I can see why this would happen.<br>
<br>
In the Windows registry, Windows stores drive letter mappings using a<br>
(basically crazy) system using the partition offset.  It is described here:<br>
<br>
  <a href="http://www.goodells.net/multiboot/partsigs.shtml" target="_blank">http://www.goodells.net/multiboot/partsigs.shtml</a><br>
  "How does Windows XP remember drive letters?"<br>
<br>
We implement this in libguestfs:<br>
<br>
  <a href="https://github.com/libguestfs/libguestfs/blob/aee6fc4863c170d08e572dbdcfcb6f328edfc013/src/inspect-fs-windows.c#L545" target="_blank">https://github.com/libguestfs/libguestfs/blob/aee6fc4863c170d08e572dbdcfcb6f328edfc013/src/inspect-fs-windows.c#L545</a><br>

<br>
Virt-resize moves partitions around, so of course the partition offset<br>
changes and we don't update the registry to reflect this.  As a result<br>
Windows cannot find the D:/E:/... partitions any longer.  (I believe<br>
the C: drive probably works a bit differently, so the C: drive isn't "lost").<br>
<br>
Anyway, we could conceivably fix up the Registry in virt-resize.  You<br>
would need to file an RFE bug:<br>
<br>
  <a href="http://libguestfs.org/guestfs-faq.1.html#how-do-i-propose-a-feature" target="_blank">http://libguestfs.org/guestfs-faq.1.html#how-do-i-propose-a-feature</a><br>
<br>
Patches would be even better, since I don't know when we'd get around<br>
to fixing such a complex corner-case.<br>
<div class="im"><br>
> After using the disk management tool within Windows 2003, I can re-label<br>
> the above three partitions and all the files are still there. But it is<br>
> really annoying because every time you have to do some work by hand after<br>
> expanding the disk size. As below is the details:<br>
><br>
> Host OS: RHEL6.3<br>
> libguestfs: libguestfs-1.16.19-1.el6.x86_64<br>
>                  libguestfs-tools-c-1.16.19-1.el6.x86_64<br>
>                  libguestfs-winsupport-1.0-7.el6.x86_64<br>
<br>
</div>It won't fix your problem, but there is a newer version of libguestfs<br>
available for RHEL 6 users:<br>
<br>
<a href="https://www.redhat.com/archives/libguestfs/2013-May/msg00100.html" target="_blank">https://www.redhat.com/archives/libguestfs/2013-May/msg00100.html</a><br>
<div class="im"><br>
> Guest OS partitions:<br>
>            C:    /dev/sda1  primary<br>
>            D:    /dev/sda5  logical<br>
>            E:    /dev/sda6  logical<br>
>            F:    /dev/sda7  logical<br>
><br>
> Also, if I use virt-resize on logical partitions (i.e., D: E: or F:), the<br>
> command runs fine but logical partitions don't actually expand. Exactly the<br>
> same problem as descripted above shows up, and now, these logical<br>
> partitions don't even change their sizes. Any suggestions?<br>
<br>
</div>Virt-resize cannot resize individual logical partitions.  It can only<br>
resize the extended partition that contains the logical partitions.  See:<br>
<br>
<a href="http://libguestfs.org/virt-resize.1.html#logical-partitions" target="_blank">http://libguestfs.org/virt-resize.1.html#logical-partitions</a><br>
<br>
This is not expected to change any time soon.<br>
<br>
Rich.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones
virt-p2v" target="_blank">http://people.redhat.com/~rjones<br>
virt-p2v</a> converts physical machines to virtual machines.  Boot with a<br>
live CD or over the network (PXE) and turn machines into KVM guests.<br>
<a href="http://libguestfs.org/virt-v2v" target="_blank">http://libguestfs.org/virt-v2v</a><br>
</font></span></blockquote></div><br></div>