Still not referenced index after "rebuild-index"

Hi,

I ran an online backup from my home computer to a VPS overnight and towards the end the connection broke up because of the 24h-kick.
I rerun restic with the same command:

restic -r sftp:user@backup.funny-url.tld:/home/user/backup backup /path/2/the/Files

and it seems that everything went fine…

But then I tested the repository with the Command

restic -r sftp:user@backup.funny-url.tld:/home/user/backup check

and I saw a lot of not referenced indexes, so I run:

restic -r sftp:user@backup.funny-url.tld:/home/user/backup rebuild-index

and this deleted 69 old indexes.

After I run the check command again, there were still some not referenced indexes.

I run the check command again and now there are still some not referenced indexes.

restic-Version:

$ restic version
restic 0.7.3 (v0.7.3-221-g526aaca6)
compiled with go1.9.2 on linux/amd64

Any Ideas?

Can you upgrade to the most recent version (0.8.3.) and try again? There have been a lot of bugfixes and improvements since the release of 0.7.3.

ok, I updated to:

$ restic version
restic 0.8.3 (v0.8.3-141-g4b2d3b1) compiled with go1.10.1 on linux/amd64

and run:

$ restic -r sftp:user@backup.funny-url.tld:/home/user/backup rebuild-index
enter password for repository:
password is correct
counting files in repo
[11:03] 100.00%  32493 / 32493 packs
finding old index files
saved new indexes as [3cfbadc7 b6cea005 521f82b9 687b8988 72ff54f7 5475b1e1 293421c6 e288c115 19970255 1f6f30a3 7b2de705]
remove 11 old index files

and check again:

$ restic -r sftp:user@backup.funny-url.tld:/home/user/backup
enter password for repository:
password is correct
create exclusive lock for repository
load indexes
check all packs
pack dbe76c7480d5ab6244f63d451a58ee611bdbd291b1fe8a7c1a2342256b2ef30a: not referenced in any index
pack 31aff9a78cc4479303099e60242448268c47c63ba0aad8bc7ec25171fabd8480: not referenced in any index
pack c213d977b0a0ca78983781a68ba0718c5f9d4adf3e96818d44c7dca75d116096: not referenced in any index
pack 12f8e3f2cb510c63a17768ff286d41924489aece02bbf852f002b99a0086bb6c: not referenced in any index
pack c0dc9048a7d30b25cb6f8ebefd8b577b7811ed38ec0ccff6ee387020d09c9dad: not referenced in any index
pack 286af7c1795b6bea5d9bb9441632de51ad459896c697242f28add361e13ee031: not referenced in any index
pack c4a6b5404501271824e17509ab419a78732fd2cc70ff26acf4f5d1ff34b1ea3c: not referenced in any index
pack 5da3e79eee3b089f54491850cd0fa60e5ef3bce9bd8255bd2e1928daf521e532: not referenced in any index
pack e1b189c438127106d95324740329c4baa60f18d26651c8a4c330d2ebbc951c19: not referenced in any index
pack 0eb156bd753bcd4a123de7caa041c85201346e2d404312c061e27fe421a4acf4: not referenced in any index
pack aa83e6e1f276a00678e9a6263f0218ca3ef3330cc56decc96d3ed872cae9825c: not referenced in any index
pack 157dad5b5e011d7e324813ece977bff03b68ed1648a92fe99ea90c659b486840: not referenced in any index
pack 171ef48444e112b74a9f07473d25c26f5e88c46ea813b68d3569383d9096bf32: not referenced in any index
pack 708bf654927b4a21b500dcd3016a725967f239bd07ecc8434bc6ee6e6824de25: not referenced in any index
pack 6ec187e13a6d7e6563d71e6dd29f50aa8bc88e7c3f46a3731036c1ea91b82cd9: not referenced in any index
pack 6a6c973793e31b0cafa7dc93d9059a022f7e5d3cad029859b49fc8cf450ac507: not referenced in any index
pack bb66a7bc7862c77489b61ad8e9e6cf2fc57b0a1a9c8d860bc7f39bea4feb43b4: not referenced in any index
pack 9812c5dc6b8ddd3b2ca2944ee1822eeee0d01247b338c3fa38848c1d994aa7e9: not referenced in any index
pack eb9d79f48c503cd066de34d1657e104b5b9fa9ec09ca7c1124331d46a0a8b480: not referenced in any index
pack be301bb027953bbf46c0164338eda422b909006c88ce5f9b807e4d66b5aa5ce4: not referenced in any index
...
check snapshots, trees and blobs
Fatal: repository contains errors

another idea?

restic prune should clean this up. See the FAQ for details.

Hm, while the FAQ answers this particular question, I think in this case it’s rather accidental. I think I know what’s going on:

  • During the first backup, the upload process for several files was running, the upload got cancelled when the Internet uplink broke
  • Then restic rebuild-index was run, but it will only add complete, valid files to the index. The files in question aren’t valid, they were truncated during upload, so the command ignores them
  • restic check only looks at the file names (not the contents) and sees that the files are not contained in any index (because they aren’t valid)

If this is the case, running restic prune will clear this up and remove the invalid files. It’ll also print the names of all invalid files it encounters, so you can check if the names match.

Afterwards, restic check should not complain any more.

Can you please test running restic prune and report back? Thanks!

1 Like

the prune command worked…

$ restic -r sftp:user@backup.funny-url.tld:/home/user/backup prune
enter password for repository: 
password is correct
counting files in repo
building new index for repo
[10:09] 100.00%  32493 / 32493 packs
incomplete pack file (will be removed): 7ef0f53aa03cfd724ca2062301ff5d5c65b660cd8f3d1922d111ff718ec8ec2a
incomplete pack file (will be removed): a9728a96e6ade6c02ecb8762e78327882f26b7cc7da219d57f1cecbca6f70be9
incomplete pack file (will be removed): 1f3ada7fe0e6ad63bbb943eb0cdf3b011ba79efde027ef0848da1240078a86bf
incomplete pack file (will be removed): 
...
incomplete pack file (will be removed): 9b19c1c767ccf00d7664c741990c7cf252436565588c7a65c0f8025f2dcf2f3b
incomplete pack file (will be removed): e1b189c438127106d95324740329c4baa60f18d26651c8a4c330d2ebbc951c19
repository contains 32436 packs (133700 blobs) with 155.345 GiB
processed 133700 blobs: 2872 duplicate blobs, 3.557 GiB duplicate
load all snapshots
find data that is still in use for 1 snapshots
[0:04] 100.00%  1 / 1 snapshots
found 130814 of 133700 data blobs still in use, removing 2886 blobs
will remove 57 invalid files
will delete 57 packs and rewrite 1486 packs, this frees 3.557 GiB
[3:37:57] 100.00%  1486 / 1486 packs rewritten
counting files in repo
[10:12] 100.00%  31704 / 31704 packs
finding old index files
saved new indexes as [51e43a16 97cc1d87 c1fd250a e5b80659 497c0bf4 db25216d b6497c68 d2d8c0f5 7e29253c cfa62379 b5067659]
remove 11 old index files
[1:03] 100.00%  1543 / 1543 packs deleted
done

then I checked again:

$ restic -r sftp:user@backup.funny-url.tld:/home/user/backup check
enter password for repository: 
password is correct
create exclusive lock for repository
load indexes
check all packs
check snapshots, trees and blobs
no errors were found

typical case of RTFM :grin:

Maybe you should rename the “FAQ” Section to “FAQ/Troubleshooting” :wink:

Thanks for your help!

Case closed

1 Like