https://github.com/mojtabamoaddab/zfshotter
ZFShotter is a utility designed to automate the creation of ZFS snapshots and replicate them to remote servers
https://github.com/mojtabamoaddab/zfshotter
bash-script zfs zfs-replication zfs-snapshot-automation zfs-snapshot-manager zfs-snapshots
Last synced: about 1 month ago
JSON representation
ZFShotter is a utility designed to automate the creation of ZFS snapshots and replicate them to remote servers
- Host: GitHub
- URL: https://github.com/mojtabamoaddab/zfshotter
- Owner: mojtabamoaddab
- License: gpl-3.0
- Created: 2025-03-09T13:36:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-30T16:35:42.000Z (5 months ago)
- Last Synced: 2026-01-03T09:24:13.276Z (5 months ago)
- Topics: bash-script, zfs, zfs-replication, zfs-snapshot-automation, zfs-snapshot-manager, zfs-snapshots
- Language: Shell
- Homepage:
- Size: 62.5 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# ZFShotter
ZFShotter is a utility designed to automate the creation of ZFS snapshots and
replicate them to remote servers
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Job](#job)
- [Datasets](#datasets)
- [Replication](#replication)
- [License](#license)
## Features
- Automates the creation of ZFS snapshots.
- Flexible prune policy pipeline to automate the pruning of old snapshots.
- Supports replication of snapshots to remote servers (push-based via ssh).
- Easy configuration file for customizable settings.
## Installation
To install ZFShotter, follow these steps:
1. Clone the repository to your desired directory (e.g., `/opt/`, `/usr/local/`,
or wherever you want). In this documentation, we will use `/usr/local`:
```bash
git clone https://github.com/mojtabamoaddab/zfshotter.git /usr/local/zfshotter
```
2. Configure Jobs according configuration section.
3. Define a job scheduler (e.g., cron or systemd-timer) to run the jobs with following command:
```bash
/usr/local/zfshotter/bin/zfshotter.sh
```
## Configuration
The configuration for ZFShotter is organized into a `config` directory,
which contains three subdirectories: `jobs`, `datasets`, and `replications`.
Each subdirectory holds `.conf` files that define the respective configurations.
### Directory Structure
```
config/
├── jobs/
│ └── sample.conf
├── datasets/
│ └── sample.conf
└── replications/
└── sample.conf
```
### Job
A job is a sequence of operations that involves taking snapshots, pruning old ones,
and then replicating them.
You can see `config/jobs/sample.conf` to possible configuration options.
Supported prune-policies (can be combined with `|`):
| Prune Policy | Description | Example |
|-----------------------|------------------------------------------|------------------------|
| `keep_all` | Keep all snapshots (no prune) | |
| `keep_for ` | Keep snapshots within specified duration | `keep_for 4d12h` |
| `keep_n ` | Keep the last n snapshots | `keep_n 20` |
| `keep_regex ` | Keep snapshots that match the specified regex pattern in their name | `keep_regex "^manual"` |
| `keep_time_pattern ` | Keep snapshots whose creation time (formatted as specified) matches the given regex | `keep_time_pattern "%H" "00"` |
### Datasets
The datasets configuration file is a simple list of datasets (for taking snapshots,
pruning, or replicating) along with some per-dataset options.
Each line contains a dataset path followed by optional key-value pairs separated by semicolons.
Example:
```
path/to/dataset; option1=value1; option2=value2
```
### Replication
This section defines the remote server for replicating snapshots and the datasets to replicate.
You can see `config/replications/sample.conf` to possible configuration options.
## License
This project is licensed under the GPL-3.0-or-later License -
see the `COPYING` file for details.