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.33k stars 28 forks source link

Can't see multiple versions of files in interactive mode (BTRFS) #62

Closed bshor closed 1 year ago

bshor commented 1 year ago

I have BTRFS snapshots automatically generated by btrbk. I can manually go through the snapshots without a problem. The snapshots are stored in a subvolume called .snapshots under /data.

When I try to look at a sample directory (using httm -b -R) where I should have snapshots of older versions of the files I'm working on, I don't see those older versions at all. Clicking enter to select drops me out of the interactive mode and reprints the file name. Here are some screenshots to show you what I mean.

For example, arch_r.sh is a file I should have several versions of, but I only see the latest version.

image

Clicking enter drops me back to the Terminal.

image

Here's the file in two different snapshots to show you that I indeed have at least 2 versions of the file in snapshots.

image

kimono-koans commented 1 year ago

Would it be possible to include the output of httm --debug ~ , btrfs subvolume list -a -s /, btrfs subvolume list -a -s ~, and your mount command?

Thanks!

bshor commented 1 year ago

Sure. Attaching.

httm.txt btrfs_subvolumes.txt

Mount is:

sudo mount /dev/nvme0n1p2 /mnt -o subvol=/,subvolid=5

kimono-koans commented 1 year ago

I'm sorry I should have been more specific:

httm prints --debug output to stderr, could you include that?

By mount output, I mean can you give me the output of just the bare mount command?

Thanks!

bshor commented 1 year ago

Got it. Here they are.

httm_debug.txt mount.txt

kimono-koans commented 1 year ago
  1. Are you running with sudo? Note that btrfs snapshots are privileged by default. See: https://github.com/kimono-koans/httm#example-usage

  2. Tell me about your snapshots -- are they located in the directories that your --debug output indicates, or is httm missing something about the btrbk folder structure? FYI, it seems like you're using two snapshot systems. Your root ("/") snapshots look like they are Snapper-made.

map_of_snaps: MapOfSnaps {
            inner: {
                "/": [
                    "/.snapshots/198/snapshot",
                    "/.snapshots/201/snapshot",
                    "/.snapshots/203/snapshot",
                    "/.snapshots/200/snapshot",
                    "/.snapshots/204/snapshot",
                    "/.snapshots/199/snapshot",
                    "/.snapshots/202/snapshot",
                    "/.snapshots/197/snapshot",
                    "/.snapshots/196/snapshot",
                    "/.snapshots/195/snapshot",
                ],
                "/data": [
                    "/data/.snapshots/data.20230103T0102/snapshot",
                    "/data/.snapshots/data.20230104T0000/snapshot",
                    "/data/.snapshots/data.20230106T0203/snapshot",
                    "/data/.snapshots/data.20230105T0945/snapshot",
                    "/data/.snapshots/data.20230102T1603/snapshot",
                    "/data/.snapshots/data.20230105T1213/snapshot",
                ],
            },
        },
bshor commented 1 year ago
  1. Yes, I'm running with sudo. The command is sudo httm -b -R /data/Computers/Linux/Arch/
  2. Perhaps you have identified a potential issue. Yes, I have two separate snapshot subvolumes, in /.snapshots and in /data/.snapshots. I do it this way because there are two separate (conceptually) things I want to snapshot. First, the system is being snapshotted by snapper. Second, my data files (which are located in the top-level subvolume data) are being snapshotted by btrbk. I want to keep these separate. There are two subvolumes here: @ and @data.
kimono-koans commented 1 year ago

First, the system is being snapshotted by snapper. Second, my data files (which are located in the top-level subvolume data) are being snapshotted by btrbk.

This is unusual, but okay. Do httm searches of the system datasets (with the Snapper-made snapshots) work?

And what about my first question:

Tell me about your snapshots -- are they located in the directories that your --debug output indicates, or is httm missing something about the btrbk folder structure?

I'll restate -- if you are executing sudo httm -b -R /data/Computers/Linux/Arch/, does a directory exist like /data/.snapshots/data.20230103T0102/snapshot/Computers/Linux/Arch/ or does the snapshot directory somehow look different?

bshor commented 1 year ago

I'm not sure what I did wrong before, but now I see the previous versions of the files! Maybe I didn't use sudo? But here it is:

image

And httm searches work on the system data sets! I just did a manual snapshot in Snapper, then changed /etc/fstab. And I do see the two versions:

image

(incidentally I can't figure out how to restore the snapshotted version. If i click enter, it just dumps me back onto the terminal with both versions highlighted -- but this is a separate issue).

And the answer to your question is yes: the actual directory structure and the snapshot directory structure are mirrors of each other. For example, see:

image

kimono-koans commented 1 year ago

(incidentally I can't figure out how to restore the snapshotted version. If i click enter, it just dumps me back onto the terminal with both versions highlighted -- but this is a separate issue).

You can browse to print (-b) or you can also select (-s), but you need to use a different option for restore (-r). Use httm -h or if you install via a package man httm to display help. The README section on example usage might also be helpful. I'd read those carefully.

Otherwise -- it sounds like it's all working for you?

bshor commented 1 year ago

Thank you, yes, it works!! :)

I do wonder at what I did wrong before. Perhaps my memory is faulty and I didn't use sudo? Or is it possible you updated httm and it installed in the last few days? (AUR is fast).

BTW you may want to change the verbiage from "you are asking to copy from a ZFS snapshot" to BTRFS ... :)

Thank you for your very careful attention, and I really appreciate the time you took to help. As I see it, httm should be an essential part of the BTRFS (or ZFS) toolkit. What good is having snapshots if it's so difficult to see earlier versions of the files?!

kimono-koans commented 1 year ago

BTW you may want to change the verbiage from "you are asking to copy from a ZFS snapshot" to BTRFS ... :)

You're gonna have to help me if you want me to change language? Where is this confusing language?

bshor commented 1 year ago

Very simply: I have BTRFS, not ZFS, as my filesystem. I understand you started this project on ZFS and recently expanded its scope to BTRFS (which is awesome!). But when I used -r to help me restore files, it asked me if I wanted to restore a file from a "ZFS snapshot" when it should have said "BTRFS snapshot". It's not a big deal -- I totally understand what it meant -- just a little tiny detail to fix at some point.

bshor commented 1 year ago

Here's one example of this: image

kimono-koans commented 1 year ago

Thanks I'll change! Just had no idea what you were referring to.