Best practice for Proxmox self-backup

Nov 3, 2017
45
4
8
I was wondering the other day... Since I do backups of all my VMs every night, what the best practice would be to backup the main files of the proxmox host itself.

Let's say there's a fatal failure on a single node where the drives crash and one has to rebuild the proxmox host on new hardware. What are the directories and files to restore to have the host back up and running in no time with all the settings and configuration one had before the crash?

Also, what's the best choice of backup where in terms of how-to?

Thanks a lot!
 
  • Like
Reactions: Marta Ilha

LnxBil

Well-Known Member
Feb 21, 2015
4,216
406
83
Germany
If you're using ZFS, just snapshot rpool/ROOT/pve-1 and send/receive it. If you're using LVM or other "old" Linux stuff, just tar / and exclude all mount points (assuming you have /var/lib/vz not on the same disk as /) and store your partition and lvm configuration besides the tar file.

In case of recovery just
  • restore your partition layout
  • restore lvm
  • create filesystem
  • unpack tar
  • install grub
  • reboot
 
  • Like
Reactions: speedbird
Jan 21, 2017
280
26
28
30
Berlin
With 5.x you can simply add a "backup node" to the cluster who's only purpose is to receive the "backups" via the replication feature (gui). This does not replace offside backups, but does surely narrow the timeframe of lost data in case of a total hardware failure.
 
Nov 3, 2017
45
4
8
With 5.x you can simply add a "backup node" to the cluster who's only purpose is to receive the "backups" via the replication feature (gui). This does not replace offside backups, but does surely narrow the timeframe of lost data in case of a total hardware failure.
That is nice but if you don't have an additional node available that's out of the question again. I basically only need a solution to backup proxmox itself, not the vms as they're already backed up anyway. I do use LVM by the way, no ZFS.
 
Jan 21, 2017
280
26
28
30
Berlin
I just wrote a bash script to backup required config (quick and dirty). I will finish/adjust the script in future.
You are welcome to collaborate.

https://github.com/DerDanilo/proxmox-stuff

Hope that helps for now. I'd recommend to push the backups to an external storage via scp/sshfs or something.
I will extend the script when I have time for that.
 
Last edited:

Rhinox

Active Member
Sep 28, 2016
272
36
28
29
Because PVE can not do proper backup of running VMs, just snapshot of its filesystem. If at the time of backup VM was running, you might (but do not have to) end with inconsistent backup. For some type of VMs this risk might be unacceptable (i.e. db-servers)...

As much as I like PVE, some of my hosts are still running ESXi because it *can* do proper backup of running VM (that is capture snapshot of running VM, including its memory, and later restore it to exacly the same running state as it was at the time of backup, with all processes running, etc).
 
  • Like
Reactions: AlexLup
Nov 3, 2017
45
4
8
Because PVE can not do proper backup of running VMs, just snapshot of its filesystem. If at the time of backup VM was running, you might (but do not have to) end with inconsistent backup. For some type of VMs this risk might be unacceptable (i.e. db-servers)...

As much as I like PVE, some of my hosts are still running ESXi because it *can* do proper backup of running VM (that is capture snapshot of running VM, including its memory, and later restore it to exacly the same running state as it was at the time of backup, with all processes running, etc).
Yes, I know that, but we're talking only about the backup of proxmox itself, not VMs as they're already backed up separately. As I said, I only need the main proxmox configuration to be backed up without any kind of VM backup.
 
  • Like
Reactions: DerDanilo

tom

Proxmox Staff Member
Staff member
Aug 29, 2006
13,686
434
83
Hm a spice viewer? Help me out here, does this software have some kind of backup feature?
sorry, I posted this one to the wrong thread.
 

LnxBil

Well-Known Member
Feb 21, 2015
4,216
406
83
Germany
As much as I like PVE, some of my hosts are still running ESXi because it *can* do proper backup of running VM (that is capture snapshot of running VM, including its memory, and later restore it to exacly the same running state as it was at the time of backup, with all processes running, etc).
Sorry, but that is not a proper backup. It can work in some cases, but a real backup can only be done with the help of the program you want to backup inside or your VM.

For database servers, this is very easily done with a log switch to have a crash consistent VM. In PVE with KVM exists the qemu guest agent which can do exactly this [1], e.g. also for Microsoft based systems with shadow copy. Please search for forum for further information. Furthermore, for a "real" database, you need PITR (point-in-time-recovery), which is also done directly inside of your database and not from the outside.

[1] https://pve.proxmox.com/wiki/Qemu-guest-agent
 
  • Like
Reactions: DerDanilo
Jan 21, 2017
280
26
28
30
Berlin
  • Like
Reactions: micro
Jan 21, 2017
280
26
28
30
Berlin
I will update the script in future to support a ssh/scp/ftp target to push the files to. But for now this works quite good.

I put the script itself in the folder where the config backup should go into and crontab calls it from there. If the backup storage is not mounted it will simply not execute the script. This way it won't run into an error.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!