How can I find out which file the entry .../data/XY/XYabc... belongs to?

I have HW problems with my HDD holding my repository.
I found 4 files being unable to read with a pattern of <repos>/data/XY/XYabc…
How can I find which backed up file belongs to this problematic files.

To attempt such forensics I would start with some ways described here:

Especially useful can be restic cat which allows you to inspect config|index|snapshot|key|masterkey|lock|pack|blob|tree object.

You most likely have to become familiar with detailed repo format before:

Have a look also at - Recover from broken pack file · Issue #828 · restic/restic · GitHub

There is restic debug examine command nowadays

I would attempt to repair repository using available restic tools and if not possible then start everything from the scratch. Using corrupted repo can have unpredictable results later.

You can try to use restic find --pack XYabc.... That should print all affected files (or fail with an error).

@kapitainsky thanks for your replay.

Meanwhile I found that my HDD is more defect and is dying more and more.
I was able to determine this with the help of ddrescue.
I got a new SSD and immediately did my initial backups.
They took longer as normal as expected.

I will read the documents mentioned in your answer in the next days to learn more.
By the way, my restic doesn’t understand “debug examine”. (restic 0.16.2 compiled with go1.19.9 on linux/amd64 from openSUSE/Leap155) Is there a newer version? where?


debug examine is only available in debug builds of restic. It is mostly intended as a tool to investigate the exact damages to pack files, but without further guidance it’s not particularly useful.

In your case the problem cause is pretty clear, thus it’s probably easier to just remove the broken pack files and follow the official troubleshooting guide. That will cause the damaged data to get removed from the repository, but will keep all data that is still intact. The repair snapshots command will also print the filenames of damaged files while repairing the snapshots.