Best practice for Proxmox self-backup

speedbird

Well-Known Member
Nov 3, 2017
73
8
48
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!
 
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
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.
 
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.
 
Thank you so much :) This is perfect! Exactly what I was looking for! Only one question, why does everything has to be shut down? Is this necessary for each run?
 
  • Like
Reactions: DerDanilo
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
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
Hm a spice viewer? Help me out here, does this software have some kind of backup feature?
 
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.
 
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
Why do I have to omit the description? Will this spam the log or why is it?
If you run it via cron you need to send "enter" to the script to actually have it run. Otherwise it will just wait for user input when running via cron.
 
  • Like
Reactions: speedbird
Alright, just saw that line "Hit return to proceed..." and knew why :) Sorry for the dumb question :)
 
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, 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!