services.sanoid

This commit is contained in:
Simon Gardling 2025-02-03 21:47:07 -05:00
parent d010634dd1
commit 078e9dd984
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

35
zfs.nix
View File

@ -26,20 +26,31 @@ in
boot.supportedFilesystems = [ "zfs" ]; boot.supportedFilesystems = [ "zfs" ];
boot.zfs.extraPools = [ service_configs.zpool ]; boot.zfs.extraPools = [ service_configs.zpool ];
services.sanoid = {
enable = true;
datasets."${service_configs.zpool}" = {
recursive = true;
autoprune = true;
autosnap = true;
hourly = 24;
daily = 30;
monthly = 12;
yearly = 4;
};
datasets."${service_configs.zpool}/services/sql" = {
recursive = true;
autoprune = true;
autosnap = true;
hourly = 12;
daily = 2;
monthly = 0;
yearly = 0;
};
};
services.zfs = { services.zfs = {
autoScrub.enable = true; autoScrub.enable = true;
trim.enable = true; trim.enable = true;
# doesn't work, maybe replace with `services.sanoid` instead
autoSnapshot = {
# attempted to manually set zpool, didn't work
flags = "-k -p -P ${service_configs.zpool}";
enable = true;
frequent = 4; # 15-minutes
hourly = 24;
daily = 7;
weekly = 4;
monthly = 12;
};
}; };
} }