moving VM between hosts maintaining snapshots?

Mastsrl

Member
Oct 4, 2020
7
2
23
Argentina
Hello,
i've been googling a lot and i can't find a single satisfying answer to this:
I have a pve 7.4 host and i want to migrate the VMs -preserving ALL snapshots- to a 8.3 host, they're not part of a cluster(and they won't be), both use ZFS as local storage.

I've tried backup/restore it does not work as it does not preserve the snapshots
 
When ceph is a solution there then preserve on nfs works too. :)
zfs send/revc isn't possible between the 2 single pve's ?
 
preserving ALL snapshots- to a 8.3 host, they're not part of a cluster(and they won't be), both use ZFS as local storage.

ZFS replication does this. But to use this approach with the PVE tooling you need to have both machines in a cluster. (Actually I would recommend this, just build a temporary cluster...)

A possible manual way - without using PVE tools - would be to read and understand man zfs-send.

With this you can transfer all data in a ZFS dataset (or ZVol in this case) including all ZFS-snapshots. Then manually copy /etc/pve/local/qemu-server/<yourvmid>.conf and edit it manually to reflect the new names of storage etc. This file includes a separate stanza for each snapshot. Depending on the number of snapshots it may be long...


There might be several pitfalls, but technically this is possible. And because you are creating and modifying a copy of the original data there is no fear for accidental data loss :-)
 
Last edited:
ZFS replication does this. But to use this approach with the PVE tooling you need to have both machines in a cluster. (Actually I would recommend this, just build a temporary cluster...)

A possible manual way - without using PVE tools - would be to read and understand man zfs-send.

With this you can transfer all data in a ZFS dataset (or ZVol in this case) including all ZFS-snapshots. Then manually copy /etc/pve/local/qemu-server/<yourvmid>.conf and edit it manually to reflect the new names of storage etc. This file includes a separate stanza for each snapshot. Depending on the number of snapshots it may be long...


There might be several pitfalls, but technically this is possible. And because you are creating and modifying a copy of the original data there is no fear for accidental data loss :-)
it seems i will have to use zfs send/receive then, will have to do some tests
 
  • Like
Reactions: UdoB
doing more tests ended up using these commands logged on old server:
Code:
zfs send -LcR rpool/data/vm-109-disk-0@replica | ssh [new server ip] zfs recv rpool/data/vm-109-disk-0

i then copied the config file with:
Code:
scp 109.conf root@[new server ip]:/etc/pve/qemu-server

For some reason the SSD emulation checkbox on the hard disk is greyed out, but if i manually edit the config to add it (ssd=1) then the disk dissapears from the web gui config...