<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Re-send because it looks like this message was buried in archive and
    not sent to subscribers.<br>
    <br>
    <div class="moz-forward-container"><br>
      -------- Forwarded Message --------
      <table class="moz-email-headers-table" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
            </th>
            <td>Re: [Libguestfs] Bug: windows server 2012R2 fails to
              start after virt-resize</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
            <td>Thu, 10 Dec 2015 16:34:01 +0300</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
            <td>Maxim Perevedentsev <a class="moz-txt-link-rfc2396E" href="mailto:mperevedentsev@virtuozzo.com"><mperevedentsev@virtuozzo.com></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:libguestfs@redhat.com">libguestfs@redhat.com</a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      On 12/10/2015 02:55 PM, Pino Toscano wrote:<br>
      <blockquote
        cite="mid:3589851.OXo1xVFzer@pendragon.usersys.redhat.com"
        type="cite">
        <pre wrap="">On Thursday 10 December 2015 13:55:26 Maxim Perevedentsev wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">Hello everyone!

After I ran virt-resize (v1.31.28) on my disk with win2012R2
(partition table [GPT]: VFAT (100M), unknown (128M), NTFS (64G))
My VM fails to boot: black screen informing that

Windows failed to start...
Status: 0xc000000e
Info: an unexpected error has occured.

After some investigations, I realized that Windows remembers the GUID of 
disk it is installed to.
If I execute

 >guestfish -a win2012.hdd -v
...
 ><fs> debug sh 'sgdisk -p /dev/sda'
guestfsd: main_loop: new request, len 0x54
/bin/sh -c sgdisk -p /dev/sda
Disk /dev/sda: 136314880 sectors, 65.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): B3108127-1775-47B7-ABC1-A56D6761C894
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 136314846
Partitions will be aligned on 2048-sector boundaries
Total free space is 2101181 sectors (1.0 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048          206847   100.0 MiB   EF00  EFI
    2          206848          468991   128.0 MiB   0C01  Microsoft
    3          468992       134215679   63.8 GiB    0700  Basic
guestfsd: main_loop: proc 76 (debug) took 0.00 seconds

*set the GUID of original disk*
 ><fs> debug sh 'sgdisk -U ADAA2225-3F89-4F2C-91DF-02F3E0C2ED67 /dev/sda'
guestfsd: main_loop: new request, len 0x7c
/bin/sh -c sgdisk -U ADAA2225-3F89-4F2C-91DF-02F3E0C2ED67 /dev/sda
[   70.170139]  sda: sda1 sda2 sda3
The operation has completed successfully.
guestfsd: main_loop: proc 76 (debug) took 1.02 seconds
The operation has completed successfully.

After that Windows successfully boots from resized image.

I suggest adding get/set disk GUID to API and to virt-resize as well.
Otherwise it is impossible to resize disks with this particular OS (not 
only this one, possibly).
</pre>
        </blockquote>
        <pre wrap="">This is supposed to be done already, see
  <a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://bugzilla.redhat.com/show_bug.cgi?id=1189284">https://bugzilla.redhat.com/show_bug.cgi?id=1189284</a>
(and the commits linked to its comment #9).</pre>
      </blockquote>
      This is another bug: the fixed one was about partition GUIDs. <br>
      Now partition GUIDs are preserved, but the OS refuses to boot
      because of <br>
      changed *disk* GUID.<br>
      <blockquote
        cite="mid:3589851.OXo1xVFzer@pendragon.usersys.redhat.com"
        type="cite">
        <pre wrap="">
Please provide a full log of virt-resize with -v -x.
</pre>
      </blockquote>
      OK, attached.<br>
      <blockquote
        cite="mid:3589851.OXo1xVFzer@pendragon.usersys.redhat.com"
        type="cite">
        <pre wrap="">
</pre>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Libguestfs mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Libguestfs@redhat.com">Libguestfs@redhat.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libguestfs">https://www.redhat.com/mailman/listinfo/libguestfs</a></pre>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
Your sincerely,
Maxim Perevedentsev</pre>
      <br>
    </div>
    <br>
  </body>
</html>