migrate.sh: init

This commit is contained in:
Astro 2022-06-16 23:19:28 +02:00
parent 2fb9b465a3
commit 3c34366889
1 changed files with 14 additions and 0 deletions

14
migrate.sh Executable file
View File

@ -0,0 +1,14 @@
#! /usr/bin/env bash
# Helps migrating running proxmox containers to provisioned but stopped MicroVMs.
# Example usage:
# ./migrate.sh server7.cluster.zentralwerk.org 113 server10.cluster.zentralwerk.org dn42
OLD_SERVER=$1
PROXMOX_ID=$2
NEW_SERVER=$3
MICROVM_NAME=$4
ssh -C root@$OLD_SERVER -- lxc-attach $PROXMOX_ID -- /run/current-system/sw/bin/tar --numeric-owner -C / -cpf - etc home var |
pv -br | \
ssh -C root@$NEW_SERVER -- tar -C /var/lib/microvms/$MICROVM_NAME -xpf -