Skip to main content

💾 ZFS Snapshots & Backup on Unraid

ZFS offers powerful snapshot and replication tools ideal for data protection, versioning, and offsite backup. This guide walks you through creating snapshots and backing them up on Unraid.


📦 Prerequisites

Before proceeding:

  • You must have ZFS installed (via plugin or native support in Unraid 6.12+)
  • ZFS pool(s) configured
  • (Optional) Install Sanoid/Syncoid for automated snapshots and backups

  1. Go to the Unraid Web UI

  2. Navigate to Plugins > Install Plugin

  3. Paste the following URL:

    https://github.com/sturdycomputers/unraid-sanoid/raw/main/unraid-sanoid.plg
  4. Click Install

This adds sanoid for snapshot management and syncoid for remote snapshot replication.


🛠 Step 2: Manual Snapshot Creation (Basic)

To create a snapshot manually via CLI:

zfs snapshot poolname/dataset@snapshotname

Example:

zfs snapshot tank/data@backup-2025-06-15

You can view snapshots with:

zfs list -t snapshot

Delete a snapshot with:

zfs destroy poolname/dataset@snapshotname

🧙‍♂️ Step 3: Configure Automated Snapshots (Sanoid)

Edit the sanoid.conf file:

nano /etc/sanoid/sanoid.conf

Example Configuration:

[tank/data]
use_template = default

[template_default]
frequent = 4 # every 15 mins (default cron)
hourly = 24
daily = 7
weekly = 4
monthly = 3
autosnap = yes
autoprune = yes

frequent, hourly, etc. define how many of each type to keep. Adjust based on your storage and backup needs.

Apply Snapshot Schedule:

To run Sanoid manually:

sanoid --debug

To run it on a schedule, set up a cron job:

echo "*/15 * * * * root /usr/sbin/sanoid --cron" >> /etc/cron.d/root

🌐 Step 4: Backup Snapshots with Syncoid (Local or Remote)

Syntax:

syncoid [options] <source_dataset> <destination_dataset>

Local Backup Example:

syncoid --recursive --compress zstd tank/data backupdisk/data

Remote Backup Example (SSH Required):

syncoid --recursive --compress zstd tank/data root@192.168.1.100:tank-backup/data

First ensure SSH key-based auth is configured between your Unraid machine and the backup target.


🛑 Step 5: Restore from a Snapshot

To roll back a dataset to a previous snapshot:

zfs rollback poolname/dataset@snapshotname

⚠️ This deletes all changes made after the snapshot!

If you want to retain changes, clone the snapshot instead:

zfs clone poolname/dataset@snapshotname poolname/clone-name

📆 Optional: Schedule Syncoid Backup

Add a scheduled cron job to back up snapshots:

crontab -e

Add:

0 2 * * * /usr/sbin/syncoid --recursive --compress zstd tank/data backupdisk/data

→ This runs the backup every day at 2 AM.


🧭 Best Practices

  • Use frequent, automated snapshots with Sanoid
  • Replicate snapshots to a separate disk or server
  • Keep an offsite backup if possible (e.g., remote Syncoid + ZFS target)
  • Monitor zfs list -t snapshot to avoid excessive snapshot buildup

📚 Resources