This script automates the process of creating snapshots and replicating ZFS datasets on Unraid, making backups and data recovery easier and more reliable. It’s designed for Unraid version 6.12 and above, providing flexible options for both local and remote backups using either ZFS replication.
- Automated Snapshots: Uses Sanoid to manage snapshots with a user-defined retention policy.
- ZFS Replication: Supports local and remote ZFS replication with Syncoid.
- Unraid Notifications: Sends notifications via Unraid's GUI, alerting you to the success or failure of tasks.
- Multiple Dataset Support: Allows processing of multiple ZFS pools and datasets in a single run.
- Automatic Configuration Management: Automatically generates and updates Sanoid configuration files.
- Unraid 6.12 or above
- ZFS Pool(s)/Dataset(s)
- Sanoid: Automatic snapshot management. Sanoid/Syncoid Plugin
- Install Community Apps: Follow the Unraid documentation and guide.
- Install Sanoid: Install the Sanoid plugin from Community Apps.
Edit the variables at the beginning of the script to match your environment.
This modified script builds upon the foundation of the original script by SpaceInvaderOne, with several enhancements and changes to make the backup and replication process more versatile and robust. Below are the key differences:
- Original Script: Focuses on processing a single ZFS pool and dataset.
- Modified Script: Allows for multiple ZFS pools and datasets to be processed in a single run, making it more flexible for environments with multiple datasets.
- Original Script: Relies on hardcoded variables for pool and dataset names.
- Modified Script: Uses arrays to allow multiple pools and datasets to be specified easily. This approach simplifies managing configurations for large environments.
- Original Script: Manages snapshots and pruning through Sanoid but without automated configuration adjustments.
- Modified Script: Automatically generates and updates Sanoid (as needed) based on the specified retention policies and datasets, reducing manual configuration steps.
- Modified Script: Adds additional checks to ensure snapshots are created and pruned as expected. The script now exits with a failure notification if these operations do not occur as intended.
- Edit the Script: Configure the variables at the beginning of the script according to your environment.
- Run the Script: Execute the script via Unraid's terminal or schedule it as a cron job. For example, to run the script daily at midnight, add the following to your crontab:
0 0 * * *
This script is provided as-is, without warranty of any kind. Please review and test it before using it.
- Original Script: SpaceInvaderOne
- Modifications: ChatGPT Data Analyzer