digint / btrbk

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

snapshot_preserve and snapshot_preserve_min are extremly confusing to use #535

Closed zilexa closed 1 year ago

zilexa commented 1 year ago

I just discovered snapshot_preserve has very little effect what you put in there. If you want a specific retention policy, you need to set the exact same for snapshot_preserve and snapshot_preserve_min. Otherwise, if you set your policy in snapshot_preserve and don't have snapshot_preserve_min, btrbk assumes min should be all. Also, if you set snapshot_preserve_min to latest, it doesn't matter what you have in snapshot_preserve.

I think this deserves a rethink of what the exact purpose of " ...min " is and whether it makes sense to make it so powerful over the default setting for retention policy, being snapshot_preserve.

So if I want a specific policy for retention I need to set the same value for snapshot_preserve and snapshot_preserve_min, I cannot omit the latter (which seems strange, it should default to snapshot_preserve if there is no value in the conf value for it).

zilexa commented 1 year ago

I figured it out: https://github.com/zilexa/Homeserver/blob/master/docker/HOST/btrbk/btrbk.conf

Assuming if I run btrbk more than once on a single day, at next run it will delete snapshots of that day except for the last one created that day.