fracai
Guru
- Joined
- Aug 22, 2012
- Messages
- 1,212
I've posted a Python script at https://github.com/fracai/zfs-rollup and https://bitbucket.org/fracai/zfs-rollup for "rolling up" old snapshots. The intended use is that you would configure automated snapshots at some interval of time with a long retention length and allow the script to prune these into a sparser set as they get older.
The original version is very similar to Apple's TimeMachine. All snapshots are kept for the past day (most sensible if you're making hourly snapshots), then daily snapshots are kept for the past week, and finally weekly snapshots are kept forever. If you have your snapshots set to one year of retention, those weekly snapshots will start falling off when they're a year old.
I'm now working on supporting arbitrary intervals (i.e. keep snapshots from every two hours for two days) and dropping the assumption that the system is set to hourly snapshots (i.e. snapshot from every 15 minutes). Preliminary support is there, but it still needs work and hasn't been fully tested, so the best version to use right now is from before I added that (563c442685 at github ora8ddfac at bitbucket). Arbitrary interval support has been implemented.
Suggestions, requests, and testing are welcome.
Please note that the intent of the script is to delete snapshots. It's really only the last line in the script that does the scary bit, and I generally test this pretty well, but bugs will slip through. Monitus es.
Just wanted to update this to note that the scripts have been updated for Python 3 and should be compatible with FreeNAS 11.3. Please let me know if there are any issues or feature requests.
The original version is very similar to Apple's TimeMachine. All snapshots are kept for the past day (most sensible if you're making hourly snapshots), then daily snapshots are kept for the past week, and finally weekly snapshots are kept forever. If you have your snapshots set to one year of retention, those weekly snapshots will start falling off when they're a year old.
I'm now working on supporting arbitrary intervals (i.e. keep snapshots from every two hours for two days) and dropping the assumption that the system is set to hourly snapshots (i.e. snapshot from every 15 minutes). Preliminary support is there, but it still needs work and hasn't been fully tested, so the best version to use right now is from before I added that (563c442685 at github or
Suggestions, requests, and testing are welcome.
Please note that the intent of the script is to delete snapshots. It's really only the last line in the script that does the scary bit, and I generally test this pretty well, but bugs will slip through. Monitus es.
Just wanted to update this to note that the scripts have been updated for Python 3 and should be compatible with FreeNAS 11.3. Please let me know if there are any issues or feature requests.
Last edited: