This assumes you have Windows Server 2022 Gen2 VM running on hyper-v that uses gen2 with UEFI and Secure Boot - it should work for win11 but i haven't tested that. This has only tested with a vanilla windows server 2022 VM so far (three times to write guide). I will comment this gist when i manage to move one of my domain controllers.
- Dowload Virtio DVD and attach to running windows VM on Hyper-v
- Log onto console of Windows VM to be migrated
- Install VirtIO drivers (all drivers, this will also include spice tools)
- Gracefully shutdown server
- Export VM to CIFS location accessible by proxmox and mounted in proxmox
- Click create VM in top right corner
- OS Tab
- do not use ant medai
- guest OS = windows - 11/2022
- System Tab
- graphic card = default
- machine = q35
- BIOS = OVMF (UEFI)
- EFI Storage = ceph pool rbd (e.g. vm-disks)
- SCSI Controller = virtio SCSI single
- QEMU agent = checked (note using shutdown in proxmox before OS is loaded will hand proxmox)
- Add TPM = chcked
- TPM storage = ceph pool rbd (e.g vm-disks)
- verion = v2.0
- Disks Tab
- delete the default IDE drive that gets createad
- create a new disks with bus/device = VirtIO Block / 1
- enable cache policy and discard aas you prefer
- CPU Tab - whatever you feel is right
- Memory Tab - whatever you feel is right
- Network Tab
- bridge - vmbr0 or whatver custom bridges your have created
- mode = VirtIO (paravirtualized)
- create VM but don't start it
- in the shell navigate t the cifs mount point where you can see the vhdx exported earlier (or copy it to /temp)
- execute
qm importdisk <VMID> <FILENAME>.vhdx <CEPH storage location>
for example if the VM in VM102 and the vhdx is called myserver.vhdx and the ceph pool is called vm-disks then the command would be:
qm import 102 myserver.vhdx vm-disks
The import will be slow initially, but if your VHDX was thin provisioned it will get faster when it only copies zeroes. NOTE: while the disks might say it is 126 GB in the UI it will be thin prvisioned on the ceph volume and only take up the used amount of space inside the vhdx. Once the import has completed continue:
- on
VM Name > hardware
double clickunused disk 0
- addi it as ide 0, write though, ssd, discard and click
add
- in the gui
VM nane > options
chnage the boot order so IDE 0 is the number one device and check enable
- now go to the VM conole and click
start now
- logon to the VM once booted
- now gracefully shutdown (do not use stop or reset)
- on
VM Name hardware
select the IDE0 disk and clickdetach
- now double click
unused disk 0
to re-add it - This time make it virtio block / 0 (also select discard and cache as you prefer and click
add
- in the gui
VM nane > options
chnage the boot order so virtio 0 and virtio 1 are both enabled and ensure the virtio 0 disk is the is the higest boot order device and clickok
You should be able to now start the VM and have it boot 100% fine. On next shut down you can remove the small temporary virtio disk you created earlier.