| title | pg hardstorage rotate | ||
|---|---|---|---|
| description | CLI reference for the pg hardstorage rotate command. | ||
| tags |
|
Apply retention policy to a deployment (or all)
Classify each backup as kept or to-be-soft-deleted per the chosen retention policy, then optionally apply the decision.
Three policies ship today:
gfs (default): grandfather-father-son. --keep-daily 7 keep one backup per UTC calendar day, last 7 --keep-weekly 4 keep one backup per ISO calendar week, last 4 --keep-monthly 12 keep one backup per UTC calendar month, last 12 --keep-yearly 5 keep one backup per UTC calendar year, last 5
simple: --keep-for 30d keep every backup younger than this duration
count: --keep-fulls 14 keep the most recent N full backups
The newest backup is ALWAYS kept regardless of policy output — operators must never end up with zero backups because of a misset flag. This is hardcoded; --keep-* lower bounds don't override it.
Default mode is --dry-run; pass --apply to actually mark manifests. Soft-deleted manifests get a tombstone marker beside them; the manifest body and its chunks are NOT removed in this slice (the chunk-GC pass that reaps unreferenced bytes lands).
pg_hardstorage rotate [<deployment>] [flags]
--apply actually soft-delete (default: dry-run)
-h, --help help for rotate
--keep-daily int GFS: backups kept per UTC day (default 7)
--keep-for duration simple: keep every backup younger than this (default 720h0m0s)
--keep-fulls int count: keep the N most recent fulls (default 14)
--keep-monthly int GFS: backups kept per UTC month (default 12)
--keep-weekly int GFS: backups kept per ISO week (default 4)
--keep-yearly int GFS: backups kept per UTC year (default 5)
--policy string retention policy: gfs|simple|count (default "gfs")
--repo string repository URL (file://, s3://, ...) — must already exist (required)
--airgapped airgapped: strict refuse outbound endpoints (LLM providers, sinks, OTLP collectors) outside loopback / RFC1918 / explicit airgap.allowlist. Also enabled by PG_HARDSTORAGE_AIRGAPPED=1 or airgapped: strict in the config file.
-c, --config string path to config file (default: XDG/FHS lookup)
--cpu-profile go tool pprof <path> write a pprof CPU profile to this path for the duration of the command (go tool pprof <path> to analyse). Off when empty.
--mem-profile string write a pprof heap profile to this path at command exit. Off when empty.
--no-color disable ANSI color in text output
--on-error-llm on a structured-error failure, drop into the matching LLM helper skill (auto_on_error trigger). Also enabled by PG_HARDSTORAGE_ON_ERROR_LLM=1.
--otel-endpoint string OpenTelemetry OTLP/HTTP endpoint (e.g. http://otel-collector:4318); empty disables tracing
--otel-stdout also export OpenTelemetry traces to stderr (useful for dev)
-o, --output string output format: text|json|ndjson|yaml|template|csv|markdown|html|tap|junit|pdf (default: text on TTY, json off-TTY)
--profile-port go tool pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=30 if non-zero, expose net/http/pprof on 127.0.0.1:<port> for live profiling of long-running commands (e.g. go tool pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=30). Off when zero.
-q, --quiet suppress non-essential output
--template string Go text/template applied when --output template (or implied if --template is set without --output)
- pg_hardstorage - PostgreSQL backup, done right.