This guide summarizes the complete process for migrating Linux virtual machines (e.g. Ubuntu) from Proxmox to Microsoft Hyper-V. Includes VM preparation, disk conversion and final setup.
Proper preparation is crucial for smooth transition and minimizing post-migration issues.
- a) Backup: Create complete VM backup.
- b) Log in as root
sudo su
- System update:
apt update && apt upgrade -y - Remove Proxmox tools:
apt-get purge qemu-guest-agent
- Install Hyper-V tools (LIS): These packages contain network and storage drivers for Hyper-V.
apt-get install linux-virtual linux-cloud-tools-virtual linux-tools-virtual
- Proactive network fix (Netplan): Prepare network configuration to work in both Proxmox and Hyper-V.
- Check current interface:
ip a(e.g.ens18) - Find config file:
ls /etc/netplan/(e.g.50-cloud-init.yaml) - Edit file (
nano /etc/netplan/50-cloud-init.yaml) and add section foreth0(typical name in Hyper-V):network: version: 2 ethernets: ens18: # Original name in Proxmox dhcp4: true eth0: # New name for Hyper-V dhcp4: true
- Apply changes (only
ens18will be active in Proxmox):netplan apply
- Check current interface:
- Shut down VM in Proxmox.
Now we'll convert VM disk to Hyper-V format (VHDX).
-
Login to Proxmox server via SSH.
-
Find your VM ID and config (replace
101with your VMID):qm config 101
-
Find disk definition line, e.g.:
scsi0: nvme4tb:vm-101-disk-0,iothread=1,size=80G- Here storage is
nvme4tband disk name isvm-101-disk-0.
- Here storage is
-
Find exact disk path. Path varies by storage type (
Directory,LVM,ZFS). For ZFS:ls -l /dev/zvol/*/* | grep vm-101-disk-0
- Correct path will be e.g.
/dev/zvol/nvme4tb/vm-101-disk-0.
- Correct path will be e.g.
-
Start disk conversion using
qemu-img. Use-pfor progress.- Replace disk path and destination path for VHDX file.
- For ZFS/LVM source format (
-f) is alwaysraw.
qemu-img convert -p -f raw -O vhdx /dev/zvol/nvme4tb/vm-101-disk-0 -o subformat=dynamic /mnt/nvme1tb/dump/vm-101-disk-0.vhdx
With VHDX file ready, create new VM in Hyper-V.
- Move
.vhdxfile to Hyper-V server. - Open Hyper-V Manager and select Action -> New -> Virtual Machine.
- Enter name and continue.
- Select correct generation based on Proxmox config:
- Generation 1: For BIOS boot (older VMs)
- Generation 2: For UEFI boot (modern VMs)
- To check boot mode in Proxmox:
- For UEFI: VM config must have
efidisk0orbios: ovmf - For BIOS: If these are missing, it's BIOS boot
- For UEFI: VM config must have
- Alternative check inside VM:
[ -d /sys/firmware/efi ] && echo "UEFI" || echo "BIOS"
- Allocate memory and select virtual switch in Configure Networking.
- In Connect Virtual Hard Disk select Use existing virtual hard disk and choose your converted
.vhdx. - Before first start, right-click VM, select Settings.
- In Security section, disable Enable Secure Boot.
- Start VM.
Final step is to verify everything works correctly.
- Connect to console of new VM in Hyper-V.
- Verify network connection. Thanks to step 1.5 it should work automatically.
ip a ping 8.8.8.8
- Check all your services and applications are running correctly.
- (Optional) Try shutting down VM, re-enable Secure Boot in settings and verify system boots.
- After thorough testing you can delete original VM from Proxmox to free space.