Technical

Migrate VM OS to Physical Device: A Proxmox V2P Walkthrough

Migrate VM OS to Physical Device: A Proxmox V2P Walkthrough

Migrate VM OS to physical device isn’t hard if you know the disk-cloning commands and bootloader repair. You’re basically copying the virtual disk to a real one, then making it bootable.

Close-up of a vintage Iomega Ditto internal tape drive with circuit board exposure.

Get the VM’s disk image

First, find where Proxmox stores the disk. If it’s on LVM-thin, it’s a raw volume. You can check with qm config 100 — look for the scsi0 or virtio0 line. It’ll show something like local-lvm:vm-100-disk-0. That’s the volume name.

If the disk is qcow2 on a directory storage, it’s just a file. Either way, you can clone it to a physical disk with dd or qemu-img.

Clone the virtual disk to the physical drive

Plug in the target physical disk. Make sure it’s at least as big as the virtual disk. Then run:

dd if=/dev/pve/vm-100-disk-0 of=/dev/sdX bs=4M status=progress

If it’s a qcow2 file, use qemu-img convert instead:

qemu-img convert -f qcow2 -O raw /var/lib/vz/images/100/vm-100-disk-0.qcow2 /dev/sdX

That copies everything, including partition table and bootloader. But the bootloader probably points to the wrong disk UUID or device name, so you’ll need to fix that.

Exposed vintage hard drive showing disk platter and internal components, highlighting historical technology.

Repair the bootloader

Boot the physical machine from a live Linux USB. Mount the root partition and chroot into it. Then reinstall GRUB:

mount /dev/sdX2 /mnt
mount /dev/sdX1 /mnt/boot/efi  # if UEFI
grub-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --boot-directory=/mnt/boot
grub-mkconfig -o /boot/grub/grub.cfg

If it’s BIOS boot, just grub-install /dev/sdX after chrooting. Also check /etc/fstab inside the chroot — the UUIDs might be wrong. Update them to match the new disk’s partitions using blkid.

Handle LVM inside the VM

If the VM used LVM for its root filesystem, you’ll need to activate the volume group after booting the live USB. Run vgchange -ay before mounting. And if the initramfs doesn’t include the necessary modules, rebuild it with update-initramfs -u inside the chroot.

What I’d do differently

Honestly, for a homelab, I’d just reinstall the OS on the physical machine and copy over configs. It’s less fiddly than fixing bootloaders. But if you need an exact clone, this works. Just don’t expect it to be painless — UEFI and LVM add extra steps.

If you run into weird Proxmox storage issues during this, check how to move a raw disk image from LVM-thin storage for the volume paths.

Leave a comment

Comments are reviewed before they appear. Your email is never published.