Boot physical windows 10 partition using Virt-Manager and KVM/QEMU in Fedora

Hi,

I,am running dual boot Windows 10 and Fedora 34 Workstation on same NVME drive.

I would like to boot to the physical Windows 10 UEFI partition within Fedora 34 using Virt-Manager GUI and KVM/QEMU.

Please advise on how to go about the same.

Are you asking that you want to boot a windows 10 os that is attached to your NVME drive from a virtual-machine? I’m not sure if thats possible (in my tiny limited knowledge dumb brain) but I know that you can ‘create’ virtual machines from existing windows (or any OS) installations. If you install the existing windows into the virtual machine, you could just use it normally as you would dual-booting.
However I am not sure why you would want to use an existing windows 10 os, as you can easily move important files to a separate USB/hard drive and give it to the VM once created.
Alternatively I’ve seen people that just boot into the /dev/sda(1/2/3/etc…) partition from the VM, although I haven’t done this myself.
Good luck man, hopefully this has helped a tiny bit.

After 30+ days I’m sure you’ve already figured something out, I’ll answer anyway in case anyone else is looking for advice on the same thing.

Firstly I agree with untrimmedrccape’s opinion that you shouldn’t use the same pre-existing OS installation that’s been used in a bare machine installation.
You’re likely to run into stability issues when using a Windows install that’s started out as and been used in a physical machines hardware and booting in virtual environment. Also vice versa. I know this from personal experience.

Next, you can’t just add a Windows partition to the VM and expect it to boot. As far as I’m aware, the Windows installation will require the EFI partition to be able to boot, just like with physical hardware. Another reason to install Windows from fresh.

You can add a custom storage device with virt-manager and set the location field to a disk or a partition to make it available to the virtual machine.

For example /dev/sda for the disk or /dev/sda1 for the partition.

Or even better assigning the disk by ID location, which can be checked by using ls -l /dev/disk/by-id

for example on my PC to assign partition /dev/sda1 I would use /dev/disk/by-id/wwn-0x5000c5007a4fb7ff-part1 as shown from the output of ls -l below:

ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 Jul 12 18:44 wwn-0x5000c5007a4fb7ff -> ../../sda
lrwxrwxrwx 1 root root 10 Jul 12 18:44 wwn-0x5000c5007a4fb7ff-part1 -> ../../sda1

Here’s what it looks like in my VM’s xml (I’m using the entire disk):

<disk type="block" device="disk">
        <driver name="qemu" type="raw" cache="none" io="native"/>
        <source dev="/dev/disk/by-id/wwn-0x5000c5007a4fb7ff"/>
        <target dev="vda" bus="virtio"/>
        <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    </disk>

It should be the same for NVME partitions with the exception of passing the entire drive. For a full NVME drive you can pass-through the PCI device and let the virtual machine OS handle any partitioning.