"bare metal" backup/recovery

Trigve

New Member
Oct 15, 2016
29
0
1
42
Hi,
I've tried to find some info about bare metal backup/recovery of proxmox installation (with ZFS). After searching and lot of trying I came up with some "walkthrough", although not a real bare metal. The scripts etc. are gathered from lot of places (also this forum) and updated for my needs. I've tested it (but not in depth) and would like to know opinions if I've got something wrong:

- Make the backup of the root with the given script (.txt files are only if something goes wrong when creating the rpool).

Code:
# /bin/bash
BACKUP_LOC=/tmp/zfs_backup
mkdir $BACKUP_LOC
zpool get all rpool > $BACKUP_LOC/zpool.txt
zpool list > $BACKUP_LOC/zpool.list.txt
zfs list -r rpool > $BACKUP_LOC/zpool.list.rpool.txt

zfs snapshot -r rpool@rpool.snap
zfs destroy rpool/swap@rpool.snap

zfs send -Rv rpool@rpool.snap > $BACKUP_LOC/backup.zfs

for snap in `zfs list -H -t snapshot | grep "@rpool.snap" | cut -f 1`; do echo -n "Destroying $snap..."; zfs destroy $snap; echo "  Done."; done


- Start proxmox liveCD, install as ZFS zraid0 (or other configuration). Reboot.
- Start proxmox liveCD debug, ctrl+D on first console. Then "Abort" on first screen.

Code:
$ zpool import -R /mnt rpool
$ zfs receive rpool < /path/to/zfs/rpool/full/snapshot

$ mount -t proc /proc /mnt/proc
$ mount --rbind /dev /mnt/dev
$ mount --rbind /sys /mnt/sys
$ chroot /mnt /bin/bash
(chroot)$ source /etc/profile
(chroot)$ grub-install /dev/your/main/disk
(chroot)$ update-grub2
(chroot)$ update-initramfs -u

- Reboot.

The root system should be in the state, when the snapshot has been produced.

Thank you
 
I'd suggest to create your own Live-Debian with integrated ZFS (you have to do that yourself) and use it to restore the ZFS-Pool. I really like it when my backup program created a script to restore the backup itself, so that you do not need any notes to restore. Just start the created back script. Then is also crucial for automatic backup tests inside VM or off-site-locations.
 
Thanks for the reply,
do you have some useful links yo could share? I have already found some stuff about creating custom live CD, but would like to have as much as possible info.

Thanks
 
A rather old thread, however, still relevant for disaster preparations if running single node installations of Proxmox.

I found this nice writeup on generating a ZFS enabled liveCD (it might be the new CDs already have ZFS built-in - I haven't checked yet) but in case someone finds this post looking for a bare metal restore process, here is the link to the the web article for a ZFS enabled liveCD: ZFS Enabled LiveCD

Hope it helps.
 

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!