explaingit

jimsalterjrs/sanoid

3,758PerlAudience · ops devopsComplexity · 3/5LicenseSetup · moderate

TLDR

Sanoid automatically creates and cleans up ZFS snapshots on a schedule based on a simple config file, so you always have hourly, daily, and monthly recovery points without manual work.

Mindmap

mindmap
  root((sanoid))
    What it does
      ZFS snapshot management
      Auto create and prune
      Policy-based retention
    Configuration
      Plain-text config file
      Template support
      Per-dataset policies
    Companion Tools
      Syncoid replication
      SSH-based transfer
      Incremental sync
    Monitoring
      Nagios-style checks
      Pool health status
      Snapshot health report
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Define a retention policy (12 hourly, 30 daily, 6 monthly) in Sanoid's config file and let it automatically create and delete ZFS snapshots on a cron schedule.

USE CASE 2

Use Syncoid to replicate ZFS snapshots from one machine to an offsite server over SSH, sending only incremental changes each run.

USE CASE 3

Add Sanoid's monitoring commands to a Nagios or similar monitoring system to alert when snapshot health or pool status degrades.

USE CASE 4

Run a hook script before each snapshot to quiesce a database so the snapshot captures a consistent state.

Tech stack

PerlZFSLinux

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Linux and OpenZFS, Sanoid itself is a Perl script run via cron, no complex build step, but you must configure ZFS datasets first.

GPL v3, free to use and modify, but any distributed versions must also be released under GPL v3.

In plain English

Sanoid is a tool that automatically manages snapshots on ZFS storage systems. A snapshot is a frozen copy of your data at a specific moment in time, which you can use to recover files or roll back an entire system to an earlier state. Without a tool like Sanoid, creating and cleaning up snapshots is a manual process that most people skip, leaving them without backups when something goes wrong. The way Sanoid works is through a plain-text configuration file where you define policies: how many hourly, daily, weekly, monthly, and yearly snapshots to keep for each storage dataset. Sanoid then runs on a schedule (typically every minute via a system cron job) and handles both creating new snapshots and deleting expired ones according to those policies. The configuration supports templates, so you can define a standard policy once and apply it across many datasets without repeating yourself. The tool also includes monitoring commands that report on snapshot health and storage pool status, designed to work with Nagios-style monitoring systems. There are optional hooks that let you run your own scripts before or after a snapshot is taken, or when one is pruned, which is useful if you need to quiesce a database or notify another system around snapshot events. A companion tool called Syncoid handles replication: copying snapshots from one machine or pool to another over SSH. This is how you get offsite or cross-server backups. Syncoid works incrementally, sending only the differences since the last transfer rather than copying everything each time. Sanoid runs on Linux and requires OpenZFS. The project is free software under the GPL v3 license. The README notes that Btrfs support was previously planned but has been shelved until Btrfs is considered sufficiently reliable. The project is maintained by the author of the Practical ZFS forum and book.

Copy-paste prompts

Prompt 1
Show me a Sanoid config file that keeps 24 hourly, 30 daily, 6 monthly, and 1 yearly snapshots for a ZFS dataset called tank/data.
Prompt 2
How do I set up a cron job to run Sanoid every minute so it automatically manages snapshots according to my config?
Prompt 3
Using Syncoid, how do I replicate my ZFS dataset tank/data to a remote server called backup-host over SSH?
Prompt 4
How do I write a Sanoid pre-snapshot hook that pauses a PostgreSQL database before the snapshot and resumes it afterward?
Open on GitHub → Explain another repo

← jimsalterjrs on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.