Borg backup examples and tutorials 2025
Corrected the spelling of 'example' and added 'tutorials' to focus on instructional content, as well as the current year to yield the most relevant and up-to-date results.
BorgBackup, commonly referred to as Borg, is a powerful, open-source backup solution designed for efficient storage and management of backups through features like deduplication, compression, and encryption. This guide aims to provide you with practical examples of using Borg Backup, from installation to creating and restoring backups.
BorgBackup is a deduplicating archiver that focuses on efficient storage. It ensures that only unique data is stored in the backup repository, minimizing space usage and enhancing the speed of backup operations. It supports various functionalities, making it a preferred choice for individuals and system administrators alike.
Before initiating backups, it's essential to install Borg. Here's a streamlined installation guide for popular Linux distributions:
sudo apt update
sudo apt install borgbackup
sudo yum install epel-release
sudo yum install borgbackup
sudo pacman -S borg
For detailed information on installation on various systems, refer to the official documentation on Borg Backup Quick Start [2].
Once Borg is installed, you'll need to create a backup repository. This repository will store your backups.
borg init --encryption=repository /path/to/your/repository
Replace /path/to/your/repository with your desired path. The --encryption=repository option enables encryption on the repository level.
To back up a directory (e.g., /home/user/documents), use the following Borg command:
borg create --progress /path/to/your/repository::my-backup-{now:%Y-%m-%d} /home/user/documents
/path/to/your/repository: Your Borg repository path.my-backup-{now:%Y-%m-%d}: This creates a backup archive named with the current date.Periodically, it's essential to manage your backup repository to save space. Borg provides a pruning feature:
borg prune --list /path/to/your/repository --keep-daily=7 --keep-weekly=4 --keep-monthly=12
This command keeps the last seven daily backups, four weekly, and twelve monthly backups.
Restoring files from a Borg backup is straightforward. To extract a specific backup, you can use:
borg extract /path/to/your/repository::my-backup-2025-08-18
This command will restore the backup made on August 18, 2025, to the current directory.
If you're looking for deeper dives into BorgBackup, consider these resources:
BorgBackup is an excellent tool for anyone looking to implement an efficient and robust backup solution. With its features of deduplication, encryption, and ease of use, it stands out as a top choice for personal or professional backup needs. By following the above examples, you can quickly set up, maintain, and restore your data, ensuring your information remains secure and accessible. For further exploration, refer to the official documentation and community forums for support and advanced techniques.