borgbackup create backup specific name cycle size limit 3
Refined the query by clarifying terms like 'cycle' and 'size limit' for better specificity, which should help in retrieving more relevant documentation and examples related to using BorgBackup for cyclical backups.
To create a backup using BorgBackup with a specific name that cycles when the size limit reaches three archives, you can follow a structured approach. Below, I’ll provide an overview of BorgBackup and guide you through the necessary commands and configurations.
BorgBackup (or simply Borg) is a versatile deduplicating backup program that efficiently compresses your data, stores it securely, and supports authenticated encryption. It is designed for flexibility and performance, making it a popular choice for both personal and professional use.
Before you can create backups, ensure that BorgBackup is installed on your system. If it’s not already installed, you can usually do so via package managers on Linux, or by following instructions for your operating system from the BorgBackup documentation.
You need to create a backup repository where your backups will be stored. Run the following command to initialize your repository:
borg init /path/to/your/repository
Replace /path/to/your/repository with the actual path where you want to store your backups.
To create a backup with a specific name, you can use the following command:
borg create --progress /path/to/your/repository::archive-name /path/to/files/to/backup
Here, replace archive-name with your desired name and /path/to/files/to/backup with the actual files or directories you wish to backup.
To cycle through backups when the number of archives exceeds three, you need to use a combination of borg prune command. Here’s how to manage this:
Create a Cron Job (optional): If you want the backups to run automatically at specified intervals, you might consider setting up a cron job. Edit your crontab with:
crontab -e
Add Pruning Logic: Use the borg prune command to keep only the last three backups. This command should be run after your backup command. The following command will keep the last three archives:
borg prune --prefix 'archive-name-' --keep-last 3 /path/to/your/repository
Here’s a full command sequence grouped together:
borg create --progress /path/to/your/repository::archive-name-$(date +%Y-%m-%d_%H-%M-%S) /path/to/files/to/backup
borg prune --prefix 'archive-name-' --keep-last 3 /path/to/your/repository
borg create: This command creates a new backup archive.--progress: Shows the backup progress in the terminal.$(date +%Y-%m-%d_%H-%M-%S): Appends a timestamp to the archive name for uniqueness.borg prune: Removes old archives based on the specified rules.--prefix 'archive-name-': Targets only archives starting with the defined prefix.--keep-last 3: Deletes older archives, retaining only the last three.After running the commands, it’s wise to verify that your backups are created successfully. You can list all of your archives with:
borg list /path/to/your/repository
This command displays the names of all archives in your repository, allowing you to confirm that your most recent backups are available.
By following the steps outlined above, you can effectively create and manage backups using BorgBackup while maintaining a cycle of the last three archives. This method not only conserves storage space but also ensures that you retain recent backups for quick recovery. For additional details or advanced configurations, you may refer to the comprehensive BorgBackup documentation, which provides insights into its capabilities and options.
Feel free to ask if you have any specific questions or need further assistance!