The Healing System is MinIO's automated mechanism for detecting and repairing data inconsistencies across distributed erasure-coded storage. It ensures data durability by:
This document covers the healing infrastructure, background healing processes, and manual healing operations. For information about the data scanner that triggers healing, see Data Scanner and Usage Calculation. For storage initialization and disk formatting, see Storage Initialization and Formatting.
Sources: cmd/global-heal.go1-595 cmd/data-scanner.go1-100 cmd/admin-heal-ops.go1-100
The healing system consists of several interconnected components that work together to maintain data integrity:
Healing System Architecture
Sources: cmd/global-heal.go43-75 cmd/admin-heal-ops.go92-103 cmd/background-newdisks-heal-ops.go40-101 cmd/background-heal-ops.go51-56
The background healing sequence (bgHealingUUID) is a special, long-running heal operation that continuously monitors and repairs the cluster:
Background Healing Sequence Structure
The background heal sequence is initialized with a special UUID (0000-0000-0000-0000) and runs continuously:
bgHealingUUID constant identifies this as the background sequencehealDeleteDangling = true removes objects without read quorumminioReservedBucket to avoid conflicts with user operationshasEnded() method always returns false for background healingSources: cmd/global-heal.go43-75 cmd/admin-heal-ops.go589-598
Healing operations are distributed across multiple worker goroutines for parallel execution:
Heal Worker Pool and Task Distribution
Worker count is determined by:
runtime.GOMAXPROCS(0) / 2_MINIO_HEAL_WORKERSSources: cmd/background-heal-ops.go51-175 cmd/admin-heal-ops.go407-503
When a disk is reformatted or newly added, the healingTracker maintains persistent state to resume interrupted healing:
Healing Tracker Persistence Structure
The tracker uses MessagePack encoding for efficient serialization and includes:
Sources: cmd/background-newdisks-heal-ops.go40-371
MinIO supports two healing scan modes with different bitrot detection strategies:
| Scan Mode | Description | Bitrot Detection | Use Case |
|---|---|---|---|
HealNormalScan | Fast metadata validation | Metadata checksums only | Regular background healing |
HealDeepScan | Full data verification | Read and verify all data blocks | Periodic deep scans, manual healing |
Scan Mode Selection Logic:
The data scanner automatically transitions between modes based on configuration and cycle count:
Scan Mode Decision Flow
Sources: cmd/data-scanner.go89-107 cmd/data-scanner.go949-973
Objects are selected for healing through multiple detection mechanisms:
Object Healing Detection Flow
The data scanner uses probabilistic selection for healing:
healObjectSelectProb (1024) objects selected per cyclethisHash.modAlt(cycle/divisor, probability) ensures deterministic selectionSources: cmd/data-scanner.go395-892 cmd/data-scanner.go506-507
When healing a complete erasure set (e.g., after adding a new disk), the process follows a structured workflow:
Erasure Set Healing Workflow
Key aspects of the healing process:
Worker Calculation: numHealers = min(numCores/4, NRRequests/4) with minimum of 4 and override via globalHealConfig.GetWorkers()
Lifecycle Filtering: Objects already expired by ILM rules are skipped to avoid unnecessary healing
Version Filtering: Objects uploaded after healing started are skipped (based on tracker.Started timestamp)
Progress Tracking: Results are collected via channel and periodically persisted to healingTracker
Sources: cmd/global-heal.go152-575 cmd/global-heal.go388-506
During healing operations, MinIO verifies data integrity and repairs corruption:
Bitrot Detection and Repair Process
Healing modes and their verification depth:
heal.bitrot = false): Validates metadata checksums only, fast but less thoroughheal.bitrot = true): Reads all data blocks and verifies HighwayHash checksums, slower but comprehensiveThe healDeleteDangling flag (set to true) removes objects that cannot achieve read quorum, preventing orphaned metadata from accumulating.
Sources: cmd/data-scanner.go952-973 cmd/global-heal.go422-463
The data scanner is the primary driver of background healing, integrating healing checks into its regular traversal:
Data Scanner Healing Integration
The scanner maintains healing state across restarts:
backgroundHealInfoPath in .minio.sys/configSources: cmd/data-scanner.go152-232 cmd/data-scanner.go676-839
Each heal sequence progresses through distinct states:
Heal Sequence State Transitions
State durations and timeouts:
keepHealSeqStateDuration = 10 minutes - results retained after completionhealUnconsumedTimeout = 24 hours - aborts if results not consumedmaxUnconsumedHealResultItems = 1000 - blocks new results when fullSources: cmd/admin-heal-ops.go36-64 cmd/admin-heal-ops.go589-603
The global heal state manages all active and completed heal sequences:
Global Heal State Structure
The heal state prevents conflicting operations through path validation:
bgHealingUUID sequence never ends and can coexist with manual sequencesSources: cmd/admin-heal-ops.go92-355
MinIO automatically detects and heals newly added or reformatted disks:
Automatic Disk Healing Workflow
The monitoring loop runs continuously when _MINIO_AUTO_DRIVE_HEALING=on:
defaultMonitorNewDiskInterval = 10 secondsSources: cmd/background-newdisks-heal-ops.go373-535 cmd/background-newdisks-heal-ops.go389-409
Healing operations use distributed locks to prevent conflicts:
Distributed Lock for Healing Coordination
The dynamic timeout prevents healing conflicts:
Sources: cmd/background-newdisks-heal-ops.go411-442
MinIO provides several configuration parameters for healing behavior:
| Configuration | Environment Variable | Default | Description |
|---|---|---|---|
| Heal Workers | _MINIO_HEAL_WORKERS | runtime.GOMAXPROCS(0) / 2 | Number of parallel heal workers |
| Auto Drive Healing | _MINIO_AUTO_DRIVE_HEALING | on | Enable automatic new disk healing |
| Bitrot Scan Cycle | heal.bitrotscan | (varies) | Frequency of deep bitrot scans |
| Max IO | heal.max_io | 100 | Max concurrent operations during healing |
| Max Wait | heal.max_wait | 15 seconds | Max wait for low IO before proceeding |
Heal Configuration Structure:
Healing Configuration Hierarchy
Sources: cmd/data-scanner.go62-72 cmd/background-heal-ops.go97-100 cmd/background-heal-ops.go156-170
Healing operations throttle themselves based on cluster load:
Wait for Low IO Logic
The throttling mechanism:
maxIOmaxWait duration, healing proceeds regardless of IO levelSources: cmd/background-heal-ops.go57-100
Administrators can start, monitor, and stop healing operations via the Admin API:
Admin Heal API Structure
The heal result items contain detailed before/after drive states:
Sources: cmd/admin-heal-ops.go287-355 cmd/admin-heal-ops.go357-405
The background healing status is exposed through the storage info API:
Background Heal Status Response Structure
The status includes:
Sources: cmd/global-heal.go78-141
The MinIO Healing System provides comprehensive automated and manual data repair capabilities:
Key Components:
Healing Strategies:
Operational Controls:
The healing system ensures data durability in MinIO's distributed erasure-coded architecture by continuously monitoring for and repairing data inconsistencies, corruption, and missing shards across the cluster.
Sources: cmd/global-heal.go1-595 cmd/data-scanner.go1-893 cmd/admin-heal-ops.go1-665 cmd/background-newdisks-heal-ops.go1-535
Refresh this wiki