Last active
February 26, 2023 10:44
-
-
Save mmaridev/477b65ae1245033e2118417380644ec2 to your computer and use it in GitHub Desktop.
Backup & restore for VM migration on the fly, without cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run command on new node | |
ssh root@oldnode vzdump VMID --mode snapshot --compress 0 --remove 0 --node NODE --stdout | ( | |
sleep 5; | |
/usr/sbin/qmrestore - NEWVMID --storage local-zfs | |
) | |
# also works (vice-versa) for containers | |
vzdump PCTID --mode snapshot --compress 0 --remove 0 --node NODE --stdout | ( | |
sleep 2 | |
ssh NEWNODE pct restore NEWPCTID - --storage local-zfs --rootfs 0 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment