btrbk icon indicating copy to clipboard operation
btrbk copied to clipboard

Handle Timeshift naming scheme to send its snapshots to targets

Open zilexa opened this issue 2 years ago • 6 comments

Timeshift is well integrated in my distribution to automatically create snapshot when updating the system and add them to Grub to easily "go back in time". I would like to leverage this and only send its snapshots to backup targets with btrbk. I already use btrbk for my personal data and my docker persistant volumes and that part works well, snapshotting and backing up subvolumes.

Timeshift uses a different folder structure. It stores snapshots of @ and @home as follows, in the root of the btrfs filesystem:

timeshift-btrfs/snapshots/2022-06-21_11-15-26/@
timeshift-btrfs/snapshots/2022-06-21_11-15-26/@home
timeshift-btrfs/snapshots/2022-06-21_11-17-54/@
timeshift-btrfs/snapshots/2022-06-21_11-17-54/@home

Instead of adding the timestamp to the snapshot subvolume name, it uses a timestamp in a folder that contains the snapshot :(

Is there a way I can tell btrbk.conf to look into those folders?

zilexa avatar Jun 22 '22 12:06 zilexa

I have implemented "timeshift-aware parents" in the action-cp branch.

Like action "archive", btrbk cp does not need any configuration (but takes some global config into account, like ssh_user etc.). Try it:

# cd /tmp/
# wget https://raw.githubusercontent.com/digint/btrbk/action-cp/btrbk
# chmod +x btrbk
# ./btrbk cp --recursive --dry-run -v timeshift-btrfs/snapshots ssh://example.com/mnt/timeshift-backup/

Sadly, adding support for this for btrbk archive (or ultimatively: dedicated config sections) is a bit harder, as it requires to create directories which is (somewhat by design) not easily possible with the current program flow. I will take this into account while doing more refactoring on btrbk (see also #454).

digint avatar Jun 26 '22 18:06 digint

Wow thanks! Good to see you already have some sort of solution in the pipeline and something better already planned :)

I will definitely give it a try. Do you have any idea when cp branch will be merged?

zilexa avatar Jun 27 '22 12:06 zilexa

I'm also interested in using btrbk to transfer timeshift snapshots to a Synology NAS. When I try to run ./btrbk cp --recursive --dry-run -v timeshift-btrfs/snapshots ssh[etc], I get the error message: "ERROR: Bad argument: not a subvolume declaration: timeshift-btrfs/snapshots". How do I declare the timeshift path or does the action-cp branch automatically 'discover' the correct location of the timeshift snapshots? I'm doing this on a fresh Linux Mint 21 install. Thanks for any help you can provide.

spoo333 avatar Aug 19 '22 01:08 spoo333

I think the "--recursive" option needs some more testing, not sure what happens here in your case.

Try passing all snapshot sources, e.g.

btrbk cp timeshift-btrfs/snapshots/* ssh://dest

Thanks for trying that out, I wish I had more time to finish this soon, it's next on my list...

digint avatar Sep 02 '22 11:09 digint

Sorry Axel, I only saw this now. Will do the testing in the very near future. Thank you

spoo333 avatar Feb 24 '23 20:02 spoo333

I think the "--recursive" option needs some more testing, not sure what happens here in your case.

Try passing all snapshot sources, e.g.

btrbk cp timeshift-btrfs/snapshots/* ssh://dest

Thanks for trying that out, I wish I had more time to finish this soon, it's next on my list...

Not working either.

happyme531 avatar Mar 02 '24 09:03 happyme531