Minimal viable ZFS autosnapshot tool

Overview

zfs-autosnap

Minimal viable ZFS snapshot utility.

Add zfs-autosnap snap to your cron.hourly, and zfs-autosnap gc to cron.daily; then set at.rollc.at:snapkeep=h24d30w8m6y1 (or whatever is your retention policy) on datasets you want managed. Try zfs-autosnap status to check what's going on.

Retenion policy is set via the property at.rollc.at:snapkeep, which must be present on any datasets (filesystems or volumes) that you'd like to be managed. The proposed default of h24d30w8m6y1 means to keep 24 hourly, 30 daily, 8 weekly, 6 monthly and 1 yearly snapshots.

The garbage collector looks at every snapshot under the managed datasets, and considers its creation time to decide whether to keep it. The snapshot name does not matter! If you'd like to retain a particular snapshot (e.g. right before a risky upgrade), set its at.rollc.at:snapkeep property to a literal minus (-).

As always, when in doubt, consider reading the source: it's mere 400ish lines of relatively clean Rust.

Safety

It will try not to eat your data; the only destructive operation is contained within a function that will refuse to work on things that are not snapshots - but there's NO WARRANTY. Previous version (written in Python), was in production use since ca 2015 and there were zero incidents; this (Rust) version is basically a source port.

USE AT YOUR OWN RISK.

You might also like...
A command-line tool collection to assist development written in RUST

dtool dtool is a command-line tool collection to assist development Table of Contents Description Usage Tips Installation Description Now dtool suppor

A low-ish level tool for easily writing and hosting WASM based plugins.

A low-ish level tool for easily writing and hosting WASM based plugins. The goal of wasm_plugin is to make communicating across the host-plugin bounda

A cross platform tool which instantly notifies about COVID vaccine availability.
A cross platform tool which instantly notifies about COVID vaccine availability.

💉 CoWIN Notifier 😷 A cross-platform tool written in rust, which instantly notifies users about COVID-19 vaccine availability at their regions. Curre

A small tool to clone git repositories to a standard location, organised by domain name and path.

A small tool to clone git repositories to a standard location, organised by domain name and path. Runs on BSD, Linux, macOS, Windows, and more.

Rusty Armor Builds - Monster Hunter Rise Armor Set Creation Tool
Rusty Armor Builds - Monster Hunter Rise Armor Set Creation Tool

RAB Rusty Armor Builds - Monster Hunter Rise Armor Set Creation Tool Armor files used by RAB

BSP 19&20&21 Review tool

BSP review tool Limitations PAKFILE&ENTITIES lumps can't be bigger than the original ToDo WASM - needs file action interops Proper serialisation - rig

A lite tool to make systemd work in any container(Windows Subsystem for Linux 2, Docker, Podman, etc.)

Angea Naming from hydrangea(アジサイ) A lite tool to make systemd work in any container(Windows Subsystem for Linux 2, Docker, Podman, etc.) WSL1 is not s

A tool to run web applications on AWS Lambda without changing code.
A tool to run web applications on AWS Lambda without changing code.

AWS Lambda Adapter A tool to run web applications on AWS Lambda without changing code. How does it work? AWS Lambda Adapter supports AWS Lambda functi

tar analysis tool

alquitran Inspects tar archives and tries to spot portability issues in regard to POSIX 2017 pax specification and common tar implementations. Usage R

Comments
  • Anything worth pulling in from my fork?

    Anything worth pulling in from my fork?

    Hi, I've made a bunch of tweaks in my fork of your project. I understand that I kinda went to town on the code so my changes might not align with your original goals. Nonetheless I tried to make the commits self-contained so if any of these are of interest to you let me know and I can raise one or more PRs.

    (oldest first):

    • 5af40ff Remove extern crates declarations (not needed in Rust 2018)
    • 9b26b73 Address cargo warning
    • 30c0a2a Remove unnecessary to_string call
    • a107dca Make RetentionPolicy::parse a FromStr impl
    • e6565cb Remove unnecessary copy of snapshots in check_age
    • 9c8e655 Use lines and is_empty in _call_read
    • a1e14a1 Construct age check result at end of gc_find
    • 7b63abf Avoid copying SnapshotMetadata in gc_find
    • fe9a103 Add tests for RetentionPolicy::from_str
    • f1722bd Drop regex and lazy_static dependencies
    • 5fdf101 Drop anyhow dependency
    • 1896827 Extract _parse_snapshots function and add tests
    • e9da9d6 Replace unwraps and panics with errors
    • 7bc4201 Tidy up check_age
    • 58c14c7 Split library code out of the binary
    • 2c4e878 Make check_age a method of RetentionPolicy
    • 1f53496 Tidy up main function
    • b0a83ad Add CI
    • f01c0257 Implement cargo clippy suggestions
    enhancement 
    opened by wezm 5
Releases(0.1.0)
Owner
Kamil
A program is a spell cast over a computer, turning input into error messages.
Kamil
Minimal, flexible framework for implementing solutions to Advent of Code in Rust

This is advent_of_code_traits, a minimal, flexible framework for implementing solutions to Advent of Code in Rust.

David 8 Apr 17, 2022
untyped-arena provides an Arena allocator implementation that is safe and untyped with minimal complexity

untyped-arena untyped-arena provides an Arena allocator implementation that is safe and untyped with minimal complexity Usage let arena = Arena::new()

Max Bruce 1 Jan 9, 2022
diff successive buffers with embedded ansi codes in rust, outputting a minimal change

ansi-diff diff successive buffers with embedded ansi codes in rust, outputting a minimal change You can use this crate to build command-line interface

James Halliday 7 Aug 11, 2022
Minimal virus genome coverage assessment for metagenomic diagnostics

vircov Minimal virus genome coverage assessment for metagenomic diagnostics Overview v0.5.0 Purpose Implementation Installation Usage Tests Concept Cl

Eike Steinig 14 Oct 17, 2022
Minimal runtime / startup for RISC-V CPUs from Espressif

esp-riscv-rt Minimal runtime / startup for RISC-V CPUs from Espressif. Much of the code in this repository originated in the rust-embedded/riscv-rt re

esp-rs 13 Feb 2, 2023
Minimal, flexible & user-friendly X and Wayland tiling window manager with rust

SSWM Minimal, flexible & user-friendly X and Wayland tiling window manager but with rust. Feel free to open issues and make pull requests. [Overview]

Linus Walker 19 Aug 28, 2023
Dead simple, minimal SPDX License generator library written in Rust.

lice Dead simple, minimal SPDX License generator library written in Rust. Lice is in beta Install | User Docs | Crate Docs | Reference | Contributing

refcell.eth 9 Oct 22, 2023
A tool of generating and viewing dice roll success distributions.

AZDice A GUI tool for generating and visualising dice roll probability distributions. Aims Intended to help people trying to get game balance just rig

null 13 Mar 2, 2021
Simple tool for scaffolding

quick-skeleton tldr; Lightweight replacement for yeoman or slush. Powered by handlebars. This is a scaffolding tool to save you hours of writing boile

Arthur 23 Apr 21, 2022
A nifty commandline tool to manage your workstation.

workstation It's a nifty commandline rust tool to make you sit slightly away from your screen by blacking out the screen if you come too close and loc

Amar Lakshya (desi_tux) 16 May 6, 2022