Blogger Avatar

人間になりたい!!!!!


皖ICP备2025096275号

Physical Machine P2V Migration to Proxmox VE - Best Solution for Full System Migration

Introduction

I have two broadband internet connections at home. If I only deploy network exit-related services on a single system, I can only use the upstream bandwidth of one connection at a time, which doesn't fully utilize both connections. Therefore, I decided to switch my network gateway sub-server to Proxmox VE. This way, I can use both broadband connections as network exits through firewall rules and load balancing, while also making server management more convenient. But how to migrate without losing the existing operating system and environment on the original server? This article will provide you with the best solution for full migration.

Requirements

  • External storage device >= server system disk data area
  • Server hard disk >= 64GB

Let's Get Started

1. Full Disk Data Backup

  • Install any Linux Live CD on the external storage device. SystemRescue is recommended here, or use Ventoy to integrate multiple ISOs
  • After entering the Live environment, list all disks
lsblk
  • Find your external storage device and mount it to the /mnt/usbdisk directory
mkdir /mnt/usbdisk
mount /dev/<device> /mnt/usbdisk
  • Use the dd tool to create a complete image
dd if=/dev/<device> of=/mnt/usbdisk/backup.img bs=1M status=progress
Note: This process takes a long time (about 30-60 minutes per 100GB of data). Be careful to prevent server power loss to avoid data corruption
  • Use the qemu-img tool to convert the image to qcow2 format
qemu-img convert -f raw -O qcow2 -c /mnt/usbdisk/backup.img /mnt/usbdisk/backup.qcow2
Note: This process still takes a long time. Be careful to prevent server power loss to avoid data corruption
  • After the conversion is complete, the backup phase is finished

2. Install Proxmox VE

We'll use the manual installation method to avoid unexpected disk data formats from the official installer

Reference: A Record of Manually Installing Proxmox VE, Configuring Multi-path iSCSI and NAT Forwarding » Yousheng's Development Diary
  • Configure Hostname

Proxmox VE requires configuring a Hosts entry for the current hostname that points to a non-loopback address:

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, if my server's internal network address is 192.168.1.5 and public network address is 112.32.***.***, the /etc/hosts configuration file should be as follows:

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 your server to be directly accessible from the public network, you can omit the public network information
  • Install Proxmox VE software source
Debian 13 uses the Deb822 format, so you can directly refer to USTC's Proxmox mirror site:
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 to /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 packages
apt update
apt upgrade -y
  • Install Proxmox VE kernel
apt install proxmox-default-kernel
reboot
Use uname -a to check system information. If the kernel version ends with -pve or similar, the installation is successful
  • Install Proxmox VE related packages
apt install proxmox-ve postfix open-iscsi chrony
During configuration, you will need to set up the postfix mail server. Official explanation:
If you have a mail server on your network, you should configure postfix as a Satellite system. Your existing mail server will then act as a relay host, routing emails sent by Proxmox VE to their final recipients. If you don't know what to enter here, just select Local only and keep the system hostname unchanged.
  • After installation, you should be able to access the WebUI using https://<IP Addr>:8006. If you can access it successfully, the installation is complete.
Username: root, Password: your root user password
  • Remove 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 not mandatory, but it's recommended by the official documentation because it may mistakenly recognize virtual machine boot files as multi-system boot files, causing unwanted entries in the boot list.
  • Proxmox VE installation is now complete

3. Create Virtual Bridge Network Card

  • Log in to the Proxmox VE WebUI, navigate to Datacenter --> <Hostname> --> System --> Network tab

Network
Network

  • Click Create, select Linux Bridge
  • In the pop-up dialog, enter the Name you need, then enter the physical network card that this virtual network card will bridge to in Bridge ports

Note:

  • If you want to use this physical network card as the access card for the Debian physical machine system, you need to configure IPv4/CIDR, Gateway(IPv4), IPv6/CIDR(optional), Gateway(IPv6)(optional) in this dialog
    Example
    Example
  • Do not configure a fixed IP address for the server on the physical network card, otherwise it may cause a series of problems such as virtual machines being unable to connect to the network!!
  • Click OK to create the network card

4. Restore Original Server System

4.1 Create Virtual Machine

  • Log in to the Proxmox VE WebUI, click Create VM in the upper right corner, configure the virtual machine name, whether to start on boot, etc. as needed, then click Next
  • In the OS tab, select Do not use any media, then click Next
  • In the System tab, enable Qemu Agent, select whether to change the BIOS to OVMF (UEFI) as needed, then click Next
  • In the Disks tab, click the trash can icon next to scsi0 on the left to delete the default created disk, then click Next
  • In the CPU tab, change Type to host, then allocate cores (Cores) as needed. If there are many cores, you can enable NUMA, then click Next after configuration
  • In the Memory tab, allocate memory as needed, then click Next
Note: Memory allocation should not exceed 80% of physical memory, otherwise there is a risk of memory overflow
  • In the Network tab, select the virtual network card just created as needed, then click Next
Note: If your original system is Windows, you may need to change the network card model to Intel E1000 or Intel E1000E
  • In the final Confirm tab, confirm the configuration is correct and create directly. Wait for the status of VM 100 - Create in the Tasks at the bottom to become OK, then the virtual machine creation is complete

4.2 Restore Original Physical Machine Disk Image

  • Log in to the server via SSH, use this command to list all disks
lsblk
  • Find your external storage device and mount it to /mnt/usbdisk
mkdir /mnt/usbdisk
mount /dev/<device> /mnt/usbdisk
  • Copy the previously created qcow2 image file to the server
cp /mnt/usbdisk/backup.qcow2 /var/lib/vz/images/100/vm-100-disk-1.qcow2
Note: This process may take a long time. Please ensure the server does not lose power to avoid data corruption
  • After copying is complete, use this command to import the disk into the corresponding virtual machine
qm set 100 --scsi0 /var/lib/vz/images/100/vm-100-disk-1.qcow2
  • Use this command to set the boot order
qm set 100 --boot order=scsi0
  • After execution, select the corresponding virtual machine in the WebUI and start it
  • If the virtual machine starts normally to the previous host system, the restoration is complete!

5. Install Qemu-Agent

  • Log in to the virtual machine via SSH, install qemu-agent
sudo apt install qemu-guest-agent
  • Start and configure auto-start
sudo systemctl enable qemu-guest-agent
sudo systemctl start qemu-guest-agent
  • Return to the virtual machine's Summary page in the WebUI. If you see the IP address displayed correctly, the installation is successful

IPs
IPs

This concludes the entire P2V migration process


Conclusion

  • I am not a professional Linux administrator. If there are any errors or omissions, please point them out directly, thank you!
  • If you find this article helpful, please share it with people around you who need it, thank you!
Physical Machine P2V Migration to Proxmox VE - Best Solution for Full System Migration
https://blog.nanami.tech/en/archives/263/
Author Madobi Nanami
Publish Time 2026-03-27
License CC BY-NC-SA 4.0
Post a new comment