Sync a b2 restic repo to local server

Hi there,
I’ve got a restic repo with a Backblaze B2 backend which is working great.
I’m trying to add some additional redundancy to my backups by using rclone to sync a copy of the b2 repo files to a local machine (a Ubuntu VM on my Synology DS918).

When I bring the repo down to the ubuntu machine and attempt to view snapshots locally I get some errors related to locks.

Running
restic -r my-local-repo-clone/ snapshots

I get the following errors:
List(lock) returned error, retrying after 261.633025ms: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 838.51631ms: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 1.239336443s: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 1.000982791s: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 2.341778698s: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 5.398713586s: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 2.93423344s: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 6.903761588s: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 13.531699771s: lstat ovh3-mic/locks: no such file or directory
List(lock) returned error, retrying after 28.50208236s: lstat ovh3-mic/locks: no such file or directory
Fatal: unable to create lock in backend: lstat ovh3-mic/locks: no such file or directory

When I access the remote repo on b2 directly from the local machine everything works as expected.

e.g.
restic -r b2:remotebucketname snapshots returns no lock errors so the remote repo itself is fine.

I end up having to resort to using --no-lock and key commands to restore files locally which I’d rather avoid.

Am I going about this the wrong way?

I’d like to have an automatic process to sync the restic repo locally and then restore some files from the repo on my local Ubuntu VM and run some tests via a bash script to confirm the integrity of the data in the repo.

I think you’re just missing an empty lock folder here. Just create a locks folder in the local repository copy. Depending on how you’re syncing the repository empty folders may be skipped.

1 Like

Unrelated to your problem: Having 2 identical copies of a repository isn’t a bad thing but ideally you would want to have 2 separate repositories. If some files in your original repository (B2 in this case) somehow are damaged, you copy them to your 2nd repository which might result in 2 useless repositories.

It’s simpler than that: object storage systems like S3 and B2 don’t even have a notion of folders, so there is no such thing as an “empty folder” in these systems. :slight_smile: