digint / btrbk

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

Cleanup snapshots anyway even if one target aborted #377

Open stevenxxiu opened 3 years ago

stevenxxiu commented 3 years ago

I have multiple external HDDs that I backup to, but I only keep 1 external HDD available near me.

When I backup with btrbk, it will refuse to cleanup the snapshots if one of my targets isn't available, even though backing up to 1 HDD was fine.

Can there be a way to tell btrbk to cleanup the snapshots anyway?

digint commented 3 years ago

This would be something like btrbk prune --force, or --ignore-unreachable. Thanks for the input, adding enhancement label.

samjetski commented 1 year ago

I ran into this issue too. Following the 3-2-1 Backup Rule, I always want to have 1 backup off-site. So I use 2 external backup drives, and I never have both external drives on-site (let alone connected) at the same time in case of e.g. fire or lightning strike.

@digint would it be possible to store some kind of state file, so that btrbk knows what the latest snapshot is on each target - even when they are not available? This does change the workflow a bit, but could be optional - something like --config /etc/btrbk/btrbk.conf --state /var/btrbk/btrbk.state and simply allow retention policies to proceed without targets present. It would also help resolve some other issues like #544, #520, #509, #483, #335 - I get the impression that this is a common enough problem.

lairez commented 8 months ago

The best solution I found is to duplicate the volume section for each target (and use snapshot_name to avoid conflict). For one of the two external drive, I keep only the last snapshot.

stevenxxiu commented 8 months ago

I think most people would want to keep all the permanent snapshots.

Personally I have a wrapper script to update the config file automatically when I make a new backup, if I have a different external disk.

I'm waiting for an official solution to this issue.