Changing a repository id

I started my repository ‘copy’ clone(s) from an rsync between my 2 NAS devices.
This works but I read in another forum post that the downside of having identical repository ids is that your cache will get wiped every time you talk to these separate repositories.
So I was wondering how I could change the repository id on my cloned repositories?
I didn’t seem to find any information about this on this forum and in the docs.

Hi @fwdIT and welcome to the restic community! :slight_smile:

Thanks for checking the documentation prior to your post. Information regarding the repository can be found here https://restic.readthedocs.io/en/latest/100_references.html#repository-format.

So from my understanding: there is no tool or trivial way to alter the encrypted configuration to change the repository id.

A solution to your problem could be to define two different cache directories for the different repositories via the command line argument.

1 Like

Hi @moritzdietz thx! and also thanks for the feedback
The more I use restic, the more I hopefully also learn the inner workings but today it is a lot of information at once :slight_smile:
I was afraid changing it afterwards was probably going to be challenging if even possible.
Your suggestion was indeed a workaround I already had in mind since I am already using it under certain conditions where the filesystem of the default user .cache folder is too small. So I now have another reason to make work of a wrapper script for all this common & repeated logic towards my diff repo targets.

Yep :slight_smile: That sounds like a solid plan. Hope you got an answer to your question now.

Indeed, thx!

I’ve rebased my hack to change the repository id or to recreate a lost config file (some parameters are still lost, but reading should be possible) GitHub - MichaelEischer/restic at change-repo-id .

To use that branch one has to build it using go build -tags debug ./cmd/restic and then run restic debug changeID i-understand-that-this-could-break-my-repository-and-i-have-created-a-backup-of-the-config-file placeholderID and finally replace the placeholderID with the ID printed in the resulting error message. That code is pretty experimental, but as it at most modifies the config file, it should be enough to just create a backup copy of that file.

1 Like

In the end I decided to recreate all repositories on the second NAS
Would not be the best path to start my new backup strategy with workarounds although my wrapper script has been created and would be able to solve the possible cache folder issue.

Extra reason I decided to redo some parts of the setup was due to reading this:
https://restic.readthedocs.io/en/latest/045_working_with_repos.html#ensuring-deduplication-for-copied-snapshots
and more specifically using ‘–copy-chunker-params’

Of course for my rsynced repositories that was already covered but aside of my 2 NAS devices I also made a 3rd gdrive rclone (I did also read the talks about using gdrive but that aside). I suspect this is the chunker_polynomial in the config file and that was different on my gdrive created repositories before I read about ‘–copy-chunker-params’. So decided to redo NAS 2 and gdrive.

What I don’t really understand yet while having read some data here and there is how the chunker params gets decided. I used the same restic version (the latest) for all my actions so if it would be a static default value, I would have expected it to be the same on gdrive. In any case, while redoing the init with ‘–copy-chunker-params’ the chunker_polynomial is now identical on my 2 NAS devices and gdrive and I now have unique repo IDs for all my repositories over all repo locations.

The chunker parameters are randomly selected when initializing a repository.

Ah ok, thanks for the feedback @MichaelEischer

Love it :smiley: