Skip to content

Diagnostic command to display what snapshots a blob/tree belongs to #1777

@McKael

Description

@McKael

This is not a bug report but a feature proposal.

A few times, I've been missing a command to list the snapshots that contain a specific tree or blob, or the snapshots affected by a corrupted pack.

I'd like to be able to use a restic command for this case (AFAIK it does not exist yet) and I've written some POC code.
I can do a PR to discuss this further if this suggestion sounds reasonable to you.

Here's a practical example.

% restic check
repository a04959d0 opened successfully, password is correct
create exclusive lock for repository
load indexes
check all packs
check snapshots, trees and blobs
(...)
error for tree e437ff75:
  tree e437ff75: file "checks.db": metadata size (122171392) and sum of blob sizes (122175488) do not match
Fatal: repository contains errors

Let's check what this tree actually is and which snapshot is affected.

% restic what-contains tree e437ff75
repository a04959d0 opened successfully, password is correct
Found tree e437ff75
 ... path /mikael/check-data
 ... in snapshot f120bfbf

Here's another example with a random blob in one of my repositories:

% restic what-contains blob 9dcf5f6a254fb58c8b2a7e604dc76b71fbad847f6ade751513968cf2f1f161fc
repository a04959d0 opened successfully, password is correct
Blob found in pack cf8a3fa3b2c9c7a08b6b6fc6cce9fdc2eeb4dd26ebd2d67b081d63f24dd408d8
 ... Pack cf8a3fa3: <Blob (data) 9dcf5f6a, offset 2486760, length 12214>
Found blob 9dcf5f6a254fb58c8b2a7e604dc76b71fbad847f6ade751513968cf2f1f161fc
 ... in file 1398431273.H215567P22415.mail.example.com:2,
 ... in snapshot 067f149f
Found blob 9dcf5f6a254fb58c8b2a7e604dc76b71fbad847f6ade751513968cf2f1f161fc
 ... in file 1398431273.H215567P22415.mail.example.com:2,
 ... in snapshot 0a781e61
Found blob 9dcf5f6a254fb58c8b2a7e604dc76b71fbad847f6ade751513968cf2f1f161fc
 ... in file 1398431273.H215567P22415.mail.example.com:2,
 ... in snapshot 15ab2468
(...)

I'd also like to be able to do

% restic what-contains pack cf8a3fa3

but I haven't had a look at it yet.

Please let me know if it would be useful to other people than me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions