BorgBackup with Borgmatic provides the most storage-efficient backup solution — deduplication means each backup only stores changed data.
Step 1 — Install
sudo apt install borgbackup -y
pip3 install borgmatic --break-system-packages
Step 2 — Initialize Repository
borg init --encryption=repokey /backups/borg
# Remote:
borg init --encryption=repokey user@backup-server:/backups/borg
Step 3 — Configure Borgmatic
sudo borgmatic config generate --destination /etc/borgmatic/config.yaml
location:
source_directories:
- /var/www
- /etc
repositories:
- /backups/borg
storage:
encryption_passphrase: "your-passphrase"
compression: lz4
retention:
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
Step 4 — Schedule
0 1 * * * borgmatic --verbosity 0 2>&1 | logger -t borgmatic
Step 5 — Restore
borgmatic list
borgmatic extract --archive latest --path /var/www/html/wp-config.php
Conclusion
BorgBackup is the most efficient backup solution for Linux servers. Our team sets up automated backup solutions with verified restore testing.
Comments