List of lock rules in documentation

I’ve tried to find how restic locks the repo for different commands (which commands require an exclusive lock, non-exclusive and none) so I can better plan my cron jobs.

It would be very useful if a reference table like this was added to the documentation.


1 Like

I agree. Here is a table detailing which commands take which type of lock.

Shared locks allow any number of other shared locks to exist at the same time, and these commands typically only read or add data.

Only one exclusive lock can exist at any time, and it must be the only lock. These commands typically delete information from the repository, or otherwise require it to not change at all while they work.

tl;dr: Shared allows other shared stuff to run. Exclusive doesn’t allow anything else to run.

Command Lock type
backup Shared
cat Shared
check Exclusive
diff Shared
dump Shared
find Shared
forget Exclusive
key list Shared
key add Shared
key remove Exclusive
key passwd Exclusive
list Shared
migrate Exclusive
mount Shared
prune Exclusive
rebuild-index Exclusive
recover Shared
restore Shared
snapshots Shared
stats Shared
tag Exclusive

Perfect thanks so much!