Borg Backup is a modern, efficient, and secure approach to backing up data. It minimizes storage space by only storing unique data chunks across all backups.
Installation can vary by system. On most Linux distributions, you can use the package manager:
# For Debian/Ubuntu systems
sudo apt install borgbackup
# For Red Hat/CentOS systems
sudo yum install borgbackup
# For Arch Linux
sudo pacman -S borg
A repository is where backups are stored. It can be on a local filesystem or a remote server.
An archive is a single backup instance within a repository.
Borg identifies and stores identical data chunks only once across all archives, saving significant storage space.
borg init --encryption=repokey /path/to/repo
borg create /path/to/repo::archive-name /path/to/data
borg list /path/to/repo
borg extract /path/to/repo::archive-name
Borg supports several encryption modes. repokey and keyfile are common choices, with repokey being more convenient for single-user setups.
Backup encryption keys should be stored securely, separate from the backup data.
To automate backups, create a cron job:
0 3 * * * borg create /path/to/repo::`date +%Y-%m-%d` /path/to/data
This example runs a backup daily at 3:00 AM.
Prune old backups to save space:
borg prune -v --list /path/to/repo --keep-daily=7 --keep-weekly=4 --keep-monthly=6
Regularly check the integrity of your repository:
borg check /path/to/repo