Introduction to Borg Backup
I’ve been on the hunt for a reliable backup solution that can handle my laptop’s limited disk space for ages. When I stumbled upon Borg Backup in 2025, I thought I’d finally found the answer. This deduplicating backup program has been a game-changer, but I soon realized that its default settings weren’t exactly optimized for my laptop’s storage constraints. So, I set out to tame the beast and get Borg Backup to respect my laptop’s limited disk space.
Understanding Borg Backup
Borg Backup is a powerful tool that uses deduplication to reduce storage requirements. It creates a repository where all your backups are stored, and each backup is a snapshot of your data at a particular point in time. Borg uses a concept called “archives” to store these snapshots, and each archive contains a complete copy of your data. By default, Borg keeps all archives forever, which can lead to a significant accumulation of data over time. I’ve seen this go wrong when you have a large repository and limited disk space - it’s not a pretty sight.
Configuring Borg for Limited Disk Space
To get Borg to play nice with my laptop’s limited disk space, I had to configure it to prune old archives and limit the overall size of the repository. The real trick is finding the right balance between keeping enough backups and not running out of disk space. Borg provides a few options to achieve this:
# Create a new Borg repository with a limited size
borg init --storage-quota 10G /path/to/repo
# Configure Borg to keep only the last 7 days of backups
borg config /path/to/repo --set retention keep_daily=7
In practice, I’ve found that creating a new repository with a limited size and configuring it to keep only the last 7 days of backups works well for my needs.
Pruning Old Archives
Borg provides a prune command that can be used to remove old archives and free up disk space. I usually start with a daily cron job to run the prune command and ensure that my repository stays within the configured size limits:
# Add a cron job to run the prune command daily
crontab -e
0 0 * * * borg prune --prefix='daily-' --keep-daily=7 /path/to/repo
This is where people usually get burned - forgetting to prune old archives can lead to a massive repository that’s hard to manage.
Monitoring Repository Size
To keep an eye on my repository size, I’ve added a script to monitor it and send me an alert if it exceeds the quota:
# Create a script to monitor repository size
#!/bin/bash
REPO_SIZE=$(borg info /path/to/repo | grep "Total size" | awk '{print $3}')
if [ $REPO_SIZE -gt 10G ]; then
echo "Repository size exceeded quota" | mail -s "Borg Repository Size Alert" [email protected]
fi
Don’t bother with complicated scripts - a simple one like this will do the trick.
Security Considerations
When configuring Borg Backup, security is a top concern. To mitigate the risk of storing sensitive data in the repository, I’ve encrypted my repository using Borg’s built-in encryption feature:
# Create a new Borg repository with encryption
borg init --encryption=repokey /path/to/repo
This ensures that my data is protected even if the repository is compromised.
Further Reading
For more information on Borg Backup, I recommend checking out the official Borg documentation. The Arch Linux Wiki also has an excellent article on configuring and using Borg Backup.
See also
- Taming Resource-Intensive Desktop Apps with cgroups on Linux
- Taming My Terminal History: Customizing Bash History Behavior to Reduce Clutter
- Taming the Beast: How I Finally Got My Laptop's Power Consumption Under Control with Linux
- Taming the Beast: My Favorite Aliases and Functions for Taming Long Commands in Bash
- Taming Background Tasks with Nohup and Systemd: A Homelab Lesson Learned