New verify-randomly command in restic-runner

Good question, the code is here

The idea is: For each data file in the repo, take the first byte of the ID (the first two chars of the file name), compute the remainder and compare it. So, for --read-data-subset k/n and the first byte C of the file name, the file is read and checked iff C % n == k-1. Examples:

  • --read-data-subset 1/10 will e.g. read the files starting with 00 (0x00 % 10 = 0) and 14 (0x14 % 10 == 0) but not ff (0xff % 10 == 5)
  • --read-data-subset 2/23 will e.g. read the files starting with 2f (0x2f % 23 = 1), but not 10 (0x10 % 23 == 16)

It’s possible to implement this within restic, but you can also do that with shell (mind the +1):

$ restic check --read-data --read-data-subset $(($RANDOM % 10 + 1))/10
1 Like