Problem/Justification
The Grandfather-Father-Son (GFS) retention scheme is a foundational backup strategy that balances granular short-term recovery with efficient long-term data protection.
-
Protection Against Delayed Threat Detection: Ransomware, silent bitrot, or unnoticed file deletions often go undetected for weeks. High-frequency short-term backups alone will quickly overwrite clean copies with corrupted ones, whereas GFS guarantees clean recovery points months or years in the past.
-
Storage Efficiency: Keeping every daily snapshot indefinitely exhausts storage capacity. GFS exponentially thins out older snapshots—maintaining hourly/daily precision for immediate rollbacks while preserving only key weekly, monthly, and yearly milestones for the long haul.
Even if zfs snapshots are very space efficient, in case of regularly changing data (DB), many snapshots can take massive amount of space.
This creates significant management overhead and potential points of failure:
-
UI & Task Bloat: Managing 10 datasets with a standard GFS strategy requires 40 distinct snapshot tasks in the GUI.
-
Complex Replication Setup: To replicate these snapshots offsite, replication tasks must be manually configured using complex pattern matching (
also_include_naming_schemaor regex) to ensure every tier is captured. Missing a schema breaks offsite retention for that tier. -
Redundant Snapshot Overlaps: When multiple tasks trigger at the same time window (e.g., midnight on the first of the month), the system creates duplicate snapshots under different names unless meticulously scheduled.
Impact
-
Benefits & Advantages:
-
1 Dataset = 1 Task: Simplifies snapshot management across both UI and CLI/API.
-
Seamless Replication: Target systems automatically inherit multi-tier GFS retention rules when
retention_policy: SOURCEis used, eliminating manual schema matching. -
Enterprise Best Practices Out of the Box: Makes proper long-term backup retention intuitive for both beginners and enterprise administrators.
-
-
Disadvantages:
- Requires updates to the web interface, API (
pool.snapshottask), and underlying replication scheduler (zettarepl) logic to process multi-tier retention rules per task object.
- Requires updates to the web interface, API (
User Story
-
A TrueNAS user opens Data Protection > Periodic Snapshot Tasks > Add.
-
They select a dataset (e.g.,
SSD/dockerconfig) and check a new Enable GFS Retention option. -
They set their desired tiers within the single task interface:
-
Daily: Keep
10Days -
Weekly: Keep
7Weeks -
Monthly: Keep
6Months -
Yearly: Keep
1Year
-
-
The user saves the task. TrueNAS creates a single automated schedule that handles snapshot generation and prunes snapshots according to their respective GFS tier lifetime.
-
The user creates a Replication Task to a remote server. The replication job automatically syncs all GFS snapshots and applies the exact same retention rules on the destination system without requiring manual naming schema matching.