To ensure the best durability of your data and fix any inconsistencies that may arise in a distributed system, Garage provides a series of repair operations. This guide explains each operation and when to use them.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/deuxfleurs-org/garage/llms.txt
Use this file to discover all available pages before exploring further.
General Syntax
Repair operations follow this format:Data Block Operations
Data Store Scrub
Scrubbing examines each individual data block to verify correctness by checking hashes. Corrupted blocks (from bitrot or accidental datastore manipulation) are restored from nodes with valid copies. Automatic scheduling: Garage automatically schedules scrubs every 25-35 days (randomized to spread load). View the next scheduled scrub:-
Find the scrub worker task ID:
-
View detailed statistics:
Scrubs automatically resume after 24 hours. Garage will not let your cluster run indefinitely without regular scrubs.
Block Check and Resync
Fixes cases where:- Nodes reference blocks that don’t exist on disk
- Nodes have on-disk blocks that are no longer referenced
Recommended: Run this after changing cluster layout, once metadata tables have synchronized (usually a few hours after
garage layout apply).Inspecting Lost Blocks
In rare situations, data blocks may be unavailable from the entire cluster. These errors are stored in a “block resync errors” list. List blocks with resync errors:- Metadata inconsistency: Block still referenced but object was deleted
- Transient error: Block couldn’t be fetched due to temporary issue (network failure)
- Permanent loss: Block not available anywhere in the cluster
Rebalancing Data Directories
In multi-HDD setups, ensure data blocks are balanced between storage locations:- After adding storage locations
- After changing storage location capacities
- To move data out of read-only locations
Metadata Operations
Metadata Snapshotting
It’s good practice to set up automatic snapshotting of your metadata database file to recover from corruption.
metadata_auto_snapshot_interval in your configuration file:
Taking a snapshot is intensive as it requires a full copy of the database file. Consider using filesystem-level snapshots (ZFS, BTRFS) if available.
Metadata Table Resync
Garage automatically resyncs metadata tables hourly using Merkle trees to efficiently find differences between nodes. Manual table resync:Metadata Table Reference Fixes
In rare cases where nodes are unavailable, references between objects may break (e.g., deleted objects may still have underlying versions or data blocks). Fix orphan versions:Complete Repair List
Here’s a summary of all available repair operations:| Command | Description | Run After |
|---|---|---|
scrub start | Verify integrity of all blocks | Automatic |
blocks | Resync block references and files | Layout changes |
tables | Full sync of metadata tables | Before upgrades |
versions | Fix orphan versions | Suspected corruption |
block-refs | Fix orphan block references | Suspected corruption |
block-rc | Recalculate block reference counters | Suspected corruption |
rebalance | Balance blocks across HDDs | Multi-HDD changes |
Best Practices
- Run
garage repair tablesbefore major operations or upgrades - Monitor scrub operations - they should complete successfully
- Investigate non-zero
block_resync_errored_blocksmetrics immediately - Snapshot metadata regularly using automatic snapshots or filesystem features
- Run
garage repair blocksafter layout changes - Test repairs on non-production clusters first