diff --git a/backup.ps1 b/backup.ps1 index 06d0159..b98dc2e 100644 --- a/backup.ps1 +++ b/backup.ps1 @@ -76,7 +76,7 @@ function Invoke-Maintenance { # prune (remove) data from the backup step. Running this separate from `forget` because # `forget` only prunes when it detects removed snapshots upon invocation, not previously removed Write-Output "[[Maintenance]] Start pruning..." | Tee-Object -Append $SuccessLog - & $ResticExe prune 3>&1 2>> $ErrorLog | Tee-Object -Append $SuccessLog + & $ResticExe prune $SnapshotPrunePolicy 3>&1 2>> $ErrorLog | Tee-Object -Append $SuccessLog if(-not $?) { Write-Output "[[Maintenance]] Prune operation completed with errors" | Tee-Object -Append $ErrorLog | Tee-Object -Append $SuccessLog $maintenance_success = $false diff --git a/config.ps1 b/config.ps1 index 05193a4..7afa23d 100644 --- a/config.ps1 +++ b/config.ps1 @@ -13,6 +13,7 @@ $GlobalRetryAttempts = 4 # maintenance configuration $SnapshotMaintenanceEnabled = $true $SnapshotRetentionPolicy = @("--group-by", "host", "--keep-daily", "30", "--keep-weekly", "52", "--keep-monthly", "24", "--keep-yearly", "10") +$SnapshotPrunePolicy = @("--max-unused", "1%") $SnapshotMaintenanceInterval = 7 $SnapshotMaintenanceDays = 30 $SnapshotDeepMaintenanceDays = 90;