Recreate identical repo

Lets say I have a repo which I copy on some cloud storage (e.g. because it is not supported by restic/rclone, not the topic).
Now my disk on which I store the repo on locally fails.
Can I recreate the repo from the data I have (locally on another disk, plus some additional new data) so that it is identical to the old repo (same chunks)?
The idea is that it will sync nicely with the cloud storage and I don’t have to upload everything again.

I know about the --copy-chunker-params flag but that is not applicable in this case because I cannot access the second repo with restic.
Is it possible to hand the config file to restic init instead?
Or is there another way to create the new repo with identical data chunks?

No, this is not possible. It is not only about chunking, but also about the encryption. When any data is newly encrypted, is uses a new random nonce and hence even if the unencrypted data is identical, the encrypted one isn’t.

So, either you copy the whole repo from your cloud storage or you redo your backup from scratch.

If you could access and write to your cloud storage with restic, then I would propose that you initialize your local repo with identical chunking parameter and then use restic copy to sync your local copy to the cloud storage. This would only copy contents that are not yet contained in the cloud storage.

This is possible. If you only copy the config file and the keys directory to some local storage, you get an empty repository with the same passwort, encryption key and chunker setting.
You can then use this repo to copy the chunker parameters from.

So in this case the chunks will be the same as the original repo and the sync should work?
Or will they again be different because of the random nonce?

So can I not directly just use this repo then?

The chunks are the same. So if you sync with restic copy which uses the chunks, this works. However, the files saved under /data are not the same, as they are encrypted. So if you sync on a file-based level, it doesn’t work (more precisely, the sync will remove all of your old repo copy all of the new repo).

1 Like

Ok got it. Too bad, will have to look for another solution then. Thanks a lot for the great explanation.

I know this is not the indented use case. But is it possible / likely that there will be an option to set the nonce to be deterministic (like the --aessiv flag for gocryptfs)?

@ozboss Just out of curiosity: Why aren’t you able to access your cloud storage with restic?

It’s unlikely we’ll add such a flag. It changes a fundamental issue in the crypto which we likely won’t touch. Sorry about that.