Comments (20)
I for one would still love to see a weekly option, since to get weeklies right now I have to keep a month's worth of dailies ...
from sanoid.
Hm. Well, it's an interesting thought - but now you're asking Sanoid to manage crontabs alongside normal user handling of crontabs, with a lot of potential for misunderstanding and screwups on both sides.
TBH @STRML I've been thinking about your use case, and the more I think about it the more I think it really needs a fairly major engine redesign, going from a periodically-activated-by-cron model to a daemon model. The way Sanoid runs now, it caches media-heavy operations like full zfs list -rt snap to avoid thrashing disks, and otherwise just sort of eats the overhead of being constantly started since it's only a few milliseconds every minute at worst (aside from the periodic destruction and rebuild of the cache). It's a nice design because it's simple, and it doesn't need a watchdog to look out for it crashing since it's just started anew anyway.
However, some users with more heavily loaded systems are seeing difficult-to-debug issues with too many snapshots being taken on the same interval, and in particular your desired use case - much, much more frequent intervals - would itself tend to put a lot more load on the system than it really should.
I think what we're looking at here is a Sanoid 2.0 with a --daemonize mode, which instead of keeping a simple cache that gets rebuilt every time the filesystem is changed, keeps an actual running tally of all system snapshots (that it has created), which is only rebuilt if or when the daemon itself is reloaded. That also relieves you in particular of the need to run some kind of microcron, since Sanoid itself can handle scheduling with great precision inside the daemon (I've been working with micro-timing recently over in my network-testing repo, so it's fresh on my mind).
It's probably also possible to make a syntax work well for user-defined intervals with desired "perfect" times to take snapshots that can be overridden if snapshots are overdue, too; it's just a little more brain-break-y than I was originally willing to deal with when I wrote Sanoid in the first place.
How do you feel about "partially commissioning" a major rewrite as described? I think the only other option is to implement your request of super-frequent intervals as a completely separate daemon. That would certainly be faster and easier than rewriting Sanoid itself, but TBH I'd like to take the extra time and make the whole platform benefit from it (and that would also make it easier for you to take advantage of ongoing updates to the platform in other respects).
We can and should talk about the nitty-gritty of the commissioning part off-list, but I figured since you brought it up here, it wouldn't hurt to discuss the technical aspects of it in public. =)
from sanoid.
We are getting OT, so I'll email you.
from sanoid.
I see a PR was made some time ago to implement this, any chance of it being merged in the near future?
from sanoid.
Yep, I'll put this on the to-do list.
from sanoid.
Great, Thanks!
from sanoid.
I have been thinking about this a little more. The way templates are handled now, options are replaced. What if they were stacked? That way i could define multiple daily, weekly, monthly snaps. The templates might need to be redefined/restricted to handling only one type of snapshot, and need a name/label/prefix. Something like this?:
[template_dailysnap11a]
; take a snapshot @ 11am
name=11am
type=daily # hourly,daily,weekly,monthly, yearly
daily_hour=11
daily_min=01
autoprune=yes
count=2
This way you could define multiple snapshots for each class (hourly,daily. .etc) and then attach them to backup_templates or the host definition. This would give people the ability to do things like
2 11am snapshots
2 2pm snapshots
26 Friday snapshots
1st and 15 of the month.
7 daily
and on and on. . .
I realize this is a pretty big enhancement/feature request, but i think it would be valuable and give users the ability to do/define any snapshot scheme they want.
from sanoid.
Too complex and, frankly, strikes me as completely unnecessary, sorry. #wontfix on that idea.
from sanoid.
The way zfs-auto-snapshot
does it is quite nice, in fact. It sets cron jobs in /etc/cron.{d,hourly,daily,weekly,monthly}
and then you set a keep=x
param on that. It's not as flexible of a syntax, especially for multiple jobs, but we could do something really nice with a custom syntax.
This syntax could remove all hard-coded periods and replace it with a single structure. For example, I imagine reimplementing the existing periods like so:
<hourly>
schedule = 0 * * * *
<daily>
schedule = 59 23 * * *
<monthly>
schedule = 0 0 1 * *
<yearly>
schedule = 0 0 1 1 *
Then specifying them as:
[template_weekly]
keep_hourly = 48
keep_daily = 90
keep_monthly = 6
keep_yearly = 0
The purpose of the keep_
prefix is such that period names can be arbitrary without fear of collision.
Then, it could be possible to define the following useful periods without any modifications to sanoid:
<minutely>
schedule = * * * * *
<weekly>
schedule = * * * * 1
Or even something crazier in combination with https://github.com/homer6/frequent-cron:
<frequent>
schedule = */10 * * * *
from sanoid.
How do you feel about "partially commissioning" a major rewrite as described
I hereby.... 🤣
Yes, I'd support this (and emailed you yesterday to that end), although I am a bit wary of what complexity may be introduced by something as ambitious as a full rewrite. The syntax I described above didn't suggest using cron to actually run the jobs (although it could!) but instead just as a flexible, terse, familiar syntax for the mechanism that already exists. I still see sanoid being invoke via a * * * * *
cron.d job.
How risky - or lengthy - a rewrite would be is a question I think only you can answer. If it's possible to keep it simple, IMO that's better.
from sanoid.
@STRML, zfSnap pretty much does the separate cron thing you suggested. It can also work on @reboot and pre/post apt/yum.
from sanoid.
We're evaluating znapzend as well, which has done very well even at very high frequency (e.g. 5s).
from sanoid.
I'm using znapzend right now, and can recommend it. Editing the config is a little clunky, but it works well.
from sanoid.
Yeah I agree it's clunky. Out of curiosity, have you done/seen any scripts that wrap admin actions (such as apt, upstart, or a a deployment) around snapshots & can clean them up after some time?
from sanoid.
@redmop have you switched from sanoid to znapzend? If so would you mind sharing what the deciding factors were? Off list is fine if you prefer.
from sanoid.
I moved from znapzend to sanoid, but I miss weekly snapshots.
from sanoid.
@jimsalterjrs do you already started with adding weekly snapshots or are you fine if i prepare a PR?
from sanoid.
from sanoid.
Another me too - please merge the weekly snap option.
from sanoid.
I'm not savvy with git enough to fork and merge, so count this as another request for the PR to be merged into the main codebase.
from sanoid.
Related Issues (20)
- How to tell sanoid not to take snapshot while syncoid is running? HOT 3
- syncoid backups out of sync HOT 2
- [question] Is syncoid inital offline sync possible? HOT 1
- Recursive setting cannot be enabled if trailing space present HOT 1
- syncoid: ControlSocket already exists HOT 2
- ubuntu 24.04 fail to start sanoid service HOT 1
- My sanoid.conf is not being recognized. HOT 1
- sanoid --prune-snapshots performance is bad because of iszfsbusy HOT 5
- [feature request / question] Auto-mount last snapshot done by sanoid HOT 6
- Regression: "invalid flags combined with -t" when resuming with `syncoid --sendoptions`
- Building deb package fails on ubuntu 24.04 HOT 7
- Syncoid question: Hook script or other way of adding data to a log on the remote target system? HOT 1
- Syncoid: sync incremental - hold selected snapshots during sync HOT 2
- Syncoid flag "--exclude=" is excluding datasets of similar name HOT 6
- Unknown option: no-clone-rollback ?
- Restrict sanoid to single pool or list of pools HOT 1
- Debian package incompatible with OpenZFS built from sources HOT 1
- --force-delete does not seem to delete datasets HOT 2
- False error: ZFS resume feature not available on source and target machine
- Parallel pruning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanoid.