oetiker / znapzend

zfs backup with remote capabilities and mbuffer integration.
www.znapzend.org
GNU General Public License v3.0
607 stars 137 forks source link

Implement snapshotting with something similar to systemd timers #488

Closed ethanjjjjjjj closed 3 years ago

ethanjjjjjjj commented 4 years ago

It would be nice to have snapshots automatically created as soon as possible after one was missed. For example after a reboot, the system may have been off for 6h yet may still have to wait almost an hour before the next snapshot. I think with this it makes sense to give the option to include a specific number of snapshots rather than a time period, if a system is off for a long period of time it will be booted and have all its snapshots deleted.

jimklimov commented 3 years ago

Interesting idea; I suppose this can be hacked into ZnapZend.pm $createWorkers() routine where it decides to work instantly for --runonce mode or set a timer otherwise. Perhaps check the newest snapshot age and decide if it is more than the policy interval for this backupSet - then do like runonce (note if you don't actually have the runonce flag set, then the callback will set the new timer after re-evaluating when it should fire... anyhow the run can take a while and chew into precalculated time slot).

jimklimov commented 3 years ago

@haze458 : With the current state of master branch, I think there are some differences to what you describe:

marshalleq commented 3 years ago

Along this same line, I'm looking to see if the starting time could be randomised. What I mean is, rather than kicking off 10 daily backups all at midnight, maybe to offset them to reduce system load?

jimklimov commented 3 years ago

I'd say in the latter proposition, there are two different timings. One is making a snapshot at midnight wallclock time and writing in the label that it was midnight. That is a relatively cheap operation usually, and can be done when the timer strikes.

A separate effort, that may make sense spreading over time, is the running of backups to remote destinations. Note that not everybody has that mode at all, many users just run znapzend to keep an array of snapshots that expires to be more and more sparse over time long ago. Reminiscent of RRDB in MRTG somewhat, huh? ;)

This may be achieved, I think, by some toggle to limit the amount of backupSet driven schedules that can run simultaneously. For datasets covered in one schedule, the replication is sequential, but several schedules can run in parallel. Given that with many enough snapshots they are mostly waiting for info from recipient ZFS to see which snapshot GUID the next increment attaches to, so say a minute without I/O and a seconds-long splash to write the bits, I locally am in favor of having as many such in-flights as possible. But surely YMMV.

On Tue, Dec 15, 2020 at 12:49 AM marshalleq notifications@github.com wrote:

Along this same line, I'm looking to see if the starting time could be randomised. What I mean is, rather than kicking off 10 daily backups all at midnight, maybe to offset them to reduce system load?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/oetiker/znapzend/issues/488#issuecomment-744827330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFAGLA3KP22THVLC2V3SU2P7XANCNFSM4NRCEMFA .

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.