0

I am using libvirt kvm with virt manager, my purpose to have a os that can be used on bare metal and through kvm. I already have a windows partition on my disk, and I created a vm with it added as a disk but when I launch it it's stuck on booting from hard disk unless it takes extremely long and if I open the boot menu it shows the disk with the correct amount of storage. I don't currently have a second disk in my pc, so it would be great if I could use the same disk, my intention is to use for gaming.

1 Answer 1

0

I had the same setup working, years ago, and I’m sorry to tell you, that this is deliberately prevented by current versions of Windows.

Up until XP, Windows used to have hardware profiles, and you could have one for inside the VM and one for normal booting. It used to be for docking stations and such, but this was removed.

Now, Windows will not accept what it experiences as being “moved” to different hardware. (Similar to putting the disk into another computer.) So booting will cause big problems … if possible at all. I haven’t tried what happens in current versions, but back then, it caused re-detection of ALL hardware in the system. Which required several reboots, since some hardware could only be detected after other hardware already worked earlier in the boot process. Back then, that’s how you initialized a new profile and after that it was fine. But nowadays, this would have to happen on every switch between bare metal and VM. Obviously that’s not acceptable for quickly switching between OSes.

Additionally, what you said seems to suggest you added a partition as a disk. Which libvirt and Linux happily do, but results in a “wholedisk“ to the guest OS, where there is no partition table and the file system is on the raw unpartitioned disk. (Which in your case is secretly a partition to the host OS.) And while on certain hardware setups, Linux could be configured to boot like that, this definitely will not work with Windows. Especially with at least a separate UEFI partition being required for boot AFAIK.

So your only option, aside from hacking Windows registry to swap out basically everything you see in the device manager each time you are switching between in-VM and bare metal booting (Which might be possible with Linux’s registry editing tools, but I don’t know what other files need to be changed too.), your only option is to have a separate installation of Windows inside the VM, and then work on sharing as much between those installs as possible. (Keyword: Deduplication.) E.g. by having your user directories on a separate partition that both the VM and the bare metal install use. And deduplicating, moving to a separate partition and mounting as a directory of as much of the Windows install itself as possible without breaking updates. Possibly even some more low-level deduplication of files/blocks done in the VM’s virtual disk layer, but with one disk being the real disk instead of the virtual disk of another VM like normal. All in all, it’s not a nice situation. Thanks to Microsoft focusing on becoming an ad-financed DRM-laden consumer OS where the DRM/TPM code doesn’t like swapping out hardware below it.

Maybe you could go another route and try Proton (which can be used without Steam too). I hear Windows games support on Linux is really quite good nowadays, thanks to Valve.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .