[TUTORIAL] backup a running proxmox zfs bare metal host and restore or clone to new hardware

klauskurz

Renowned Member
Mar 8, 2013
12
5
68
This is a proof of concept for backup and restore or clone a proxmox zfs bare metal host on a home lab system.
This is not about VM backup.
For production environments more tests are necessary.

TL;TR


backup running system to <destination>
Code:
zfs snapshot -r  rpool@export
zfs send -R rpool@export | gzip  > <destination>/backup-pve-rpool@export.gz
sgdisk --backup=<destination>/sgdisk-dev-sda /dev/sda
dd bs=64M if=/dev/sda1 | gzip  > <destination>/dev-sda1.gz
dd bs=64M if=/dev/sda2 | gzip  > <destination>/dev-sda2.gz


restore with rescue console on new hardware from <source>
Code:
sgdisk --load-backup=<source>/sgdisk-dev-sda /dev/sda
gzip -c -d <source>/dev-sda1.gz | dd of=/dev/sda1
gzip -c -d <source>/dev-sda2.gz | dd of=/dev/sda2
zpool create -f -o ashift=12 rpool /dev/disk/by-id/<ata-xxxxxxxxxxxx>-part3
gzip -c -d <source>/backup-pve-rpool@export.gz | zfs receive -u -v -F rpool
zfs set mountpoint=/rpool       rpool
zfs set mountpoint=/rpool/ROOT  rpool/ROOT
zfs set mountpoint=/            rpool/ROOT/pve-1
zfs set mountpoint=/rpool/data  rpool/data
zfs set mountpoint=/var/lib/vz  rpool/var-lib-vz
zpool set cachefile=none rpool
zpool export rpool

Please see the full guide on github.
https://github.com/KlausKurz/guide-...x/pve-bare-metal-host-backup-clone-restore.md

Comments very welcome
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!