Migrating Hyper-V to Proxmox - what I learned

aroby

New Member
Dec 6, 2023
4
23
3
I am just getting to grips with Proxmox, retiring my power hungry server in my basement in favor of a ThinkCentre M910Q. I've been running a few things on Hyper-V for some time now, and don't want to migrate away from the Windows VMs that I have. So, of course, I want to migrate them. There are lots of threads and articles on this (I know - I read many!), but I had to piece together their information to figure out what works. Set out below are the basic steps I followed. I am assuming some basic knowledge here, so didn't detail everything.

1) install the Virtio driver on the Hyper-V VM to be migrated. Also install the correct agent from the guest-agent directory
2) stop the VM on Hyper-V. I didn't have checkpoints / snapshots, but if you do you may need to deal with those.
3) Export the VM to a shared folder accessible via Proxmox
4) Mount the shared folder onto the Proxmox node (e.g. mount -t cifs -o username=<user>,password=<pswd> //hyper-v-host/share /home/vm)
6) Create a VM on Proxmox:

General - supply a name
OS - Do not use any media; Windows guest OS
System - OVMF (UEFI) bios; add an EFI disk; device q35
Disks - leave as default, but set size to 1GB
CPU, memory, network - your choice

Selecting the q35 device turned out to be the solution to my problems of getting the VM to start properly. It didn't solve everything, but was a major piece.

7) Delete the IDE disk on the created VM
8) From the Proxmox host console, import the .vhdx to the new VM:

qm disk import <VM ID> /home/vm/<.vhdx filename> local-lvm

9) On the Proxmox VM Hardware settings double click the Unused Disk 0 (just imported) and add it to the IDE/SATA bus. In Options > Boot Order, select IDE/SATA and move it to the top
10) Also add a 1GB SCSI hard disk. This will be deleted later, its purpose is to get Windows to install the drivers so that the boot drive can be moved from IDE/SATA to SCSI
11) Start the VM. Check in the Windows Device Manager > Disks that there are 2 disk drives (IDE, SCSI) and that the Storage Controllers and USB controllers are active. I encountered resource problems with them, and needed to reboot to clear the exclamation marks.
12) Shutdown and detach the IDE boot drive, re-attach it to SCSI. In Options > Boot Order, select the SCSI drive as the boot device, reboot. There now should be two SCSI disks under Windows Device Manager > Disks. If so, the temporary 1GB SCSI disk can be detached and removed. Removing it prior to re-mounting the boot drive as SCSI caused my blue screen problems.
13) restart to make sure everything is working

This took me a while to figure out, I was continually getting INACCESSIBLE_BOOT_DEVICE blue screens and went down a rabbit hole of messing with the OVMF BIOS settings. The key pieces to the puzzle were the q35 device and mounting a temporary SCSI drive to get Windows to load the drivers.

Hopefully this is helpful to someone!
 
You are a legend Sir!

Thank you for this. I have dozens of Hyper-V labs I needed to migrate to Proxmox and was able to do this easily thanks to this guide.

The only change I made was to copy the xyz.vhdx files to tmp on my Proxmox server with SFTP and then import the vhdx from there. That went significantly faster (qm import commend attached).

Thanks again @aroby
 

Attachments

  • 2024-05-04_08-21-37.png
    2024-05-04_08-21-37.png
    2.3 KB · Views: 122
Last edited:
  • Like
Reactions: aroby
I am just getting to grips with Proxmox, retiring my power hungry server in my basement in favor of a ThinkCentre M910Q. I've been running a few things on Hyper-V for some time now, and don't want to migrate away from the Windows VMs that I have. So, of course, I want to migrate them. There are lots of threads and articles on this (I know - I read many!), but I had to piece together their information to figure out what works. Set out below are the basic steps I followed. I am assuming some basic knowledge here, so didn't detail everything.

1) install the Virtio driver on the Hyper-V VM to be migrated. Also install the correct agent from the guest-agent directory
2) stop the VM on Hyper-V. I didn't have checkpoints / snapshots, but if you do you may need to deal with those.
3) Export the VM to a shared folder accessible via Proxmox
4) Mount the shared folder onto the Proxmox node (e.g. mount -t cifs -o username=<user>,password=<pswd> //hyper-v-host/share /home/vm)
6) Create a VM on Proxmox:

General - supply a name
OS - Do not use any media; Windows guest OS
System - OVMF (UEFI) bios; add an EFI disk; device q35
Disks - leave as default, but set size to 1GB
CPU, memory, network - your choice

Selecting the q35 device turned out to be the solution to my problems of getting the VM to start properly. It didn't solve everything, but was a major piece.

7) Delete the IDE disk on the created VM
8) From the Proxmox host console, import the .vhdx to the new VM:

qm disk import <VM ID> /home/vm/<.vhdx filename> local-lvm

9) On the Proxmox VM Hardware settings double click the Unused Disk 0 (just imported) and add it to the IDE/SATA bus. In Options > Boot Order, select IDE/SATA and move it to the top
10) Also add a 1GB SCSI hard disk. This will be deleted later, its purpose is to get Windows to install the drivers so that the boot drive can be moved from IDE/SATA to SCSI
11) Start the VM. Check in the Windows Device Manager > Disks that there are 2 disk drives (IDE, SCSI) and that the Storage Controllers and USB controllers are active. I encountered resource problems with them, and needed to reboot to clear the exclamation marks.
12) Shutdown and detach the IDE boot drive, re-attach it to SCSI. In Options > Boot Order, select the SCSI drive as the boot device, reboot. There now should be two SCSI disks under Windows Device Manager > Disks. If so, the temporary 1GB SCSI disk can be detached and removed. Removing it prior to re-mounting the boot drive as SCSI caused my blue screen problems.
13) restart to make sure everything is working

This took me a while to figure out, I was continually getting INACCESSIBLE_BOOT_DEVICE blue screens and went down a rabbit hole of messing with the OVMF BIOS settings. The key pieces to the puzzle were the q35 device and mounting a temporary SCSI drive to get Windows to load the drivers.

Hopefully this is helpful to someone!
Thank you SO much! Your guide is the only one I could find that works. You saved my bacon. Can confirm this process worked on PVE 8.2 with Server 2019. Thank you again!
 
  • Like
Reactions: aroby
This is the only guide that worked for me. I did everything the same way except for the first step.

I had my VHDX already imported into my Proxmox server. I had to install the Virtio driver after I booted with the IDE disk.

The SCSI driver got installed, and it booted with the IDE changed to SCSI.

Thanks a lot!
 
  • Like
Reactions: aroby
Thanks a lot. @aroby
I also tried a couple of other articles and videos but this is the only one that worked for me. I am on 8.2.2 and it is working great.
 
  • Like
Reactions: aroby
Which Virtio drivers do you have installed? I'm looking for stable drivers for Windows Server 2019. Thnx
 
Latest stable or most recent? Do I need the iso image or is the small msi setup enough?
 
Didn't work for me. :(

Same here.

What I did on my Hyper-V host
  1. Stopped the guest (Linux)
  2. Exported the guest
  3. Uploaded the VHDX to my Proxmox server

  4. Tried for the VHDX to QCOW2/Import option
    1. https://www.vinchin.com/vm-migration/hyper-v-to-proxmox.html
    2. https://forum.proxmox.com/threads/h...neration-2-hyper-v-vm-to-a-proxmox-vm.107511/
    3. This guide
  5. Created a new guest in Proxmox with the same settings
  6. Attached the new disk to my guest
  7. followed the steps in all mentioned guides
  8. Booting restult ins the UEFI shell, classic boot does nothing as the guest was already set up for UEFI in Hyper-V
  9. Secure boot is not enabled in the guest UEFI BIOS settings

Funny thing is, this is the exact same issue I'm facing in XCP-NG, as a test I've switched over to Proxmox hoping this would not happen.
 

Attachments

  • 2024-08-11_12h15_11.png
    2024-08-11_12h15_11.png
    177.4 KB · Views: 20
  • 2024-08-11_12h29_15.png
    2024-08-11_12h29_15.png
    129.2 KB · Views: 22
Same here.

What I did on my Hyper-V host
  1. Stopped the guest (Linux)
  2. Exported the guest
  3. Uploaded the VHDX to my Proxmox server

  4. Tried for the VHDX to QCOW2/Import option
    1. https://www.vinchin.com/vm-migration/hyper-v-to-proxmox.html
    2. https://forum.proxmox.com/threads/h...neration-2-hyper-v-vm-to-a-proxmox-vm.107511/
    3. This guide
  5. Created a new guest in Proxmox with the same settings
  6. Attached the new disk to my guest
  7. followed the steps in all mentioned guides
  8. Booting restult ins the UEFI shell, classic boot does nothing as the guest was already set up for UEFI in Hyper-V
  9. Secure boot is not enabled in the guest UEFI BIOS settings

Funny thing is, this is the exact same issue I'm facing in XCP-NG, as a test I've switched over to Proxmox hoping this would not happen.
Why are you making this so complicated?

Create a share on the HyperV.
Mount the SMB share on the PVE.
Build your new VM with the desired settings.
Simply migrate the VMDK to the new VM:
qm importdisk VMID Mountfolder/VMDisks DestinationDatastore
qm importdisk 100 /share/VM1/Virtual\ Hard\ Disks/VM1.vhdx local-lvm
Attach the disk as IDE or whatever you want in the VM and change the boot folder to the new added disk.

That always works.
 
  • Like
Reactions: _gabriel
I've tried this and ran into the Automatic Repair on first boot. It does ultimately see the drive but can't boot into it. Not sure the cause but I assume the SCSI drivers aren't working correctly, or something else. Any ideas?
 
I am just getting to grips with Proxmox, retiring my power hungry server in my basement in favor of a ThinkCentre M910Q. I've been running a few things on Hyper-V for some time now, and don't want to migrate away from the Windows VMs that I have. So, of course, I want to migrate them. There are lots of threads and articles on this (I know - I read many!), but I had to piece together their information to figure out what works. Set out below are the basic steps I followed. I am assuming some basic knowledge here, so didn't detail everything.

1) install the Virtio driver on the Hyper-V VM to be migrated. Also install the correct agent from the guest-agent directory
2) stop the VM on Hyper-V. I didn't have checkpoints / snapshots, but if you do you may need to deal with those.
3) Export the VM to a shared folder accessible via Proxmox
4) Mount the shared folder onto the Proxmox node (e.g. mount -t cifs -o username=<user>,password=<pswd> //hyper-v-host/share /home/vm)
6) Create a VM on Proxmox:

General - supply a name
OS - Do not use any media; Windows guest OS
System - OVMF (UEFI) bios; add an EFI disk; device q35
Disks - leave as default, but set size to 1GB
CPU, memory, network - your choice

Selecting the q35 device turned out to be the solution to my problems of getting the VM to start properly. It didn't solve everything, but was a major piece.

7) Delete the IDE disk on the created VM
8) From the Proxmox host console, import the .vhdx to the new VM:

qm disk import <VM ID> /home/vm/<.vhdx filename> local-lvm

9) On the Proxmox VM Hardware settings double click the Unused Disk 0 (just imported) and add it to the IDE/SATA bus. In Options > Boot Order, select IDE/SATA and move it to the top
10) Also add a 1GB SCSI hard disk. This will be deleted later, its purpose is to get Windows to install the drivers so that the boot drive can be moved from IDE/SATA to SCSI
11) Start the VM. Check in the Windows Device Manager > Disks that there are 2 disk drives (IDE, SCSI) and that the Storage Controllers and USB controllers are active. I encountered resource problems with them, and needed to reboot to clear the exclamation marks.
12) Shutdown and detach the IDE boot drive, re-attach it to SCSI. In Options > Boot Order, select the SCSI drive as the boot device, reboot. There now should be two SCSI disks under Windows Device Manager > Disks. If so, the temporary 1GB SCSI disk can be detached and removed. Removing it prior to re-mounting the boot drive as SCSI caused my blue screen problems.
13) restart to make sure everything is working

This took me a while to figure out, I was continually getting INACCESSIBLE_BOOT_DEVICE blue screens and went down a rabbit hole of messing with the OVMF BIOS settings. The key pieces to the puzzle were the q35 device and mounting a temporary SCSI drive to get Windows to load the drivers.

Hopefully this is helpful to someone!
I just wanted to thank you for your detailed guide. It worked flawlessly on my 8.2.2 environment. Appreciate the time and effort you put into creating this guide.
 
Thank you so much for this guide. It worked well for me, however there was one additional nuance that I encountered. While importing Windows VMs with a single disk worked well, I had to bring some in with additional disks. For some reason they were being set to read-only in Windows when the VM booted back up. Using the DISKPART command inside of the VM to clear the read-only flags worked.
 
Thanks. Running through this guide was not only painless and trouble free, but also was my first experience with Proxmox ever (having been a Hyper-V user since 2005 - maybe it was Virtual Server then!)

Must say, as well as being a useful guide, as a very long time Hyper-V user (experienced setting up clusters in a lot of different businesses so I'm pretty advanced) I'm an immediate convert to Proxmox as well... nice entry point for me. Cheers :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!