I have a PC laptop with Windows 10, it has two hard drives, one for windows that is separated with UEFI, windows and data partition, and another hard drive that has some more apps installed on it.
I am trying to duplicate that system to be able to run it on virt-manager under Gentoo Linux.
So first I duplicated the hard drives using disk2hd (https://docs.microsoft.com/en-us/sysinternals/downloads/disk2vhd), it created two separated VHDX files for each hard drive.
Then I converted these images to qcow2, a format that virt-manager is familiar with using qemu-img with these flags:
qemu-img convert -p -f vhdx -O qcow2
I mounted the qcow2 and verified that the files are presented and that the images are correct.
then I ran virt-manager, enabled UEFI and configured it to boot from the main hard drive. windows fails to boot. when I tried to run windows recovery it could not fix the startup failure.
I googled and I found that the only real way to fix windows boot is to download windows, and run an upgrade on the current windows system.so I did that, I downloaded the ISO, booted it on virt-manager but I could not upgrade, it failed to detect a previous windows installation on the drive.
Then I thought about reinstalling Windows on that partition, and then overwriting the new Windows files with the old ones by deleting the ProgramData, Users, Program Files and Windows directory and replacing it with the old backup.
The failure that I had with that is that the current drive is divided to UEFI, Windows and data partitions and it gave me an error that it could not install Windows on the partition that the previous Windows installation existed it, then I mounted the qcow2 image of the main drive, deleted all the partition table, reinstalled Windows on that drive while allowing the Windows installation to re-partition the drive automatically and then to replace the files, but after replacing the files Windows did not boot again and showed exactly the same symptoms.
virt-manager could run Windows properly because when I installed a new version of Windows, it executed properly and I had no problems, but I am trying to run the same installation of Windows from that other computer.
So for now I have no idea what else I can do to resolve this problem so any information would be greatly appreciated.
update 1
I am trying to preserve some accounting app that I don't have an upgrade license for that uses MS SQL that I don't have the username and password for. and in general I think it would be fun to know how to preserve a Windows computer on a VM.
So regarding error messages.. When Windows issuing startup repair the only error that I see is
Startup Repair couldn't repair your PC
When I start Windows installation and try to upgrade current Windows I get:
The upgrade option isn't available if you start your computer using Windows installation media.
When I try to install Windows on the same partition that the Windows was already installed to try and the move windows.old directory to Windows I get
Windows cannot be installed on this disk. The selected disk is of the GPT partition style.
update 2
Credit to all the wonderful answers, I prefer to be able to resolve working with VHDX then using a different backup software and play with that.
My hard drive literally crashed OS I backed up the VHDX files again and try on a different Gentoo machine that I have.
So from the beginning, I noticed that the laptop has Windows 10 Home Edition 64 bit Hebrew edition and that it uses UEFI.
So I created a new Windows 10 VM with Q35 Chipset and Firmware UEFI x86_64: /usr/share/qemu/edk2-x86_64-code.fd created 2 SATA drives and pointed them to the original VHDX files instead of converting it to qcow2 first, and allowed to boot from all drives and set the CDROM to boot from first.
First I booted with Linux Gentoo mini CD just to confirm that the drives are readable from the VHDX files and they are not, so I re-created the qcow2 files, booted from Gentoo Linux and the drives where readable. (For some reason I thought that QEMU supports VHDX out of the box).
So booted Gentoo Linux ISO again and checked the drives and now I see partitions.
In /dev/sda I have one NTFS partition at /dev/sda1 labeled Microsoft Basic Data. this is for all the other programs that I installed that laptop.
and on /dev/sdb I have the following:
/dev/sdb1 vfat 260M EFI System
/dev/sdb2 GUID:63 16M Microsoft reserved
/dev/sdb3 ntfs 118.1G Microsoft basic data
/dev/sdb4 ntfs 865M Windows recovery environment
So Windows is installed on the 2nd drive on /dev/sdb3, I mounted and verified. Since sdb has the EFI partition I assume that the boot should be fixed in that drive and I can remove /dev/sda from the bootable drives in the VM. so I did that and boot Windows installation ISO.
Tried executing Startup Repair again, it showed Diagnosing your PC and then Attempting Repair and then it rebooted and now it actually works. I don't know if it's because of my failed drive, because I didn't see any related errors, but you guys made my understand how important it is to check that the original laptop uses UEFI and to keep using the original drive's partitions and hard drives exact order. You helped me not to spread out and try stuff that will mess things up like repartition the drive and waste a lot of time for nothing.
I actually wrote the responses here live while re-trying everything and I'm so glad it works.

