Incremental Backup System Using BORG backup as Backend

I want to share with you a collection of bash scripts that I made to perform incremental backups of Vesta Control Panel users and server config, using Borg Backup as backend. Maybe you can analize the possibility to add this to the Hestia panel.

The problem
Vesta CP provides by default a backup system, this backup system creates a tar for each user every day (by default 10 copies are saved), But this way of making backups has some disadvantages when you have a lot of users:

  • Server overload. Earch time the backup is run, a complete copy of user files are saved.
  • Disk space consumption. Each backup copy contains a full backup of the user files. So its very easy to run out of disk space.

The solution
An incremental backup is one in which successive copies of the data contain only the portion that has changed since the preceding backup copy was made. This way you can store lot of backups points, without making a full backup each time.

Borg Backup does an excellent job making incremental backups. And provide very interesting features such as compression, encryption and good performance. You can get more info at https://www.borgbackup.org/

How the script collection works
The main backup script is designed to be run every day via cronjob. This script saves a snapshot of all users, server config and vesta directory into different Borg repositories.

This borg repositories are saved in /backup by default, organized in folders.

Then, different scripts are provided to automatically restore users, webs, mail domains or databases if needed.

Additionally, it is possible to archive users who are no longer active (they are saved into an offline archive directory), and in these users the incremental backups do not run. In this way we also save disk space.

Full explination, install instructions and documentation is available here:

Its my first git project, please let me know what you think about it.

3 Likes

I’ve been using restic for backups recently, which is a very similar piece of software to borg, and I’m wondering why we ever bothered with tar gzipped archives! Its definitely a much more efficient and flexible backup system. I’m guessing it would be hard work to integrate it into Hestia to replace the existing backup though …

It has been over a year since I looked into Restic; it didn’t support compression, but it had nice deduplication. Restic was slower and used more RAM compared to Borg.

There is a nice comparison at stickleback from a couple of years ago, not sure how much has changed since:

The single big advantage that Restic has over Borg is the support for different types of backup storage. If you need anything other than local storage or remote storage accessed via SSH, then you will have to use Restic. On the other hand, if you have backup storage that is accessible over SSH, then the flexibility and performance of Borg makes it the better tool.

Restic’s memory requirements makes it unsuitable for backing up a small VPS with limited RAM, and the slow backup verification process makes it impractical on larger servers. But if you are backing up desktop or laptop computers then this may not matter so much, and using Restic means that you don’t have to setup your own storage server.
https://stickleback.dk/borg-or-restic/

Yep, wasn’t trying to start a ‘my backup software is better than yours’ war. :slight_smile: I chose restic precisely because I needed to backup to a google drive. Could have easily used borg had that not been a requirement. Both are fine tools to have.

I would like to see this working with HestiaCP.

Please feel free to start implement it, you’ll find informations hoe you can contribute to to project here: hestiacp/CONTRIBUTING.md at main · hestiacp/hestiacp · GitHub

Thanks mate!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.