Running unlock --remove-all before pruning

Yes, this is a bad practice and can lead to repository corruption.

If backups are running most of the time then the odds of running prune concurrently with a backup are near 100%. Here’s what is likely to happen:

  • A backup process uploads a pack file.
  • Prune starts and loads the snapshot list.
  • Prune notices there is no snapshot that refers to any data in that pack file, concludes that it is unused, and deletes it.
  • The backup process finishes and add the snapshot to the repository, which now depends on data that is missing.

If you have been doing this a long time, a simple restic check should highlight dozens of missing repository objects, and many snapshots probably cannot be restored anymore.

1 Like