Repairing Repositories
I get a ‘Data integrity error’ when accessing a repository
Section titled “I get a ‘Data integrity error’ when accessing a repository”Borg 1.2.6 shipped with improved archive verification and may throw this error when created with older Borg versions. Full details in the release logs or this Github issue.
If you trust the remote repository, at a minimum you will need to run the below command:
$ BORG_WORKAROUNDS=ignore_invalid_archive_tam borg upgrade --archives-tam $REPO_URLAfter this all archives will be verified and you will no longer see this error.
Repair Damaged Repositories
Section titled “Repair Damaged Repositories”There are rare situations, where Borg repositories can be damaged by e.g. interrupted backups, incomplete migrations, hardware failures or other factors. Symptoms include:
Object with key XXX not found in repositoryCache is newer than repository - do you have multiple, independently updated repos with same ID?
Borg is generally good at fixing those issues and missing data will be added during the next backup run.
Missing Data Segments
Section titled “Missing Data Segments”To fix errors related to missing data or files:
- First run
borg check $REPO_URL. This will first check the repository files and then one or more archives. - If the first step reveals errors, you should make a local repo copy, unless the data is non-critical.
- Next run
borg check --repair $REPO_URLto ask Borg to fix any errors. - Finally run
borg create ...to do a full backup run and add potentially missing data.
Cache Issues
Section titled “Cache Issues”To fix errors related to the cache (from here):
- First try to delete the local cache
borg delete --cache-only $REPO_URL - If the first step doesn’t resolve the issue, try moving the security folder in
~/.config/borg/security/$REPO_ID. Where theREPO_IDcan be found usingborg config $REPO_URL id - Run a repo check with
borg check $REPO_URL.