||3 weeks ago|
|LICENSE||2 years ago|
|README.md||2 years ago|
|server_backup.sh||3 weeks ago|
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).