Skip to content

Preventing accidental JetBackup purges

The four configurations that prevent a JetBackup retention misconfiguration or operator mistake from wiping out months of backups in minutes.

The worst JetBackup story we have heard: an operator lowered retention from 30 to 3 on a Friday afternoon to free disk space, did not notice the retention job ran at 02:00 Saturday, and on Monday discovered they had three Sunday backups and nothing else. The fixes for this are mostly preventive — there is no “undo” once a purge completes.

What’s happening

JetBackup retention deletes snapshots that fall outside the configured window. The deletion is immediate; there is no quarantine, no soft delete, no two-stage confirmation. A retention change applies on the next scheduled run, which may be hours away or moments away. Most accidental purges happen because the operator did not think about the upcoming run.

How to verify

Inspect the safeguards in place:

jetbackup5api -F getBackupJobs
jetbackup5api -F getQueueItems --filter status=COMPLETED
grep -i 'retention\|purge' /usr/local/jetapps/usr/jetbackup5/logs/*.log
ls -la /backup/jb/destinations/<dest>/

Check whether the offsite destination has its own retention (S3 bucket lifecycle, B2 lifecycle, SFTP remote retention) — these are independent of JetBackup’s view and can save you when JetBackup’s local copy is purged.

The fix

  1. Enable the JetBackup “Confirm before purge” prompt on retention changes if you have a multi-operator team. It catches the Friday-afternoon class of mistakes.
  2. Set the offsite destination’s lifecycle to retain longer than JetBackup’s local retention. If JetBackup keeps 7 days and S3 lifecycle keeps 60 days, an accidental local purge is recoverable.
  3. Use S3 object versioning (or B2 equivalent) on the bucket. Object versioning means that even an explicit delete from JetBackup creates a delete marker; the prior version is recoverable until lifecycle removes versions.
  4. Never test retention changes on the primary destination. Set up a small test job pointing to a scratch directory; iterate retention values there until you know the behavior.
  5. Document retention policy in version control. The runbook entry for “what is our retention” should be checked in, not just a JetBackup screenshot.

Stack Harbor enforces these safeguards on every cPanel installation we manage under environment management.