BorgBackup can be installed on Linux, macOS, and other Unix-like systems.
sudo apt update
sudo apt install borgbackup
sudo yum install epel-release
sudo yum install borgbackup
brew install borgbackup
To install BorgBackup on QNAP, you need to use the QNAP QTS management system with Entware. Follow these steps:
opkg update
opkg install borgbackup
borg --version
Before creating a backup, you need to initialize a Borg repository.
borg init --encryption=repokey /path/to/repository
You can also use remote repositories via SSH:
borg init --encryption=repokey user@host:/path/to/remote/repo
To create a backup, use the create command:
borg create --progress --stats /path/to/repository::archive-name \
/path/to/backup
Example:
borg create --progress --stats /mnt/backup::bk-2024-01-01 /home/user
You can verify the integrity of a backup with:
borg check /path/to/repository
To maintain a sensible retention policy, use the prune command:
borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=6 /path/to/repository
This will keep 7 daily backups, 4 weekly backups, and 6 monthly backups.
To restore files or directories, use the extract command:
borg extract /path/to/repository::archive-name
You can extract a single file:
borg extract /path/to/repository::archive-name path/to/file
You can also mount a backup as a disk on a Linux/Debian/Ubuntu system to explore files:
borg mount /path/to/repository::archive-name /mount/point
To unmount:
borg umount /mount/point
To list the backups present in the repository:
borg list /path/to/repository
To connect to a remote repository and create a backup, use the following syntax:
borg create --progress --stats user@host:/path/to/remote/repo::archive-name /path/to/backup
Example:
borg create --progress --stats user@192.168.1.10:/backups/borg::bk-2024-01-01 /home/user
borg info /path/to/repository
borg delete /path/to/repository::archive-name
BorgBackup is a powerful tool for managing incremental and compressed backups. It can be easily automated with cron jobs or scripts.