From dd8fee0ecb57947c0f47019dc81fb6e058c4a934 Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Sat, 25 Oct 2025 11:32:13 +0100 Subject: [PATCH] Reduce NFS snapshot retention time to save disk space. --- common/nfs-services-standby.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/nfs-services-standby.nix b/common/nfs-services-standby.nix index f241a7a..6a9894c 100644 --- a/common/nfs-services-standby.nix +++ b/common/nfs-services-standby.nix @@ -39,15 +39,15 @@ in noCheck = true; }; - # Cleanup old snapshots on standby (keep last 48 hours for safety) + # Cleanup old snapshots on standby (keep last 4 hours for HA failover) systemd.services.cleanup-services-standby-snapshots = { description = "Cleanup old btrfs snapshots in services-standby"; path = [ pkgs.btrfs-progs pkgs.findutils ]; script = '' set -euo pipefail - # Keep last 48 hours of snapshots (576 snapshots at 5min intervals) - find /persist/services-standby -maxdepth 1 -name 'services@*' -mmin +2880 -exec btrfs subvolume delete {} \; || true + # Keep last 4 hours of snapshots (48 snapshots at 5min intervals) + find /persist/services-standby -maxdepth 1 -name 'services@*' -mmin +240 -exec btrfs subvolume delete {} \; || true ''; serviceConfig = {