hunleyd / btrfs-auto-snapshot

BTRFS Automatic Snapshot Service for Linux
GNU General Public License v2.0
17 stars 4 forks source link

Calculate all BTRFS subvolumes when using //. #5

Closed ams-tschoening closed 2 years ago

ams-tschoening commented 2 years ago

Maybe I'm missing something, but it seems to me that the script only works with the "root" subvolume of each BTRFS mounted file system. Though, I have the use-case of using multiple different subvolumes within the same file system and would like to keep snapshots for all of them automatically. From my understanding, this is exactly how // works in my systems using ZFS: Each dataset gets its own snapshots.

Therefore I (hopefully :-)) enhanced the script to calculate all subvolumes of all BTRFS file systems, ignore existing snapshots being subvolumes as well, and create snapshots for all of those subvolumes. This included minor changes to what has been merged in #4, how $keep is used etc. Things seem to work pretty well for where I deployed the new code.

While the change is somewhat incompatible with the former behaviour, I didn't introduce a new option by purpose. I had the feeling you want to follow zfs-auto-snapshot and it's default behaviour and its doing exactly the same. If someone needs something different, it shouldn't be too difficult to implement such switch in future.

ams-tschoening commented 2 years ago

Going to create additional PRs with better individual branches.