Skip to main content

Overview

The cloudstic check command verifies the integrity of your Cloudstic repository by walking the full reference chain from index/latest through snapshots, HAMT nodes, filemeta, content, and chunks. It detects:
  • Missing objects
  • Corrupt objects (hash mismatch)
  • Unreadable objects (store errors, decryption failures)
  • Broken references (dangling pointers)
Run check periodically (e.g., after prune operations or before critical restores) to ensure your backup data is intact.
cloudstic check verifies repository integrity. For store configuration and credential/access validation, use cloudstic store verify.

Basic Usage

Check all snapshots:
Check a specific snapshot:

Terminal Output Examples

Successful Check (All Snapshots)

Successful Check (Single Snapshot)

Check with Errors

If check reports errors, your repository may have data loss or corruption. Investigate immediately and restore from a known-good backup if necessary.

Deep Check with Data Verification

Command Flags

boolean
default:"false"
Re-hash all chunk data to verify byte-level integrity. This performs a full read of every chunk object and compares the computed SHA-256 hash against the object key.
This is a deep verification mode that downloads and hashes all backup data. It can be slow and expensive on cloud storage backends (e.g., S3 egress charges). Use for critical integrity checks or suspected corruption.
string
default:""
Positional argument. Check only the specified snapshot reference. Accepts:
  • Full snapshot hash: abc123def456...
  • Short hash prefix: abc123
  • Snapshot ref format: snapshot/abc123def456...
If omitted, checks all snapshots in the repository.
boolean
default:"false"
Log detailed information about each object being verified. Shows the reference chain walk and individual object checks.

Global Flags

string
default:"local:./backup_store"
Storage backend URI. Formats: local:<path>, s3:<bucket>[/<prefix>], b2:<bucket>[/<prefix>], sftp://[user@]host[:port]/<path>.
string
default:""
Platform key (64 hex chars = 32 bytes).
string
default:""
Repository password for encrypted repositories.
string
default:""
24-word BIP39 recovery phrase.
string
default:""
AWS KMS key ARN for KMS-encrypted repositories.
boolean
default:"false"
Prompt for password interactively (use alongside -encryption-key or -kms-key-arn to add a password layer).
boolean
default:"false"
Suppress progress output (keeps final summary).
boolean
default:"false"
Write the command result as JSON to stdout. When set, check still exits with code 1 if integrity errors are found.
boolean
default:"false"
Log every store request (network calls, timing, sizes).

SFTP Store Credentials

string
default:""
SFTP store password.
string
default:""
Path to SSH private key for SFTP store authentication.
string
default:""
Path to custom known_hosts file for host key validation.
boolean
default:"false"
Skip host key validation (INSECURE).

Examples

Quick Integrity Check

Verifies reference chain integrity for all snapshots without reading chunk data.

Deep Byte-Level Verification

This downloads and hashes all backup data. On large repositories with cloud storage, expect significant network usage and egress charges.

Check Specific Snapshot

Check with Verbose Logging

Output:

Check Remote S3 Repository

Deep Check with Debug Logging

Logs all store operations (GET requests, timing, sizes) for troubleshooting network or storage issues.

How Check Works

Reference Chain Validation

cloudstic check validates the repository by walking the entire reference graph:
  1. Load index/latest: Resolve the latest snapshot pointer
  2. Load snapshot manifest: Parse snapshot metadata (timestamp, source, HAMT root)
  3. Walk HAMT tree: Traverse all internal and leaf nodes
  4. Verify filemeta: Check file metadata objects
  5. Verify content: Validate content manifests (chunk lists)
  6. Check chunk references: Ensure all chunks exist in the store
By default, check verifies that all referenced objects exist and have correct content-addressed hashes (object key matches SHA-256 of content). It does not re-read chunk data unless -read-data is specified.

Deep Verification Mode (-read-data)

When -read-data is enabled, check performs byte-level verification:
  1. Downloads each chunk/<hash> object
  2. Decrypts and decompresses the chunk data
  3. Computes SHA-256 hash of the plaintext
  4. Compares against the chunk reference hash
This detects:
  • Silent bit rot in storage
  • Decryption key mismatches
  • Decompression errors
  • Storage backend corruption
Deep verification on cloud storage can incur significant egress charges. A 500GB repository with 10,000 chunks will download ~500GB. Use sparingly and consider bandwidth/cost implications.

Error Types

Check reports three classes of errors:

Missing Objects

Cause: The object key is referenced but does not exist in the store. This indicates data loss (accidental deletion, incomplete upload, storage backend failure). Resolution: Restore from a backup of the repository itself, or accept data loss for affected files.

Corrupt Objects

Cause: The object exists but its SHA-256 hash does not match the key. This indicates corruption (bit rot, storage bug, incomplete write). Resolution: The object is irrecoverable. Prune the affected snapshot if possible, or restore from an earlier snapshot.

Unreadable Objects

Cause: The object could not be read due to a store error (network failure, permission denied) or decryption failure (wrong key, corrupted ciphertext). Resolution:
  • Verify encryption credentials are correct
  • Check network connectivity and storage backend health
  • Retry the check operation

Use Cases

Periodic Integrity Audits

Run check on a schedule (e.g., weekly) to detect corruption early:

Post-Prune Verification

After pruning unused chunks, verify no live data was accidentally deleted:

Pre-Restore Validation

Before a critical restore operation, ensure the target snapshot is intact:

Disaster Recovery Testing

Validate that an offsite backup repository is readable and complete:

Performance Considerations

Local Storage

  • Reference check: Fast (seconds to minutes for large repos)
  • Deep check (-read-data): Limited by disk I/O (~200-500 MB/s on SSD)

Cloud Storage (S3, B2)

  • Reference check: Moderate (depends on latency and object count; ~10-100 ms per object)
  • Deep check (-read-data): Slow and expensive
    • S3: ~$0.09/GB egress (AWS → internet)
    • B2: First 1GB/day free, then ~$0.01/GB
    • Bandwidth: Limited by connection speed and S3 rate limits
For large cloud repositories, run -read-data checks infrequently (e.g., quarterly) or only for specific snapshots.

Troubleshooting

Check reports errors but I can restore fine

Possible cause: Errors are in old snapshots or unreferenced objects. Resolution: Run cloudstic forget to remove old snapshots, then cloudstic prune to clean up unreferenced objects.

Check hangs or is very slow

Possible cause: Network latency, large HAMT tree, or many small objects. Resolution:
  • Use -verbose to see progress
  • Check network connectivity to storage backend
  • Packfiles are enabled by default and reduce object count; use -disable-packfile only if individual objects are required

Error: Failed to init store

Resolution: Verify storage backend credentials and connectivity. Check -store URI and backend-specific flags (e.g., -s3-endpoint).

Exit Codes

  • 0: Check succeeded, no errors found
  • 1: Check failed (errors detected, store initialization failed, or command error)