From b1dcbbbce1094f794aa7d697a545213a6291465a Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Tue, 28 May 2024 15:33:12 -0400 Subject: [PATCH] switch from zfs-auto-snapshot to sanoid Signed-off-by: ahuston-0 --- systems/palatine-hill/configuration.nix | 51 +++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index 177140d..af978d1 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -114,9 +114,54 @@ in zfs = { trim.enable = true; autoScrub.enable = true; - autoSnapshot = { - enable = true; - frequent = 8; + }; + + sanoid = { + enable = true; + + datasets = { + "ZFS-primary/attic".useTemplate = "nix-prod"; + "ZFS-primary/backups".useTemplate = "production"; + "ZFS-primary/calibre".useTemplate = "production"; + "ZFS-primary/db".useTemplate = "production"; + "ZFS-primary/docker".useTemplate = "production"; + "ZFS-primary/hydra".useTemplate = "nix-prod"; + "ZFS-primary/nextcloud".useTemplate = "production"; + "ZFS-primary/vardocker".useTemplate = "production"; + "ZFS-primary/games" = { + useTemplate = "games"; + recursive = true; + processChildrenOnly = true; + }; + }; + + templates = { + # full resiliency + production = { + frequently = 0; + hourly = 36; + daily = 30; + monthly = 6; + yearly = 3; + autosnap = true; + autoprune = true; + }; + # some resiliency, but not much + # common option for things like nix store and attic where there is + # already a lot of resiliency built in + nix-prod = { + frequently = 4; + hourly = 24; + daily = 7; + }; + # much shorter lived than others + games = { + frequently = 6; + hourly = 36; + daily = 3; + autosnap = true; + autoprune = true; + }; }; };