|DecaTec bf6405ea0e||1 year ago|
|LICENSE||4 years ago|
|README.md||4 years ago|
|server_backup.sh||1 year ago|
Backup script for Linux servers utilizing Borg Backup. It is based on the (German) article Backup-Strategie für Linux Server.
The backup is created in two steps:
- Whole applications are backed up separately into a (temporary) local backup directory. As an example, Nextcloud is backed up by the script Nextcloud Backup Restore. But you could also back up any other application, e.g. Wordpress (see Wordpress Backup-Restore).
- Borg Backup is used to backup pre defined directories besides the local backup directory where the application backups are stored.
Important After cloning or downloading the repository, you'll have to edit the script so that it fits you needs (directories, applications included in the backup, etc.). All values which need to be customized are marked with TODO in the script’s comments.
Before calling the script, initialize a Borg repository using following command (using a password):
borg init -e repokey-blake2 /media/hdd2/server_backup/borg
To create a backup, simply call this script as root after your customization.
You can also run this script with cron in order to automate the backup (In this example every night at 2 am):
0 2 * * * /home/user/scripts/server_backup.sh > /dev/null 2>&1
You can inspect the Borg repository to find a specific backup set:
borg list /media/hdd2/server_backup/borg/
A backup set can then be mounted:
mkdir -p /mnt/borg borg mount /media/hdd2/server_backup/borg::20191006_020001 /mnt/borg
You can then copy contents from the mounted backup set (e.g. using cp).