https://github.com/freaky/snapzfs
The dubious beginnings of yet another automatic ZFS snapshot script.
https://github.com/freaky/snapzfs
Last synced: 12 months ago
JSON representation
The dubious beginnings of yet another automatic ZFS snapshot script.
- Host: GitHub
- URL: https://github.com/freaky/snapzfs
- Owner: Freaky
- Created: 2014-04-23T02:00:13.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2018-06-02T18:21:37.000Z (almost 8 years ago)
- Last Synced: 2025-03-02T20:30:41.757Z (about 1 year ago)
- Language: Ruby
- Size: 38.1 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
snapzfs
=======
Yet another ZFS auto-snapshot script. You probably don't want to be using it yet.
Unfinished, untested, untidied.
Features
--------
* Driven almost entirely by ZFS user attributes.
* One cronjob.
* All snapshot types share a namespace. Just @auto.yyyy-mm-ddThh:mm:ssZ
* UTC or death.
* Destroys unnecessary empty snapshots.
* Kicks puppies.
* Self-contained script. No gems, just stock Ruby 2.0+ and its standard library.
* Probably won't cause data loss. Probably.
Usage
-----
snapzfs policy "4 * 15 minutes; 24 hourly; 7 daily; 4 weekly" tank
snapzfs disable tank/junk
snapzfs enable tank/junk/important
snapzfs policy "7 daily" tank/media
echo "*/15 * * * * root /path/to/snapzfs auto" >>/etc/crontab
Keeps four snapshots at 15 minute intervals, 24 at hourly intervals, 7 at daily
intervals, and 4 at weekly intervals. `snapzfs list` to view them. `snapzfs nuke`
to get rid of them all.
Use "zfs hold" for any snapshots you want to keep.
ZFS Properties
--------------
st.hur:snapshot.
policy String The snapshot policy.
auto Bool Whether this dataset is snapshotted.
Note expirations happen regardless.
policies String The policies applied to this snapshot.
created_at Integer Unixtime this snapshot was made.
expires_at Integer Unixtime this snapshot expires.
Not currently used.
TODO
----
* Named snapshots with expiry dates.
* Time/date based snapshots. e.g. "7 midnight" for seven at or near 00:00.
* Localtime. '+' is an invalid snapshot name, which torpedoed my desire for
ISO 8601 dates.
* Test suite.
* Refactor. One monolithic file seemed like a good idea at the start.
(And it probably still is for deployment).
* Actually use OptionParser.
* Documentation, license, etc.