PBS sync and batch restore

phil2987

Member
Mar 17, 2023
21
0
6
I have the following scenario:

Two sites (Site #1 and Site #2). Each site contains 3 hosts, 1 shared storage, and 1 PBS.

Site #1 is the primary site and contains ~240 vm's. Backups run every night without any problems.

The following day, the PBS at Site #2 (the DR site) connects to the PBS at Site #1 and synchronizes the backups. This works perfectly fine.

Now here is the question to which I am unable to find the answer. In the event that Site #1 completely goes away (fire, earthquake, etc), I have all my VM's on the PBS at Site #2 and -- how do I bulk restore them from PBS #2 to the hosts at Site #2?

It is quite easy to do using the GUI -- the PBS is added to the cluster and I can simply click on the vm I want to restore and click "restore". The problem is that in the GUI I cannot select more than one vm at a time to restore. This is a problem with 240 vm's, so I think the only way to do it would be to script it but I don't know which command line program to use. I have read the documentation but I can't find the answer anywhere.

If I execute "proxmox-backup-client snapshot list --repository store1" from my PBS, I see the snapshots below.

What is the command line syntax to restore a VM backed up up by PBS to a PVE host?

Thank you

┌───────────────────────────────┬────────┬────────────────────────────────────────────────────────┐
│ snapshot │ size │ files │
╞═══════════════════════════════╪════════╪════════════════════════════════════════════════════════╡
│ vm/100/2023-09-09T23:13:35Z │ 40 GiB │ client.log drive-scsi0.img index.json qemu-server.conf │
├───────────────────────────────┼────────┼────────────────────────────────────────────────────────┤
│ vm/100/2023-09-10T06:00:08Z │ 40 GiB │ client.log drive-scsi0.img index.json qemu-server.conf │
├───────────────────────────────┼────────┼────────────────────────────────────────────────────────┤
│ vm/100/2023-09-11T06:00:05Z │ 40 GiB │ client.log drive-scsi0.img index.json qemu-server.conf │
├───────────────────────────────┼────────┼────────────────────────────────────────────────────────┤
│ vm/100/2023-09-12T06:00:14Z │ 40 GiB │ client.log drive-scsi0.img index.json qemu-server.conf │
├───────────────────────────────┼────────┼────────────────────────────────────────────────────────┤
 
Hi @phil2987 ,

if I understand you correctly: you search a script to loop thru all VMs and restore each sequentially.

Searching thru the forum I found this: https://forum.proxmox.com/threads/pbs-restore-proxmox-kvm-from-cli.73163/#post-327076

Trying it out, after a
Bash:
pvesm list local1
I could restore a VM manually like this:

Bash:
qmrestore local1:backup/vm/101/2023-09-15T21:18:17Z 100

(here, the "100" is the id of the restored VM)

Perhaps you can create some bash script to loop thru all the list entries ...
 
This works -- thank you! I read that article but I guess I didn't scroll down.

I added the "--storage" option to change the destination storage.

Thanks again.