QEMU+KVM Booter on a physical partition under Linux Ubuntu

BenjaminA2mains Posted messages 44 Status Member -  
avion-f16 Posted messages 19182 Registration date   Status Contributor Last intervention   -

Hello,
I've installed QEMU, KVM, libvirt, ... basically everything needed for VMs on my Ubuntu 22.04 LTS (which is not a VM). I'm using Virtual Machine Manager for convenience.

Now, I would like to boot my Windows 10 that is on a physical partition of my hard drive. (/dev/nvme0n1p3)

So, I've configured my VM properly and told it to boot from /dev/nvme0n1p3, which it does quite well, but it boots a little too well to the point that it loops… The VM starts and loops on booting as if it couldn't find a partition to load. No error messages, nothing at all.

I specify that I boot under BIOS and not in UEFI (I've tested in UEFI, it starts and gets stuck on UEFI). And I already have a VM on a virtual disk, so it’s not a motherboard issue.

1 answer

  1. avion-f16 Posted messages 19182 Registration date   Status Contributor Last intervention   4 511
     

    Hello,

    The startup of Windows does not depend solely on its system partition; the other partitions are also necessary.

    Even if you go through all the partitions one by one, the virtual machine will see each one as a separate disk without a partition table. However, the boot software needs this table and the UUIDs of the partitions to ensure startup.

    It is much simpler to attach the entire disk to the VM, but this implies that this disk should not be the one where your host is installed.

    0
    1. BenjaminA2mains Posted messages 44 Status Member
       

      Thank you for your reply.
      Unfortunately, it's also the host disk.

      I didn't know that Windows started like that.

      In that case, do you know if GRUB can recognize a hard drive and boot from it?
      That way I can put my Windows in a VHD and boot from there.

      And in theory, I could achieve this through a VM. Stop me if I'm going down the wrong path.

      0
      1. avion-f16 Posted messages 19182 Registration date   Status Contributor Last intervention   4 511 > BenjaminA2mains Posted messages 44 Status Member
         

        It's a red herring; GRUB would need to convince Windows that the VHD file is a disk. That's the job carried out by QEMU/KVM, a hypervisor, not that of a bootloader like GRUB.

        There's no simple solution to your problem unless you can install Windows on a physical disk separate from Ubuntu.

        See here: https://lejenome.tik.tn/post/boot-physical-windows-inside-qemu-guest-machine

        0