💾 Backup
crestic backup [--all, -a] [--job, -j <name>] [--dry-run]Performs a backup of all jobs if the -a or --all flag is passed. To only backup some jobs pass one or more -j or --job flags.
The --dry-run flag will do a dry run showing what would have been backed up, but won't touch the actual data.
What It Does
The backup command performs a complete backup workflow (all steps are automatic):
- Sends start ping to healthcheck service (if configured)
- Runs 'before' hooks (if configured)
- Checks repository - automatically initializes if not exists
- Creates backup - encrypted, deduplicated snapshot
- Verifies integrity - runs
restic checkon repository - Applies retention policy - runs
restic forgetwithforget_options - Runs 'success' or 'failure' hooks based on outcome
- Sends success/failure ping to healthcheck service
# All jobs
crestic backup --all
# Specific job
crestic backup --job documents
# Multiple jobs
crestic backup --job documents,photos
# Dry run
crestic backup --all --dry-runAutomatic Cleanup
If your repository has forget_options configured, old snapshots are automatically removed after each backup:
repositories:
my-repo:
forget_options:
keep-daily: 7
keep-weekly: 4
prune: true # Actually frees disk spaceFor more options, see Removing backup snapshots (opens in a new tab).
Error Handling
When running multiple jobs, each job executes independently. If one job fails:
- The error is logged
- Execution continues with the next job
- Other jobs will still run
- At the end, all errors are collected and returned as a combined error message
This ensures that a failure in one job doesn't prevent other jobs from completing. Each job's success or failure is tracked separately, and healthcheck notifications are sent for each job individually.