kimono-koans / httm

Interactive, file-level Time Machine-like tool for ZFS/btrfs/nilfs2 (and even Time Machine and Restic backups!)
https://crates.io/crates/httm
Mozilla Public License 2.0
1.31k stars 28 forks source link

How to restore a file from a ZFS snapshot interactively using httm browser? #105

Closed danboid closed 4 months ago

danboid commented 4 months ago

The httm README doesn't tell me how to do what I'd like to do with httm. I'm not sure it can do what I want yet so maybe you could explain to me how to do the following with httm and then, if it is possible, we could add these instructions to the httm README?

The scenario is this. My user has a ZFS dataset home dir and I have multiple files with several snapshots for files in the home dir. I would like to use httm browser mode to select one of these files and then either revert the file in place to a chosen previous snapshot or be able to easily restore a previous version of a file into another directory, all from within the httm TUI browser.

Can either of these be done? If so, how? I've worked out the first step which would be running:

httm -b ~

Then it seems all I can get httm to do is print out snapshot details for files to the console.

Does httm support interactive file snapshot restoration in the way I describe?

kimono-koans commented 4 months ago

The httm README doesn't tell me how to do what I'd like to do with httm

Are you sure?

I fairly certain the initial asciiema video covers this exact use case.

And that this is covered in the Example Usage section of the README:

Browse all files in your home directory, recursively, and view unique versions on local snapshots, to select and ultimately restore, in overwrite mode:

➜ httm -r=overwrite -R ~

But I believe it is also covered in the help, see httm --help, (and the man page for that matter) under --restore:

-r, --restore[=<RESTORE>...]
            interactive browse and search a specified directory to display unique file versions.
            Continue to another dialog to select a snapshot version to restore.  This argument
            optionally takes a value.  Default behavior/value is a non-destructive "copy" to the
            current working directory with a new name, so as not to overwrite any "live" file
            version.  However, the user may specify "overwrite" (or "yolo") to restore to the same
            file location.  Note, "overwrite" can be a DESTRUCTIVE operation.  Overwrite mode will
            attempt to preserve attributes, like the permissions/mode, timestamps, xattrs and
            ownership of the selected snapshot file version (this is and will likely remain a UNIX
            only feature).  In order to preserve such attributes in "copy" mode, specify the
            "copy-and-preserve" value.  User may also specify "guard".  Guard mode has the same
            semantics as "overwrite" but will attempt to take a precautionary snapshot before any
            overwrite action occurs.  Note: Guard mode is a ZFS only option.  User may also set via
            the HTTM_RESTORE_MODE environment variable. [possible values: copy, copy-and-preserve,
            overwrite, yolo, guard]