Backing up a Proxmox Backup Server repository

During the summer break, I took the time to think about how I can improve my server backup setup, taking into account the existing installation. I have done some research to not find much. So, to fill in the void, I will write up about how I have done a copy of a Proxmox Backup Server backup repository.

How I backup this beautiful world?

To backup the nice world on my server, I went through multiple solutions. Some were bulky, others a bit questionnable, more or less fast to execute.

To cite a few:

  • Writing files directly in a folder on my NAS with vzdump;
  • Writing files on the server with vzdump, then saving the files with BorgBackup;
  • Same as before, but including a step to extract the "vma" files before putting the files through BorgBackup.

The first variation was good, alebeit a lot in file size because there was duplicated data. The second was okay. The third wasn't a failure, it didn't work very well.

In the end, I have installed a Proxmox Backup Server virtual machine on the server and configured all the things, both on the hypervisor and the virtual machine side. The backup datastore is on the NAS. Those backups of containers and virtual machines are well deduplicated. Long story short, "it makes the coffee".

Making a copy of all this

I have backups of the containers and virtual machines. It's nice. I would like to have a copy somewhere in case something happens or I need a relic.

The copy will be done on a Raspberry Pi 4 that will more than suffice for this use case. This Raspberry Pi will have an external hard drive connected via USB.

Proxmox Backup Server on an ARM CPU

First, I quickly inquired the Proxmox forums to see if there was a way to install the backup solution on a machine with an ARM CPU. I have found a topic talking about supporting ARM on PBS1. They don't intend to support ARM since they want to fist stabilize the experience on x86 / amd64 CPUs. I am not surprised of this answer, considering the solution is "relatively" young.

I tried to understand how this would be compiled because... uh... there's no build instructions or they were vague. I eventually found Docker images where I could still hope to have something that works. I tried once, compile error. I try another "version", compile error. Other images exist but they are for ARM64 CPUs. Might as well say that I have put this possiblity aside.

Furthermore, with the searched terms, it was the desert, so I went on with the other solution I will describe below.

A silly rsync

I've had fun rsyncing the existing repository from the backup server ─ so from the virtual machine with PBS ─ in order to make a copy on the Raspberry Pi's hard disk. The transfer of 100 GB took a while with all the small files, but the operation eventually finished. If it wouldn't finish, there would be a problem somewhere.

The command in question, for the curious readers:

rsync -avh user@0.0.0.0:/path/to/source/ /path/to/destination

The user, the address, the source and destination folders are to be replaced with your own values, obviously.

Now that I have a copy, I would like ot access it one way or another

Accessing the copy

To access the copy I have made, I have used my existing installation of PBS to see if it would work, before installing a virtual machine for this on my side.

I have installed the NFS server on the Raspberry Pi, configured an exported folder in /etc/exports, reloaded the configuration with exportfs -ra. This folder will then be mounted into the file system of the virtual machine with mount 0.0.0.0:/path/to/copy /path/to/montpoint. If everything goes well, you should have access to the copy from the client and see that the files retained their attributes.

On the side of the configuration of PBS, there are a couple of lines to add in the file that lists datastores, /etc/proxmox-backup/datastore.cfg:

datastore: remote-repository
    path /path/to/montpoint

If everything is correct, you should see a the new datastore appear with your backups and you will be able to interact with it.

To "close" the copy, you have to do the reverse operation: remove the backup repository from /etc/proxmox-backup/datastore.cfg, then forcefully unmount (umount -lf) the NFS share. If we don't specify -lf, umount will not do the operation because the .lock file in the repository root is still open by PBS.

The end word

At least, I have a copy of the backup repository, in case something would happen. Since I didn't find much inquiring the internet, a good part of the proof of concept has been exploring different trails to achieve an acceptable solution. The solution on my side is:

  • Regularly copying the files from the repository with rsync, without deleting existing files that wouldn't be in the source;
  • Accessing the copy with a virtual machine on an x86 CPU.

I also had fun exploring the files from the repository to see how things work under the hood. Fortunately, the format of the binary files are included in the documentation. With this, there are many ways to have fun.


1

Proxmox Backup server