shc backup import
shc backup import
Section titled “shc backup import”ingest a one-off .bak into the indexed store, or sweep a whole local store
Synopsis
Section titled “Synopsis”Read a one-off .bak archive off this node’s filesystem and ingest
it into the cluster’s backup repository: the bytes become a restic
snapshot and the archive becomes an ordinary row in shc backup ls,
addressable by id for restore, verify, mount and retention. This is
the on-ramp for an archive somebody handed you, or for one this
cluster exported earlier.
The container is checked first: its ar(5) member table has to add up against the file’s own length before anything is written. An archive that does not add up is refused (X400416IMPCNT) rather than sealed: once a snapshot lands, its row is indistinguishable from a real capture, so the door is the last cheap place to tell them apart.
Importing the same archive twice leaves one row. The second run recognises the archive by its own content identity and returns the existing row without staging a byte.
--from-store applies all of that to a whole directory: it is the migration off the retired standing folder (<state_home>/backups). Scheduled captures no longer come to rest there, but the folder does not empty itself. It can still hold old-line archives, orphans from failed runs, and crashed staging trees. The sweep imports every sound archive, skips the ones the repository already holds, and refuses the rest with the same gate and the same reasons a single import gives.
The sweep is a dry run unless you pass --apply. A dry run reads container headers and the ledger and changes nothing at all.
--repair-container is required for the ar(5)-clamped class in bulk exactly as it is for one archive. A sweep is not a way to consent to fifty archives by not mentioning them: without the flag they are reported, counted and left alone.
This command never deletes anything. Not with --apply, not ever. The sweep makes the store’s archives redundant by putting them in the repository, and reports how many bytes are therefore reclaimable. Removing the folder is your action, taken after reading the report.
There is no default store directory: --from-store must name one. The folder this migrates off is the folder the ruling abolished as a destination, so assuming its path would re-introduce the thing being retired. It is also node-local: on a cluster, run it per node.
shc backup import [path] [flags]Examples
Section titled “Examples” shc backup import /srv/handover/myblog.bak shc backup import --repair-container /var/lib/shc/dr/openobserve.bak shc backup import --from-store /var/lib/shc/backups shc backup import --from-store /var/lib/shc/backups --applyOptions
Section titled “Options” --apply perform the --from-store sweep instead of reporting what it would do --from-store string sweep every .bak under this directory into the repository (dry run unless --apply) -h, --help help for import --repair-container import an archive whose ar(5) size field was clamped by a pre-refusal writer, resolving the true member length from the container's geometry (refused without this flag)Options inherited from parent commands
Section titled “Options inherited from parent commands” --config stringArray extra YAML config file to layer on top of auto-discovered config; repeatable, later files win -d, --debug enable debug mode (default: $SHC_DEBUG) -e, --environment string environment name (default: "prod", or "default" on an estate with no licence and no trial; $SHC_ENVIRONMENT and shc ctx -e override it, and the "master" tenant is always "default") --exclude string comma-separated dotted paths to drop --fields string comma-separated columns/keys to show (and their order) --filter string comma-separated dotted paths to keep (drops everything else) -o, --output string output format: tty|text|json|yaml (default: $SHC_OUTPUT) -s, --stack string stack name (default: $SHC_STACK) -t, --tenant string tenant name (default: $SHC_TENANT) -v, --verbose verbose output (default: $SHC_VERBOSE)SEE ALSO
Section titled “SEE ALSO”- shc backup - create and manage backups