jimsalterjrs / sanoid

These are policy-driven snapshot management and replication tools which use OpenZFS for underlying next-gen storage. (Btrfs support plans are shelved unless and until btrfs becomes reliable.)
http://www.openoid.net/products/
GNU General Public License v3.0
3.09k stars 302 forks source link

option to only prune snapshots that have been replicated to a backup server #741

Open ghost opened 2 years ago

ghost commented 2 years ago

I'm using ZFS on my laptop and do backups via replication to a home NAS. This is not always possible, for example when I travel (and prefer to cut the power to the NAS). I want to use sanoid/syncoid to automate the snapshot replication and management. I only want to prune snapshots that have been replicated to the backup server. I have been unable to find a way to archive this from reading the readme and wiki. Is this a feature that would fit sanoid? If nothing else, conditional pruning based on the exit status of a pre_prune_script would allow solving this via bash scripts.

This would also be a solution to the problem described in #706, where after a sufficiently long time incremental backups to the server are impossible because the two datasets share no snapshots.

hhhappe commented 2 years ago

This would be a nice feature. zfs hold/release should help a lot to get this done. I guess sanoid could do the hold with scripts, but it seems that syncoid has no way to run a script on each replicated snapshot to release it.

gnordli commented 2 years ago

That is interesting in some use cases.

I originally thought about being less aggressive with your pruning.

But may be easily solvable based on some sort of last synced timestamp (zfs properties).  Based on the timestamp of the last snapshot for that dataset.

You would then not prune any datasets that are newer than the last sync timestamp.   That would guarantee you should have at least one snapshot in common.

I haven't thought this through, just throwing it out there.

Geoff

On 2022-06-02 5:49 a.m., Hans Henrik Happe wrote:

This would be a nice feature. zfs hold/release should help a lot to get this done. I guess sanoid could do the hold with scripts, but it seems that syncoid has no way to run a script on each replicated snapshot to release it.

— Reply to this email directly, view it on GitHub https://github.com/jimsalterjrs/sanoid/issues/741#issuecomment-1144825070, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQYXQGI33IAWKD4J7ELD6DVNCUVFANCNFSM5UCZTPZA. You are receiving this because you are subscribed to this thread.Message ID: @.***>