PVE Adopt a KVM Windows Guest

From WikiMLT
Revision as of 15:11, 4 July 2022 by Spas (talk | contribs) (→‎References)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Set­up the Vir­tu­al Ma­chine

Video 1. Setup Proxmox VM for Windows 11 guest imported from KVM with GPU passthrough.
Video 1. Set­up Prox­mox VM for Win­dows 11 guest im­port­ed from KVM with GPU passthrough.

Set­up the guest VM as it is shown at Video 1. We will not per­form a clean in­stal­la­tion but will im­port a KVM im­age with Win­dow 11 which is set­up to use NVIDIA Tes­la K20Xm as pri­ma­ry GPU via RDP. So af­ter the cre­ation of the VM we have to do few more steps be­fore start it.

How to iso­late the GPU, at the PVM host's side, to be ready for passthrough is de­scribed in the ar­ti­cle PVE IOM­MU Iso­la­tion for Passthrough and move de­tails are pro­vid­ed in the ar­ti­cle KVM and GPU Passthrough to Win­dows VM.

UE­FI BIOS is rec­om­mend­ed for GPU pass­th­rou­gh at all but re­quired for Win­dows 11. The TPM op­tion is al­so manda­to­ry for Win­dows 11.

Ac­tu­al­ly, the disk im­age cre­at­ed at Video 1 has been delet­ed – let's re­mem­bered we will im­port an ex­ist­ing KVM Im­age – but with this ap­proach we've re­served the name vm-205-disk‑0 for the pri­ma­ry VM's im­age. The CPU type host is im­por­tant to al­low vir­tu­al­iza­tion at the guest side – for WSL2 in the cur­rent case.

Con­vert the KVM Im­age in­to a Prox­mox Im­age

Cre­ate an new VM on Prox­mox VE (al­ready done) and add the ex­ist­ing disk im­age to this new VM (this step), set the boot or­der and start source.

qm importdisk 205 Windows.11.img local-lvm
importing disk 'Windows.11.img' to VM 205 ...
  Logical volume "vm-205-disk-0" created.
    ...this takes a while...
transferred 60.0 GiB of 60.0 GiB (100.00%)
Successfully imported disk as 'unused0:local-lvm:vm-205-disk-0'

In the above com­mand:

  • 205 is the id of the VM.
  • Windows.11.img is the im­age that was cre­at­ed be­fore.
  • lo­cal-lvm is the name of a stor­age as list­ed in pvesm sta­tus.

qm im­port­disk adds the im­age as un­used disk to the vir­tu­al ma­chine. Thus, mak­ing it the boot disk is still nec­es­sary.

qm set 205 --scsi0 local-lvm:vm-205-disk-0
update VM 205: -scsi0 local-lvm:vm-205-disk-0

Fine tun­ing of the Con­fig­u­ra­tion file

Mod­i­fy and add the lines marked in the above snip­pet. Note 205 is the id of the vir­tu­al ma­chine. When the file is saved the rel­e­vant changes will be au­to­mat­i­cal­ly ap­plied and up­dat­ed with­in the Proxmox's WEB GUI.

nano /etc/pve/qemu-server/205.conf
agent: 1,fstrim_cloned_disks=1
args: -cpu 'host,+kvm_pv_unhalt,+kvm_pv_eoi,hv_vendor_id=NV43FIX,kvm=off'
bios: ovmf
boot: order=scsi0
cores: 4
cpu: host,hidden=1,flags=+pcid
efidisk0: local-lvm:vm-205-disk-1,efitype=4m,pre-enrolled-keys=1,size=4M
hostpci0: 0000:02:00,pcie=1
ide2: none,media=cdrom
localtime: 1
machine: pc-q35-6.1
memory: 4096
meta: creation-qemu=6.1.0,ctime=1647272520
name: Windows.11
net0: e1000=62:42:2D:03:C4:C9,bridge=vmbr0,firewall=1
numa: 0
ostype: win11
scsi0: local-lvm:vm-205-disk-0,discard=on,size=60G
scsihw: virtio-scsi-pci
smbios1: uuid=ec286656-a060-42c5-956c-099feba059ab
sockets: 1
tpmstate0: local-lvm:vm-205-disk-2,size=4M,version=v2.0
vmgenid: f45ed16c-d22b-4d3d-b4d7-68cb0438fe48

Ref­er­ences