Skip to content

Restic Prune: hash of data does not match ID #816

@tscs37

Description

@tscs37

Output of restic version

restic 0.4.0 (v0.4.0-4-gf5faff9)
compiled with go1.7.5 on linux/amd64

Expected behavior

Prune should finish without error, removing no longer needed data.

Actual behavior

Prune exits with an error after outputting the following:

sh-4.4$ restic prune
counting files in repo
building new index for repo
[0:00] 100.00%  10416 / 10416 packs
repository contains 10416 packs (996541 blobs) with 47.294 GiB bytes
processed 996541 blobs: 245842 duplicate blobs, 5.010 GiB duplicate
load all snapshots
find data that is still in use for 16 snapshots
[2:21] 100.00%  16 / 16 snapshots
found 708745 of 996541 data blobs still in use, removing 287796 blobs
will delete 71 packs and rewrite 1579 packs, this frees 1.307 GiB
hash does not match id: want 82d72a908f79ae0198fc726521708fce7e8d5e46113e5b7ae8d0147a0439b26a, got 850235a19757eb3e136160816bd5e8a18779a87ea01aa4ce42015575803a084d
restic/repository.Repack
	/tmp/restic-build-015264043/src/restic/repository/repack.go:50
main.runPrune
	/tmp/restic-build-015264043/src/cmds/restic/cmd_prune.go:216
main.glob..func11
	/tmp/restic-build-015264043/src/cmds/restic/cmd_prune.go:26
github.com/spf13/cobra.(*Command).execute
	/tmp/restic-build-015264043/src/github.com/spf13/cobra/command.go:599
github.com/spf13/cobra.(*Command).ExecuteC
	/tmp/restic-build-015264043/src/github.com/spf13/cobra/command.go:689
github.com/spf13/cobra.(*Command).Execute
	/tmp/restic-build-015264043/src/github.com/spf13/cobra/command.go:648
main.main
	/tmp/restic-build-015264043/src/cmds/restic/main.go:37
runtime.main
	/usr/lib/go/src/runtime/proc.go:183
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:2086

Using sha256sum I can confirm that the hash is indeed different:

sh-4.4$ restic cat pack 82d72a908f79ae0198fc726521708fce7e8d5e46113e5b7ae8d0147a0439b26a | sha256sum 
Warning: hash of data does not match ID, want
  82d72a908f79ae0198fc726521708fce7e8d5e46113e5b7ae8d0147a0439b26a
got:
  850235a19757eb3e136160816bd5e8a18779a87ea01aa4ce42015575803a084d
850235a19757eb3e136160816bd5e8a18779a87ea01aa4ce42015575803a084d  -

Steps to reproduce the behavior

I suspect this to be caused by bitrot.

  1. Create Repository
  2. Create backups
  3. Let backups sit for a while
  4. Run restic prune

The problem is that this prevents prune from running correctly which means I use additional, unnecessary memory.

Is there any reliable way to remove or recover the offending pack from the repository?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions