How do I configure the following backup schedule/option with proxmox?

invisible999

New Member
Apr 24, 2024
11
0
1
Hello everyone. I want to have following backup schedule/option with proxmox.

  1. At 1:30AM weekly on Saturday at 1:30AM the script gracefully shut downs the VM and waits until it is powered off
  2. Takes full backup (not snapshot) of the VM
  3. Once backup is taken, powers on the VM
  4. Keeps last 3 backups.

How do I accomplish the above?
 
Hello everyone. I want to have following backup schedule/option with proxmox.

  1. At 1:30AM weekly on Saturday at 1:30AM
That's something like: Sat 01:30
  1. the script gracefully shut downs the VM and waits until it is powered off
  2. Takes full backup (not snapshot) of the VM
  3. Once backup is taken, powers on the VM
That's the Stop backup mode. Stop means shutdown request to VM (if it is running), wait until it's stopped, run backup and start VM again (if it was running before).
Note that all backup modes take full backups. Snapshot mode means that the VM keeps running.
  1. Keeps last 3 backups.
You can configure this at the storage (or PBS if you use it) or under the Retention tab.
How do I accomplish the above?
I hope the hints above help you get started.
 
Perfect, thank you very much.

One follow-up question - the Stop mode means that it will stop and start the VM after backup. My question - will it take backup if VM is already stopped and will it start VM if it was stopped before after backup completion?

My goal is to ensure that VM is running before and after backup.
 
One follow-up question - the Stop mode means that it will stop and start the VM after backup. My question - will it take backup if VM is already stopped and will it start VM if it was stopped before after backup completion?
If the VM was not running before the backup, it does not get started.
If the VM was running before the backup, it is stared again after the backup (regardless of whether the backup succeeded or failed).
 
Once again thanks. One more question - how can enable this via command line?

I have access to proxmox at a remote location via ssh but not via gui.
 
I have access to proxmox at a remote location via ssh but not via gui.
While I do my own work 99.5% via ssh, you can access that remote WebGui via

Code:
ssh -L 8006:localhost:8006 remoteuser@remote.pve

As long as that session is active your local browser can access https://localhost:8006. (And give a certificate warning of course.)

This works as long as port forwarding is not explicitly disabled by careful sys admins ;-)
 
It a little bit more complicated... :)

In short, I have remote/cloud access to Home Assistant instance. That HA instance is running on Proxmox box. HA has terminal add-on.

So I can in my Chrome log on to HA instance, click on terminal tab, open terminal and then inside the terminal ssh into Proxmox.

I don't have direct access to that remote network.
 
It a little bit more complicated... :)

In short, I have remote/cloud access to Home Assistant instance. That HA instance is running on Proxmox box. HA has terminal add-on.

So I can in my Chrome log on to HA instance, click on terminal tab, open terminal and then inside the terminal ssh into Proxmox.

I don't have direct access to that remote network.
Just use your HA (which usually has a different meaning here on this forum) as a SSH jump-host?

EDIT: Or install Proxmox as a test/learning VM under your Proxmox and figure it out that way? I don't really want to go looking in /etc/pve and crontab just for this.
 
Last edited:
That's something like: Sat 01:30

That's the Stop backup mode. Stop means shutdown request to VM (if it is running), wait until it's stopped, run backup and start VM again (if it was running before).

So I did it but based on logs seems that while proxmox initiates the shutdown, it does not wait VM to be shutdown to start backup.

Take a look at the logs:

May 21 01:30:08 proxmox pvescheduler[225856]: <root@pam> starting task UPID:proxmox:00037241:0096AEE7:664C5B90:vzdump:100:root@pam:
May 21 01:30:08 proxmox pvescheduler[225857]: INFO: starting new backup job: vzdump 100 --quiet 1 --node proxmox --compress zstd --prune-backups 'keep-last=3' --storage local --mode stop --notes-template '{{guestname}}' --fleecing 0

May 21 01:30:08 proxmox pvescheduler[225857]: INFO: Starting Backup of VM 100 (qemu)

May 21 01:30:11 proxmox qm[225865]: <root@pam> starting task UPID:proxmox:0003724E:0096B021:664C5B93:qmshutdown:100:root@pam:

May 21 01:30:11 proxmox qm[225870]: shutdown VM 100: UPID:proxmox:0003724E:0096B021:664C5B93:qmshutdown:100:root@pam:

May 21 01:30:27 proxmox systemd-udevd[347]: /usr/lib/udev/rules.d/60-gasket-dkms.rules:1 Unknown group 'apex', ignoring
May 21 01:30:28 proxmox kernel: tap100i0: left allmulticast mode
May 21 01:30:28 proxmox kernel: vmbr0: port 2(tap100i0) entered disabled state
May 21 01:30:28 proxmox qmeventd[595]: read: Connection reset by peer
May 21 01:30:29 proxmox kernel: usb 1-3: reset full-speed USB device number 2 using xhci_hcd
May 21 01:30:29 proxmox kernel: cp210x 1-3:1.0: cp210x converter detected
May 21 01:30:29 proxmox kernel: usb 1-3: cp210x converter now attached to ttyUSB0
May 21 01:30:29 proxmox kernel: usb 1-9: reset full-speed USB device number 3 using xhci_hcd
May 21 01:30:29 proxmox kernel: Bluetooth: hci0: Firmware revision 0.1 build 19 week 44 2021
May 21 01:30:29 proxmox kernel: Bluetooth: hci0: Reading supported features failed (-16)
May 21 01:30:29 proxmox kernel: Bluetooth: hci0: Error reading debug features
May 21 01:30:29 proxmox kernel: Bluetooth: hci0: HCI LE Coded PHY feature bit is set, but its usage is not supported.
May 21 01:30:29 proxmox systemd[221183]: Reached target bluetooth.target - Bluetooth.
May 21 01:30:29 proxmox systemd[1]: Starting systemd-rfkill.service - Load/Save RF Kill Switch Status...
May 21 01:30:29 proxmox systemd[1]: Reached target bluetooth.target - Bluetooth Support.
May 21 01:30:29 proxmox systemd[1]: Started systemd-rfkill.service - Load/Save RF Kill Switch Status.
May 21 01:30:29 proxmox systemd[1]: 100.scope: Deactivated successfully.
May 21 01:30:29 proxmox systemd[1]: 100.scope: Consumed 4h 2min 17.738s CPU time.
May 21 01:30:29 proxmox qm[225865]: <root@pam> end task UPID:proxmox:0003724E:0096B021:664C5B93:qmshutdown:100:root@pam: OK
May 21 01:30:30 proxmox systemd[1]: Started 100.scope.
May 21 01:30:30 proxmox systemd-udevd[347]: /usr/lib/udev/rules.d/60-gasket-dkms.rules:1 Unknown group 'apex', ignoring
May 21 01:30:31 proxmox qmeventd[225943]: Starting cleanup for 100
May 21 01:30:31 proxmox qmeventd[225943]: trying to acquire lock...
May 21 01:30:33 proxmox kernel: tap100i0: entered promiscuous mode
May 21 01:30:33 proxmox kernel: vmbr0: port 2(tap100i0) entered blocking state
May 21 01:30:33 proxmox kernel: vmbr0: port 2(tap100i0) entered disabled state
May 21 01:30:33 proxmox kernel: tap100i0: entered allmulticast mode
May 21 01:30:33 proxmox kernel: vmbr0: port 2(tap100i0) entered blocking state
May 21 01:30:33 proxmox kernel: vmbr0: port 2(tap100i0) entered forwarding state
May 21 01:30:33 proxmox qmeventd[225943]: OK

May 21 01:30:33 proxmox qmeventd[225943]: vm still running

May 21 01:30:33 proxmox kernel: cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
May 21 01:30:33 proxmox kernel: cp210x 1-3:1.0: device disconnected
May 21 01:30:33 proxmox systemd-udevd[347]: /usr/lib/udev/rules.d/60-gasket-dkms.rules:1 Unknown group 'apex', ignoring
May 21 01:30:33 proxmox systemd[221183]: Stopped target bluetooth.target - Bluetooth.
May 21 01:30:33 proxmox systemd[1]: Stopped target bluetooth.target - Bluetooth Support.
May 21 01:30:38 proxmox systemd[1]: systemd-rfkill.service: Deactivated successfully.
May 21 01:30:44 proxmox kernel: usb 1-9: reset full-speed USB device number 3 using xhci_hcd
May 21 01:30:44 proxmox systemd-udevd[347]: /usr/lib/udev/rules.d/60-gasket-dkms.rules:1 Unknown group 'apex', ignoring
May 21 01:30:45 proxmox kernel: usb 1-3: reset full-speed USB device number 2 using xhci_hcd

May 21 01:34:17 proxmox pvescheduler[225857]: INFO: Finished Backup of VM 100 (00:04:09)
May 21 01:34:17 proxmox pvescheduler[225857]: INFO: Backup job finished successfully
 
So I did it but based on logs seems that while proxmox initiates the shutdown, it does not wait VM to be shutdown to start backup.
It does. But to do a backup QEMU/KVM always starts the VM up to some point (before the virtual BIOS and OS gets loaded). I don't remember the details why. Once the backup is done, the VM fully starts.
 
It does. But to do a backup QEMU/KVM always starts the VM up to some point (before the virtual BIOS and OS gets loaded). I don't remember the details why. Once the backup is done, the VM fully starts.

I am going to do simple ping test - my expectation is that during the backup there should be ping timeout. If ping is not interrupted then the guest OS is never shutdown. Would you agree?
 

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!