Backing up to multiple (different) instances of a repository (same ID)

restic supports backing up multiple sources to one repository, but does it also work the other way around: Backing up one source to multiple repositories with the same repo ID (that do not get synced and whose contents differ)?

I have two external hard drives I use for backups. They are not at the same place at the same time, so I am not able to sync the data between them. Each of them contains snapshots from different points in time.

I plan to initalize a restic repository, copy it to each of the hard drives and back up my data to them as described. They will have the same repo ID, but the snapshots will be different.

I have done some testing without running into problems. Are there any problems to be expected?

Restic repositories can be moved from one place to another. So you can create the repository on disk A, sync disk A to disk B and then start making snapshots. I don’t really know if you could be running into problems. I don’t think so but you can also create one repository for disk A and another for disk B using the same password.

1 Like

My only concern with having two repositories with different content and the same ID is that caching might cause unexpected problems, but I admittedly don’t know much about how the cache works (e.g. if it’s based on the repository ID, or the URI). If you run into problems with the cache, you could always disable it.

1 Like

As @cdhowie already pointed out: restic selects the cache directory based on the repository ID (~/.cache/restic/<ID>), so if you have two effectively different repos with the same ID, the cache would be useless and restic will always purge the cache and re-download it when switching between the two repos.

I’d initialize two different repos on the harddrives, with different IDs.


Thanks for replying!

I’ve found one good reason to have two instances of same repository.

If repositories are with same ID (uses exactly same encryption key), you can more easily recover one repo using blobs from another. But again, this applies only if you’re backing up mostly same content. And it’s very error prone.

That’s… clever :sunglasses: