First of all, it’s just my test repo. So I don’t care about it. Just testing what happens if something will go wrong.
So I’ve just performed a few
restic backup operations to new repo. Then I’ve started deleting of various files inside repo (to simulate certain disk/fs failures).
keysdir because as far as I understand, they are pretty small and usually immutable. So it’s possible to keep a few more copies of them in safe place.
Removed one file in
restic checknow prints tons of errors about pack files that
pack XXX: not referenced in any index. Running
restic rebuild-indexfixes everything. So all data is safe.
Removed one file in
snapshotsdir. Unfortunately such repo passes
restic checkand even
restic check --read-datawithout any errors . Just one particular snapshot disappeared from
restic snapshots. Probably it’s no longer possible to recover data from this snapshot. And even worse, if
restic pruneis called periodically (I’ve
restic check && restic prunecron job for this), unique data from this snapshot will be purged from repo…
Removed one file from
restic checknow fails. And this is very good. It’s also possible to partially restore snapshot.
restic restoreprints error message for every file that it’s unable to restore.
Instead of removing, I’ve just modified one of files in
data(without changing file size).
restic checkshows no errors. At the same time
restic check --check-datafails. Which is good.
will remove 1 invalid filesbut returns
0exit code. At the same time
restic checkafter prune fails. So my
check && prunecron job will fail next time. Maybe it’s better to use
check && prune && checkinstead.
I really don’t like what happens with
snapshots dir. If repository location is not 100% trusted, then it’s better to backup snapshot files somewhere… I think that
restic should handle this somehow. Maybe keep encrypted snapshot list somewhere else.
Btw is it any way to recover repository with corrupted file in
data dir? I know that it might be possible to just
restic backup same location again and if files were not changed on disk, restic will same them again and “fix” previous snapshots.
But what happens if data was changed? Any way to just ‘fix’ repo (by removing all unrecoverable files) and pass
restic check --read-data?