Restic check --read-data VS btrfs scrub

Hello everyone,

I was wondering about the difference between restic check --read-data compared to btrfs scrub

btrfs scrub for my understanding compares written files on disk with the metadata saved for this file (or blocks in btrfs terms)

or from the docs:

Scrub is a pass over all filesystem data and metadata and verifying the checksums. If a valid copy is available (replicated block group profiles) then the damaged one is repaired. All copies of the replicated profiles are validated.

restic check --read-data somehow is doing the same thing, reading files to check for integrity.

Both would detect data corruption, where as the first one is propably faster, as it is on fs layer.

The question is, can I savely skip restic check --read-data in favour of btrfs scrub (with I do anyway)?

Cheers

Not really. Scrub checks if everything on disk is still in the same state since it’s written there. Restic’s check ensures the data is consistent by (afaik) decrypting the data and reading it (with --read-data switch). So if anything went wrong saving the initial file by any means (let it disk-sync issue, a bug or whatever on any layer), you might get a file which is not matching its hash in terms of restic (which can be caught by restic check --read-data). But in the eyes of btrfs everything will be fine, since that file was saved like that and didn’t change.

1 Like

well, of course that makes sense. thanks @gurkan

better be safe and do btrfs scrubs and restic checks from time to time :slight_smile:

1 Like