BorgBackup: Clone a Repository
These instructions are based on BorgBackup version 1.1.11. For other versions, please consult the official documentation.
While I was looking to increase my backup redundancy, the solution I decided on was to implement BorgBackup repositories on two separate machines. I would then backup to both of the repositories from the client-side machine.
To expedite the setup, I decided to first start with a single repository and get the initial backup completed. Once completed, I would simply clone the repository to the second machine, and point the client to both machines moving forward.
The Issue
What I didn’t plan for was the client-side machine failing when trying to backup to cloned repositories.
Cache, or information obtained from the security directory is newer than repository - this is either an attack or unsafe
As it turns out, BorgBackup creates a unique ID for each repository, and uses that client-side to keep track of previous backups. When the client-side machine contacts multiple repositories with the same ID, it panics.
The Fix
The fix is very simple: you need to change the repository ID for one of the cloned repositories so that BorgBackup views each one as unique:
Pick which repository you want to change the ID for (if you have two clones, then only one will need to be changed)
Locate the repository directory
Edit the
configfile within the repository directoryWhen inside of the
configfile, locate the line that begins withid =Change the hex value that follows to a unique value not used by other repositories
If the previous steps were made before you received the error message posted above, you’re all set. If not, then you will need to delete the cache client-side for the repository before moving forward.
Run the following command to pull information on the repository that’s giving you issues, replacing
[REPOSITORY_OR_ARCHIVE]with the appropriate information:borg info [REPOSITORY_OR_ARCHIVE]The result will list information about the repository, including a line that starts with Repository ID:. Copy the string that follows.
Locate BorgBackup’s cache directory. It’s normally located under the home folder. For example, if your home folder is
/home/jane, then the cache folder can be found at/home/jane/.cache/borgWithin there are directories named after the repositories’ IDs. Find the one that matches the ID found in step two and rename it (I added the suffix “.bak” onto mine in case I wanted to revert back)
Locate BorgBackup’s security directory. Like the cache directory, it’s also normally located under the home folder. For example, if your home folder is
/home/jane, then the cache folder can be found at/home/jane/.config/borg/securityWithin there are also directories named after the repositories’ IDs. Find the one that matches the ID found in step two and rename it (I added the suffix “.bak” onto mine in case I wanted to revert back)
If done correctly, you should now be able to backup to two separate cloned repositories from the same client-side machine.