Full P2V Migration of a Physical Machine to Proxmox VE

Published 2026-03-27 22:35 1260 words 7 min read

Madobi Nanami avatar

Madobi Nanami

Nanami 的个人技术博客,记录网络、运维、虚拟化与逆向的实践。

Introduction My home now has two broadband lines. If the network egress services all live on a single system, only one line's upload can be used at a time and the other is wasted. So I decided to move...

Introduction

My home now has two broadband lines. If the network egress services all live on a single system, only one line’s upload can be used at a time and the other is wasted. So I decided to move my egress sub-server onto Proxmox VE as well, which lets me use both lines’ upload through firewall rules and load balancing while also making the server easier to manage. But how do you migrate without losing the operating system and environment already installed on the old server? This article gives you the best full-migration approach.

Requirements

  • External storage >= the data used on the server’s system disk
  • Server disk >= 64GB

Let’s Start

1. Backing Up the Disk in Full

  • Boot any Linux Live CD on the external storage. I recommend SystemRescue, or Ventoy with several ISOs bundled together
  • Once in the Live environment, list all disks
lsblk
  • Find your external storage and mount it at /mnt/usbdisk
mkdir /mnt/usbdisk
mount /dev/<device> /mnt/usbdisk
  • Use dd to create a full image
dd if=/dev/<device> of=/mnt/usbdisk/backup.img bs=1M status=progress

Note: this takes a while (roughly 30–60 minutes per 100GB). Keep the server powered to avoid data corruption

  • Convert the image to qcow2 with qemu-img
qemu-img convert -f raw -O qcow2 -c /mnt/usbdisk/backup.img /mnt/usbdisk/backup.qcow2

Note: this also takes a long time. Keep the server powered to avoid data corruption

  • When the conversion finishes, the backup stage is done

2. Installing Proxmox VE

We install it manually here, so the installer can’t put the disks into an unexpected data layout

Reference: A manual Proxmox VE install with multi-path iSCSI and NAT forwarding » 悠笙の开发日记

  • Configure Hostname Proxmox VE requires the hostname to resolve to a non-loopback address via Hosts:

The hostname of your machine must be resolvable to an IP address. This IP address must not be a loopback one like 127.0.0.1 but one that you and other hosts can connect to.

For example, my server’s LAN address is 192.168.1.5 and its public address is 112.32.***.***, so /etc/hosts should look like this:

127.0.0.1       NanamiWork-SubServer
127.0.1.1       NanamiWork-SubServer.lan        NanamiWork-SubServer
192.168.1.5     NanamiWork-SubServer
112.32.***.***  NanamiWork-SubServer

# The following lines are desirable for IPv6 capable hosts
::1     NanamiWork-SubServer ip6-NanamiWork-SubServer ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

If you don’t want the server reachable directly from the internet, simply leave the public entry out

  • Install the Proxmox VE package repositories

Debian 13 uses the Deb822 format, so you can follow USTC’s Proxmox mirror guide directly:

cat > /etc/apt/sources.list.d/pve-no-subscription.sources <<EOF
Types: deb
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve
Suites: trixie
Components: pve-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF
  • Install the keyring into /usr/share/keyrings
cd /usr/share/keyrings
wget https://www.iyoroy.cn/usr/uploads/2025/11/4102711242.zip
apt install unzip -y
unzip 4102711242.zip
rm 4102711242.zip
  • Update the packages
apt update
apt upgrade -y
  • Install the Proxmox VE kernel
apt install proxmox-default-kernel
reboot

Check the system info with uname -a; if the kernel version ends in -pve or similar, the install worked

  • Install the Proxmox VE packages
apt install proxmox-ve postfix open-iscsi chrony

The process asks you to configure the postfix mail server. Per the official explanation: If your network has a mail server, configure postfix as a Satellite system. Your existing mail server then becomes the relay host routing email from Proxmox VE to its final recipient. If you don’t know what to enter here, choose Local only and keep the system hostname unchanged.

  • Once done, you should be able to reach the WebUI at https://<IP Addr>:8006. If it loads, the install succeeded.

Username: root, password: your root password

  • Remove the old Debian kernel and os-prober
apt remove linux-image-amd64 'linux-image-6.1*'
update-grub
apt remove os-prober

Removing os-prober is optional but officially recommended, because it may mistake a VM’s boot files for a multi-boot setup and add entries that shouldn’t be there.

  • Proxmox VE is now installed

3. Creating a Virtual Bridge

  • Log in to the Proxmox VE WebUI and go to Datacenter —> <Hostname> —> System —> Network
    Network
    Network
  • Click Create and choose Linux Bridge
  • In the dialog, enter the Name you need, then list the physical NIC to bridge under Bridge ports

Note:

  • If you want that physical NIC to be the Debian host’s uplink, fill in IPv4/CIDR, Gateway(IPv4), IPv6/CIDR (optional) and Gateway(IPv6) (optional) in the dialog
    Example
    Example
  • Never set the server’s static IP on the physical NIC, or VMs may lose connectivity and other problems will follow!!
  • Click OK to create the bridge

4. Restoring the Original System

4.1 Creating the VM

  • Log in to the Proxmox VE WebUI, click Create VM at the top right, set the VM name and whether it starts on boot as you need, then click Next
  • On the OS tab choose Do not use any media, then click Next
  • On the System tab enable Qemu Agent, choose whether to switch the BIOS to OVMF (UEFI) as needed, then click Next
  • On the Disks tab click the trash icon next to scsi0 to delete the default disk, then click Next
  • On the CPU tab set Type to host, then allocate cores (Cores) as needed. With many cores you can enable NUMA. Click Next when done
  • On the Memory tab allocate memory as needed, then click Next

Note: don’t allocate more than 80% of physical memory, or you risk running out

  • On the Network tab select the bridge you just created, then click Next

Note: if the original system was Windows, you may need to change the NIC model to Intel E1000 or Intel E1000E

  • On the final Confirm tab, check everything and create the VM. Once VM 100 - Create in the Tasks list at the bottom shows OK, the VM is ready

4.2 Restoring the Physical Disk Image

  • Log in to the server over SSH and list all disks
lsblk
  • Find your external storage and mount it at /mnt/usbdisk
mkdir /mnt/usbdisk
mount /dev/<device> /mnt/usbdisk
  • Copy the qcow2 image you created earlier to the server
cp /mnt/usbdisk/backup.qcow2 /var/lib/vz/images/100/vm-100-disk-1.qcow2

Note: this can take a long time. Keep the server powered to avoid data corruption

  • Once the copy finishes, import the disk into the VM
qm set 100 --scsi0 /var/lib/vz/images/100/vm-100-disk-1.qcow2
  • Set the boot order
qm set 100 --boot order=scsi0
  • In the WebUI, select the VM and start it
  • If the VM boots into the system that used to run on the physical host, the restore is complete!

5. Installing Qemu-Agent

  • Log in to the VM over SSH and install qemu-guest-agent
sudo apt install qemu-guest-agent
  • Enable it and start it
sudo systemctl enable qemu-guest-agent
sudo systemctl start qemu-guest-agent
  • Back in the VM’s Summary page in the WebUI, if the IP address is displayed correctly, the install worked
    IPs
    IPs

That completes the whole P2V migration.


Conclusion

  • I’m not a professional Linux administrator, so please point out any mistakes or omissions. Thanks!
  • If you found this helpful, please share it with someone who needs it. Thank you!

If you enjoyed this, leave a comment~

Random Posts

Loading...