Packs from interrupted backup reusable after rebuild-index?

First backup to a newly created (inited) repo was interrupted due to loss of USB-connection to the drive that contains the repo.

As a consequence “check --read-data” reported many unreferenced packs:

pack c02ca582: not referenced in any index
1327 additional files were found in the repo, which likely contain duplicate data.
You can run restic prune to correct this.
check snapshots, trees and blobs
read all data

By now the repo does not know of any snapshot (as expected)

Are the following steps valid in order to use the existing packs when trying another backup-run?

  1. rebuild-index
  2. rerun backup (on meanwhile extended data)

Do you see any risk (or certainity :wink: ) to run into issues when doing so?

No need to rebuild the index, just rerun the backup. Unused packs are automatically picked up on subsequent backups.

Thanks for the quick answer.

I’ve already rebuilt the index. I guess this causes no harm for the rerun, right?

Correct. Running an index rebuild on a known-good repo won’t do any harm.

additional files are different from unused packs, in that they are not contained in the index. And therefore these packs won’t be picked up by later backup runs. A prune run, however, will clean up these leftovers. rebuild-index will add these packs to the regenerated index, so that later backup runs can use these packs.

As rebuild-index checks the header of pack files before it adds them to the index again, this should be rather safe. You still might want to run restic check --read-data once (when the snapshot is completed), to let restic check that none of the pack files is missing a chunk of data. It’s not really possible to tell whether all packs were written to disk completely.

1 Like

Oh, thanks for the correction. Apologies for sowing disinformation :slight_smile:

Thanks for your comments.

So prior rebuild-index was a good idea and is necessary to save writing data again, right?

I did a restic check --read-data before and after rebuilding the index. So I guess all packs should be complete, right? (Otherwise I would have expected errors. not sure whether on both checks or only after rebuild-index? In other words: Does ‘check --read-data’ check additional files or only packs that are referenced in index?)

Anyway to be safe I’ll run another restic check --read-data after rerunning the backup.

P. S. restic is a really cool tool with amazing support in this forum!

Yes the index rebuild was necessary to avoid storing the files twice.

Just looked it up: --read-data only checks packs that are contained in an index. So the check run after rebuilding the index should already have verified these packs and it sounds like they are intact.

Thanks for all the information :slight_smile:

1 Like