Restore a certain data block, no longer available due to hardware issues

Hello together,
this is my first post here, so forgive me any unknown mistakes I made.

I’m going first steps with restic so I saw several things but cannot connect them well.

My issue.
I’ve settled and driven a backup repo which I went to move to another place via rsync.
After some fiddling I got all files to the new place except this one:

btw: is this called a “package”?

It appears to be on a bad sector on the harddisk.

No I would like to restore the bad block from existing good data while keeping the backup history - at least most of it.

I tried

restic check
… doesn’ complain anything

restic check --read-data
… gets zombie process when trying to read the bad block.

restic find --pack b14a2103c1a67d410c2da56e3e952ba218205c4b3af997ad508dfeba43b227f0 -r /old/place/restic-Backup

It finished and showed (examples extracted)

Found blob d013c9aceacbdf475a6322d1e254f33291b7f46e87646fe6af930d958407e2fe
 ... in file /.config/QtProject.conf
     (tree 35704581da1d0ea9c1628f5ed755cfd880aaeea41d9335c15d35682342372b01)
 ... in snapshot ae412986 (2021-05-04 17:31:28)
Found blob 1b83e9c1adf1eff0c6c3d77e94fba918f15f8785da0b1ee672c094a7513562bb
 ... in file /.config/Trolltech.conf
     (tree 9a7c57e53c27c2ad7556c07b07c84016cb1df796398f618ae450f56d7966d297)
 ... in snapshot c35e8f9f (2021-02-27 17:43:40)

So my first idea to forget and prune the affected snapshot and this way to
force restic to get the missing data at the next backup run apparently won’t

rtfm hints on this are highly appreciated :o))

  1. ensure you use the newest restic version, i.e. 0.12.0
  2. restic check should complain about the missing pack file. If it is not, there is something strange going on.
  3. If restic check does complain, try to repair your repository by a) running restic rebuild-index followed by b) a restic backup run which contains the affected data. In your case this should include the dir .config and other files from your find command.
  4. Run another check to see if your repo is healed.

If this didn’t heal your repo, you have to remove snapshots or use some experimental PRs to modify your snapshots.

Thanks for Your help it did bring more light into the issue.

  • I did check for current version 0.12.0 via self-update
  • restic check complained about the missing package
  • restic rebuild-index reported about 15 deleted files
  • restic backup reported errors about not finding parts of 4 files and
    storing them again
  • new restic check throws errors like
error for tree 03fb38e2:pshots
  tree 03fb38e2: file "MP3Diags.dat" blob 6938e6d84540a82b0d505de77b3223902c1bb23588e8fac30532e5706066a42f not found in index
  tree 03fb38e2: file "Trolltech.conf" blob 1b83e9c1adf1eff0c6c3d77e94fba918f15f8785da0b1ee672c094a7513562bb not found in index

As both files exist, I assume the missing blobs are ancestors of those.

So my questions:
Can I use this repo for new backups “on top” and be shure the new snapshots are consistent?

How can I find the affected snapshots?

Will restic tell me anything while trying to restore a broken file, if I decided to keep the affected snapshots?

Thanks in advance for Your attention and answers.

Again: rtfm links highly appreciated :slight_smile:

Yes, if these files still existed within you last backup run, they have been changed compared to previous version(s) in older snapshots. Some of those previous versions are broken as the blob is missing.

New snapshots will be fine and work - if you are sure that your missing pack file was the only broken file. You can run check --read-data to read and check all pack files.

restic find --blob with the missing blob ids, e.g. 6938e6d84540a82b0d505de77b3223902c1b

I fear that restore will even abort with an error, but I’m not really sure about the error handling in restore.

It is best to really repair your repository. It is always a good idea to regularly run restic check on your repo and in its current stat, check will always complain. This will effectively prevent you from running automated regular checks…

So, if you have identified the affected and snapshots, there are two possibilities:

  1. the easiest way is to remove them by forget - if you can spare them
  2. there is an experimental PR which modifies “broken” snapshots (i.e. snapshots where blobs are missing, like yours), see
    Add repair command by aawsome · Pull Request #2876 · restic/restic · GitHub