Overview
Thecloudstic prune command removes unreachable objects from the repository using mark-and-sweep garbage collection. After deleting snapshots with forget, their associated chunks, content manifests, and metadata become unreachable. Prune identifies and deletes these orphaned objects to reclaim storage space.
Usage
How It Works
Prune operates in two phases:-
Mark Phase — Walks all existing snapshots and marks reachable objects:
- Snapshot objects (
snapshot/*) - HAMT tree nodes (
node/*) - File metadata (
filemeta/*) - Content manifests (
content/*) - Data chunks (
chunk/*)
- Snapshot objects (
- Sweep Phase — Scans all objects in the repository and deletes those not marked as reachable.
Options
Show what would be deleted without actually deleting anything. Useful for previewing the impact before running prune.Default:
falseLog each object as it’s processed. Shows every deleted object key during the sweep phase.Default:
falseGlobal Options
-store,-store-path— Storage backend configuration-encryption-password,-encryption-key— Repository credentials-quiet— Suppress progress bars-debug— Log every store request
Output
Prune displays:- Objects scanned — Total number of objects examined
- Objects deleted — Number of unreachable objects removed
- Space reclaimed — Total storage space freed (actual prune only)
Example Output (Dry Run)
Example Output (Actual Prune)
Examples
Preview what will be pruned
Prune and see details
Prune with local store
Prune with S3 backend
When to Run Prune
Prune should be run after using
forget to remove snapshots. Deleting snapshots with forget does not immediately free storage — it only removes the snapshot objects themselves. The actual data chunks remain until prune performs garbage collection.-
Remove old snapshots:
-
Reclaim storage:
forget with the -prune flag to automatically prune after forgetting:
Difference Between Prune and Forget
| Command | Purpose | What It Deletes |
|---|---|---|
| forget | Remove specific snapshots from history | Snapshot objects only (snapshot/*) |
| prune | Reclaim storage from unreachable data | Orphaned chunks, content, metadata, and HAMT nodes |
forget makes data unreachable by removing the snapshot references. prune then reclaims storage by deleting the unreachable data.
Performance Considerations
- Mark phase complexity scales with the number of snapshots and files
- Sweep phase must scan all objects with specific prefixes (
chunk/,content/,filemeta/,node/,snapshot/) - For large repositories, prune can take several minutes to complete
- The operation acquires an exclusive lock on the repository
- Use
-dry-runfirst to estimate the impact
Repository Lock: Prune acquires an exclusive lock to prevent concurrent modifications. Other operations (backup, restore, list) will wait until prune completes.
Packfile Repacking
When packfile storage is enabled (default for S3/B2 backends), prune automatically repacks fragmented packfiles:- Any packfile that is more than 30% empty is consolidated
- Small objects (less than 512KB) are bundled into 8MB packfiles to reduce API calls
- Repacking reclaims additional space and improves performance
- The repacking phase runs after sweep completes
Advanced Usage
Prune specific store with debug logging
Dry run with verbose output
Error Handling
Repository locked
If another operation is running:break-lock if you’re certain no operations are running.
Missing objects during mark phase
If prune encounters missing objects referenced by snapshots:cloudstic check to diagnose integrity issues.
Related Commands
forget— Remove specific snapshots from historycheck— Verify repository integritylist— List all snapshots to see what would be preserved
See Also
- Retention Policies — Automate snapshot cleanup
- Storage Backends — Configure where data is stored
- Repository Maintenance — Best practices for long-term repository health