Just to remind: I am waiting for reaction on this issue.

I will create a patch for part_get/set_disk_guid, if you agree this feature is useful.
Thanks!

On 12/10/2015 04:34 PM, Maxim Perevedentsev wrote:
On 12/10/2015 02:55 PM, Pino Toscano wrote:
On Thursday 10 December 2015 13:55:26 Maxim Perevedentsev wrote:
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).
This is supposed to be done already, see
  https://bugzilla.redhat.com/show_bug.cgi?id=1189284
(and the commits linked to its comment #9).
This is another bug: the fixed one was about partition GUIDs.
Now partition GUIDs are preserved, but the OS refuses to boot because of
changed *disk* GUID.
Please provide a full log of virt-resize with -v -x.
OK, attached.

        

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Your sincerely,
Maxim Perevedentsev


_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Your sincerely,
Maxim Perevedentsev