digint / btrbk

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

[Question] How to specify clone sources from snapshots of other unrelated subvolumes? #585

Open oxalica opened 2 months ago

oxalica commented 2 months ago

In the configuration incremental_prefs, all options either requires matching snapshot_name, or a parent_uuid relationship. How can I let btrbk use snapshots of other unrelated subvolumes (different name/path) as clone sources? This is useful when they actually share many data because of cp --reflink=always or dedeplication.

The docs of incremental_prefs:

sro,srn
    All from snapshot_dir matching snapshot_name, with parent_uuid relationship, sorted by btrbk timestamp (o=older n=newer).
sao,san
    All from snapshot_dir matching snapshot_name, sorted by btrbk timestamp (o=older n=newer).
aro,arn
    All from incremental_resolve, with parent_uuid relationship, sorted by cgen (o=older n=newer).

My use case is like this: I have two subvolumes active and archive, with different backup strategy and snapshot period. Once a while, I move inactive/immutable data from active to archive via cp --reflink=always && rm. To avoid needlessly transfer and/or store two copies of data on the backup device, I'd like to specify clone sources of other subvolumes when sending one, like btrfs send -p archive.old -c active.old archive.new. How can I do this in btrbk?

I tried incremental_prefs defaults,sao,san,aro,arn as suggested by documentations, but it does not seem to add cross-subvolume clone sources.

BTW: I'm not sure how to check what command line is used on send. btrbk dryrun does not print the btrfs command line to be invoked. I checked these by ro-mount the target device and view the error output from btrbk run.