Categories
General Computing

Proxmox migrate VM’s from one PVE to another PVE with qcow2

I recently acquired a new Proxmox PVE host and wanted to migrate my existing VM’s without doing anything too crazy with PBS (proxmox back up service) or other storage devices. I also only have local storage, no SAN/NAS setup for the proxmox host. It is a single host, nothing clustered at home right now. So I wanted a simple solution to just lift and migrate. The quickest way I came up with is to use SSHFS to mount on the new box, and then copy the disk and config file over, done. Nothing complicated about it.

Some pre-requisites. The hosts are on the same LAN, configured to use the same subnet and VLAN already. Both PVE are already updated and ready to go on Proxmox 8.4.12.

TL;DR Commands for QCOW2

apt install sshfs -y
mkdir /mnt/pve-target
sshfs root@target:/var/lib/vz /mnt/pve-target
qm shutdown
rsync -ah /var/lib/vz/images// /mnt/pve-target/images//
scp /etc/pve/qemu-server/.conf root@target:/etc/pve/qemu-server/
umount /mnt/pve-target

Step-by-Step Guide


1. Install SSHFS (on source or destination)

On the node where you’ll mount the remote PVE:

apt update && apt install sshfs -y


2. Create mount point and mount remote storage

On source node (where VM currently lives), mount the target PVE via SSHFS:

mkdir /mnt/pve-target
sshfs root@<target-node-ip>:/var/lib/vz /mnt/pve-target

Replace <target-node-ip> with your destination PVE’s IP.


3. Stop the VM to ensure consistent disk

qm shutdown &lt;vmid>

Check if it’s down:

qm status &lt;vmid>


4. Move VM disk(s) to SSHFS mount

Assuming the VM disk is on local storage (/var/lib/vz/images/<vmid>/):

rsync -ah --progress /var/lib/vz/images/&lt;vmid>/ /mnt/pve-target/images/&lt;vmid>/

If the directory doesn’t exist on target:

mkdir /mnt/pve-target/images/&lt;vmid>

You can also use scp instead of rsync, but rsync gives progress and is resumable.


5. Copy VM config

Configs are stored in /etc/pve/qemu-server/<vmid>.conf.

Copy it over:

scp /etc/pve/qemu-server/&lt;vmid>.conf root@&lt;target-node-ip>:/etc/pve/qemu-server/


6. Unmount SSHFS

umount /mnt/pve-target


7. Start VM on target node

Log into target PVE and run:

qm start &lt;vmid>

Check:

qm status &lt;vmid>


Optional Cleanup

If you want to delete the VM from the source PVE:

qm destroy &lt;vmid>

Make sure the migration is successful before doing this.


Tips

  • If your VM uses local-lvm, you’ll need to:
    • Convert the disk to a raw file (with qemu-img convert)
    • Or attach the disk as a block device and copy it differently.
      Let me know if that’s your setup, and I’ll walk you through that too.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x