digint / btrbk

Tool for creating snapshots and remote backups of btrfs subvolumes
https://digint.ch/btrbk/
GNU General Public License v3.0
1.72k stars 124 forks source link

Handle Timeshift naming scheme to send its snapshots to targets #480

Open zilexa opened 2 years ago

zilexa commented 2 years ago

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?

digint commented 2 years ago

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).

zilexa commented 2 years ago

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?

spoo333 commented 2 years ago

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.

digint commented 2 years ago

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...

spoo333 commented 1 year ago

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

happyme531 commented 9 months ago

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.