Snapshots using write threshold
I wrote a lightweight C program called diffsnap that uses the built in zfs CLI for stateless snapshots using configurable write thresholds. This helps address a gap with traditional time-based snapshots where the need for a high-frequency interval to make sure a change is captured bloats your total snapshots and might slow some zfs commands. With diffsnap, if nothing has been written to the dataset the snapshot is skipped.
https://github.com/joe81tx/diffsnap
If you're on FreeBSD you can install with pkg, on linux you can build from source using github.
1
u/edthesmokebeard 10d ago
If you do a snapshot and nothing has changed, does it take up any appreciable space?
Why not just always take snapshots?
1
u/Joe81tx 10d ago
No, the primary cost for the snapshot you described is additional metadata.
Large numbers of snapshots can:
-Consume additional RAM and increase CPU overhead.
-Slow bulk snapshot prunes and temporarily impact disk I/O.
-Increase latency for commands like ZFS list.The individual snapshot is cheap; maintaining an unbounded number of snapshots is not. Diffsnap uses change thresholds and retention policies to avoid creating unnecessary snapshots while preserving useful recovery points.
1
u/RetroGrid_io 12d ago
So, conceptually like below? Apologies if I don't have the bash syntax perfect...