Boot VM from partition

Hi!

I’m trying to setup a PopOS + Windows VM and I wonder if what I want is possible. If not then what approach would better suit my needs?

So I currently have PopOS and Windows installed on the SAME SSD drive, in different partitions, as your usual dual boot setup. ( /efi/boot for Windows is currently broken, so I need to repair it to actually dualboot back into it, but unless I need this for VM I don’t see the point atm. )


  1. I’d like to create a new VM that would boot from my existing Windows install from a separate partition. Is it possible?

  2. Or would I need to use a separate SSD for that and pass through the whole thing?

  3. How can I create a new VM without going through the “Choose install media” that’s in the GUI?

Thanks for your time and attention!

1 Like
  1. yes, but windows needs its bootloader repaired.
  2. not a requirement, but would make the setup much easier and possibly more reliable. 3. manually define the guest and just define it with virsh. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh

Thanks for the quick reply!

  1. Great! But as I understand it, in traditional dual boot install both windows and linux distro’s bootloader is installed in the same partition. Do I need to pass that through to VM as well? If so will it affect the running host? How should I approach this?

  2. Yes, I’m considering buying a separate SSD for that or somehow reusing what I have. But it would be more convenient to just run it from separate partition.

  3. Cool, Thanks for the link!

since you need to fix windows bootloader anyway, move it to new partition while you’re at it.

you can pass a partition as a virtio block device

Damn, already repaired it in the old place.

Does it matter where this partition is located? Like is it ok if it will be at the end of the disk? It’s gonna be tricky to split\move first partition where efi is at now.

Thanks!

So, created new boot partition for Windows and bcdboot created boot stuff there.

Now I can’t figure out how to make systemd-boot see it :smiley: PopOS comes with systemd-boot instead of grub. sigh

directly boot windows’ .efi file from the VM’s ovmf

Thanks, could you, pelase, elaborate a bit? I’m relatively new to this.

Is there an example .xml file? Or something. I’ve just found this:

I’d like to have it under virt manager GUI after the initial setup, I think. Or not.

you shouldn’t need to make systemd-boot see the partition to boot it from a VM, but assuming you want to dual boot into it on baremetal:

 efibootmgr -d /dev/sdX -p Y -c -L "Windows" -l /EFI/Microsoft/Boot/bootmgfw.efi

where X and Y are the drive letter and windows EFI partition number

also note that booting into a VM partition on baremetal WILL introduce transient errors and stability issues