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).

And yeah, libguestfs strips partition names, but windows seems to ignore that.

Waiting for comments.

--
Your sincerely,
Maxim Perevedentsev

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to