Mount without locking

Is there a particular reason for the mount command to no honour the --no-lock flag?

Let’s imagine the case where the remote repo is an archived on a read only partition. In this setup the repo is not feed any more and is only kept for legacy purposes.

If I try to mount it using something like:

restic --no-lock mount --password-file password --option "rclone.program=ssh -F sshconfig restic" --verbose --repo rclone: /tmp/backup

I end up with this error:

rclone: 2020/07/06 02:06:30 ERROR : locks/92adde40bd58ae5f9ecaee39430f01a581ccc0274b06dbc3fc817a1eb666e692: Post request rcat error: open /srv/restic/locks/92adde40bd58ae5f9ecaee39430f01a581ccc0274b06dbc3fc817a1eb666e692: read-only file system
Save(<lock/92adde40bd>) returned error, retrying after 720.254544ms: server response unexpected: 500 Internal Server Error (500)

I have done a patch to honour the --no-lock flag here: https://github.com/renard/restic/commit/1837fc4efd1e4372424509905148e1d5ae261a79. It works for my need but is there a reason for it to break anything?

If not I will send the PR.

Thanks in advance.

1 Like

Quoting from @fd0 on Github:

The --no-lock option is only for supported operations, like check . Any operation that may add data (such as backup ) does not support it, that’s not the way the repo was designed.

So since it is supported by the restore operation (https://github.com/restic/restic/blob/master/cmd/restic/cmd_restore.go#L104) it makes sense that mount also support it, doesn’t it?

1 Like

IMO you should just send the PR.
I would print out a message in case of the flag - but those things are better to be discussed within the PR communication.

Ok done: https://github.com/restic/restic/pull/2821

Thanks :slight_smile: