Doing a Backup to a Remote-Server with Borgbackup

As i am paranoid, i wanted to do a backup of my server – as implicated in the wordpress-setup howtos i have some instances of wp on the server, as well as some files and gameserver.

Naturally i want to have a backup. The catch: I dont have local space, so i have to do it remote.

I know borgbackup for some years now, and so i used it. (https://borgbackup.readthedocs.io/en/stable/quickstart.html#)

It is mainly straight-forward, assuming that you can connect via ssh.

To do my backup i used the following commands which i try to explain down below:

First i had to create a new folder on my backup-destination-server, in this case $backupfolder. After that i used:

borg init –encryption=repokey myuser@mydestinationserver:/path/to/my/hdd/for/backups/$backupfolder

sudo borg create –stats –compression zstd,22 –progress myuser@mydestinationserver:/path/to/my/hdd/for/backups/$backupfolder::archivename /home/ /var/www/ /etc/apache2/

The init is needed to create the repo on the remote sever. You can use any location you want, but MAKE SURE you have enough empty space there. You will be asked for a repository-password that you shouldnt forget if you want to restore the data in the future.

Next i started the backup. the compression is set to high to use less bandwidth. The –stats will be shown after borgbackup has finished, while –progress is updated in realtime.

The archivename is just a name for the archive in the repository. they can be re-used or you can let them rot forever on your server. Mine was “june”, for example – because its june. My next backup will be in july – and the name will be “july”. Next year the archive will be overwritten.

The three folders at the and are my local folders that are being backed up.

Thats it!

Leave a Reply

Your email address will not be published.