Skip to content
SHC Docs

shc backup

Create a backup of a stack:

Terminal window
shc backup create --stack nextcloud
shc backup create --stack nextcloud --file ./myapp.bak
shc backup create --stack nextcloud --with-dependants
shc backup create --stack nextcloud --all-connected

List backups:

Terminal window
shc backup ls
shc backup ls --stack nextcloud
shc backup ls --output json

For browsing backups stored in the Restic repository, use shc backup ls (above) and filter by --stack / --id. To inspect a local .bak / .bkg file’s manifest, see shc backup inspect below.

Restore data to an existing stack:

Terminal window
shc backup restore --file /tmp/myapp.bak
shc backup restore --file /tmp/myapp.bak --stack myapp
shc backup restore --id abc123 --stack myapp
# Time-based restore (relative intervals only)
shc backup restore --stack myapp --before "2h" # 2 hours ago
shc backup restore --stack myapp --before "1d" # 1 day ago
shc backup restore --stack myapp --before "30m" # 30 minutes ago
# Restore with connected stacks
shc backup restore --id abc123 --with-connected # Same consistency_id
shc backup restore --id abc123 --with-dependants # Stack and dependants

Export backups from Restic repository to portable .bak or .bkg files:

Terminal window
# Single backup -> .bak file
shc backup export --id abc123 --file /tmp/myapp.bak
# Multiple backups -> .bkg group file
shc backup export --id abc123 --id def456 --file /tmp/backups.bkg
# Export with related backups
shc backup export --stack myapp --latest --with-connected --file /tmp/group.bkg
# Export all backups from a stack
shc backup export --stack myapp --file /tmp/

Import .bak or .bkg files into Restic repository:

Terminal window
shc backup import --file /tmp/myapp.bak
shc -t other-org backup import --file /tmp/myapp.bak # Import into different tenant
shc backup import --file /tmp/backups.bkg # Uses manifests for placement
shc backup import --file /tmp/myapp.bak --dry-run # Preview without importing

Confirm a backup’s snapshot still exists in its repository (a membership check — it does not scan the snapshot’s contents for corruption):

Terminal window
shc backup verify --id abc123
shc backup verify --file /tmp/myapp.bak

Delete a backup:

Terminal window
shc backup rm --id abc123
shc backup rm --id abc123 --force

Filter exports by environment:

Terminal window
shc backup export --stack myapp --export-environment prod --file /tmp/prod.bak

Create a .bkg (backup group) file from multiple .bak files:

Terminal window
shc backup group -b app.bak -b db.bak --out combined.bkg
shc backup group -b app.bak -b db.bak -b cache.bak --out /tmp/full-system.bkg

Extract .bak files from a .bkg group file:

Terminal window
shc backup ungroup -i combined.bkg --out /tmp/extracted/

Display manifest information from .bak or .bkg files:

Terminal window
# Inspect a single backup
shc backup inspect myapp.bak
# Inspect a backup group
shc backup inspect combined.bkg
# Output formats
shc backup inspect myapp.bak --output json
shc backup inspect myapp.bak --output yaml
shc backup inspect myapp.bak --output table

Create new deployments from backup files (top-level command):

Terminal window
# Single .bak file (using -f / --file)
shc recover -f myapp.bak
# Single .bkg group file (using -f / --file, auto-expands to individual .bak files)
shc recover -f combined.bkg
# Multiple .bak files (using -b / --from-backup)
shc recover -b myapp.bak -b mydb.bak
shc recover -b myapp.bak:newapp -b mydb.bak:newdb
# From .bkg group file (using -b)
shc recover -b combined.bkg
shc recover -b combined.bkg --rename oldapp:newapp --rename olddb:newdb
# Target environment and node
shc recover -f myapp.bak -e prod -n node-abc123
# Relocate specific stacks to specific nodes
shc recover -b combined.bkg --relocate myapp:node-2 --relocate mydb:node-3
# Skip integrations during recovery
shc recover -b combined.bkg --skip-integration traefik
# Override stack properties during recovery
shc recover -b combined.bkg --override myapp:stack=myapp-restored,node=node-2
# Dry run (preview without executing)
shc recover -b combined.bkg --dry-run

Synchronize backup metadata with the Restic repository:

Terminal window
shc backup sync
shc backup sync --stack myapp

Install, update, and restore each take an automatic pre_* safety snapshot before changing a deployment (skip with --no-rollback). Restore one — or any point in time — with shc backup restore --before:

Terminal window
shc backup restore --stack myapp --before "2h" # ~2 hours ago
shc backup restore --stack myapp --before "1d" # ~1 day ago
shc backup restore --stack myapp --before "2026-01-05" # Specific date