Reduce NFS snapshot retention time to save disk space.

This commit is contained in:
2025-10-25 11:32:13 +01:00
parent a2b54be875
commit dd8fee0ecb

View File

@@ -39,15 +39,15 @@ in
noCheck = true; 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 = { systemd.services.cleanup-services-standby-snapshots = {
description = "Cleanup old btrfs snapshots in services-standby"; description = "Cleanup old btrfs snapshots in services-standby";
path = [ pkgs.btrfs-progs pkgs.findutils ]; path = [ pkgs.btrfs-progs pkgs.findutils ];
script = '' script = ''
set -euo pipefail set -euo pipefail
# Keep last 48 hours of snapshots (576 snapshots at 5min intervals) # Keep last 4 hours of snapshots (48 snapshots at 5min intervals)
find /persist/services-standby -maxdepth 1 -name 'services@*' -mmin +2880 -exec btrfs subvolume delete {} \; || true find /persist/services-standby -maxdepth 1 -name 'services@*' -mmin +240 -exec btrfs subvolume delete {} \; || true
''; '';
serviceConfig = { serviceConfig = {