pyznap icon indicating copy to clipboard operation
pyznap copied to clipboard

Feature request: only take snapshots if files have been written

Open DragonQ opened this issue 1 year ago • 8 comments

It'd be pretty cool to only have snapshots that actually are worth having. Seems fairly easy to implement based on this thread, e.g.

local WRITTEN=$(zfs get -H -o value written "${DATASET}")

if [ "${WRITTEN}" != "0" ]; then
  # take snapshot
fi

DragonQ avatar Mar 22 '23 14:03 DragonQ

Development on pyznap is pretty much on hold atm, I don't think I will have time to work on this in the near future. But I can keep it open if I ever get back to it.

yboetz avatar Apr 02 '23 19:04 yboetz

This looks like a nice feature, it seems easily to implement so I took a stab at it. I think it takes much more work to get it in a nice production ready state. But as a POC :

https://github.com/yboetz/pyznap/compare/master...svennd:pyznap:master

I'm not a python person, just like this tool :)

svennd avatar May 08 '23 18:05 svennd

This is not necessary for ZFS, no files writing : 0 octet in snapshot

xylle avatar Jul 31 '23 11:07 xylle

I like this feature for the following use case : I keep allot of frequent and hourly snapshots. However I don't want my backup server to spin up every 15 minutes for no changes. Since half of the data I have is pretty much "stale" in terms of writting, this makes a lot of sense.

Also what is the point of having 100's of snapshots where 90% of them don't have any content even if the cost is near-zero.

svennd avatar Jul 31 '23 14:07 svennd

If there's no snapshot, is it because there was no need or because there was an error? ZFS can handle a lot of snapshots, I've done them every 15 minutes for a year without any discomfort or slowdown. But if it's a real need ... For this type of content, why not change the frequency?

xylle avatar Jul 31 '23 14:07 xylle

Cause we never know when change might happen and then I don't want to be stuck with a 7 day old snapshot.

You are saying you have 35.060 snapshots (per pool) -only for frequent- snapshots alone ? I do like to be able to verify manually everything is running fine now and again. But everyones his own, this was only a feature request I liked personally.

Either way, I doubt yboetz will take up this or any other feature given the time constrains the developer has previously mentioned.

svennd avatar Jul 31 '23 14:07 svennd

So many snapshots is just for one pool, it doesn't make sense for the others, it's for files server in enterprise. But as an option, it doesn't hurt. It was just to give the information, ZFS is generally misunderstood. For me, it's more "kiss" to do always the same things.

xylle avatar Aug 01 '23 09:08 xylle

I agree with xylle, I'd rather keep it simple than have too many options that complicate the code. Also, following the reddit thread I think the reasoning mercenary_sysadmin gave to not have it in sanoid also makes sense.

In any case, pyznap is not in active development at the moment since I don't have time to work on it :/.

yboetz avatar Aug 01 '23 11:08 yboetz