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

btrbk support #35

Closed Sporif closed 2 years ago

Sporif commented 2 years ago

I saw you added Btrfs support via snapper and timeshift. Is it possible to also add support for btrbk? It produces snapshots according to its configuration file. It has a subcommand btrbk list source that when run shows the source subvolume, snapshot subvolume and the snapshot name.

For example with this config file:

timestamp_format           long
snapshot_preserve_min      24h
snapshot_preserve          36h

volume /mnt/storage0
    snapshot_dir  /mnt/snapshots/data
    subvolume     Documents
    subvolume     Pictures

the command btrbk list source produces this output:

SOURCE_SUBVOLUME         SNAPSHOT_PATH        SNAPSHOT_NAME
/mnt/storage0/Documents  /mnt/snapshots/data  Documents
/mnt/storage0/Pictures   /mnt/snapshots/data  Pictures

And if I list the snapshots with sudo btrbk list snapshots:

SOURCE_SUBVOLUME         SNAPSHOT_SUBVOLUME                           STATUS
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220605T2100  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220606T1054  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220606T1100  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220606T1200  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220606T1300  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220606T1400  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220606T1500  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220606T1600  -
/mnt/storage0/Documents  /mnt/snapshots/data/Documents.20220607T0938  up-to-date
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220605T2100   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220606T1054   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220606T1100   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220606T1200   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220606T1300   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220606T1400   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220606T1500   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220606T1600   -
/mnt/storage0/Pictures   /mnt/snapshots/data/Pictures.20220607T0938   up-to-date
kimono-koans commented 2 years ago

Thank you for filing this issue.

Maybe.

I'm reluctant to add support for every way btrfs can be snapshot-ed. I'd like to find a more sustainable way to support more use cases in btrfs without having to spend any time testing them myself as I am a ZFS guy.

I'm also very reluctant to read from any config file. Parsing mounts is bad enough.

I am more likely to support something that can cover many use cases. If you/anyone can think of a better way, I'm all ears. I'm open to ideas.

To editorialize a little bit, this is why I didn't want to support btrfs. Because if I can't make every filesystem layout work, someone is going to be disappointed. IMHO btrfs should have done what ZFS did and defined a .btrfs directory for snapshots. Maybe it would be better that btrfs users ask for this from the btrfs developers, then I try to support every uses.

kimono-koans commented 2 years ago

You might try: https://github.com/kimono-koans/httm/pull/36

Should be slower than it would be otherwise, but should fit all btrfs use cases.

Thanks!