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 with00
(0x00 % 10 = 0
) and14
(0x14 % 10 == 0
) but notff
(0xff % 10 == 5
)--read-data-subset 2/23
will e.g. read the files starting with2f
(0x2f % 23 = 1
), but not10
(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