




















The repair PG state indicates that Ceph is actively fixing object inconsistencies found during a scrub. It is a short-lived transitional state that follows the detection of an inconsistent PG.
When ceph pg repair <pg-id> is called, or when Ceph automatically repairs during a scrub (if osd_scrub_auto_repair is enabled), the PG enters the repair state. During repair:
repair stateRepair is triggered manually or automatically:
# Manual repair
ceph pg repair <pg-id>
# Repair all inconsistent PGs in a pool
for pg in $(ceph pg dump | grep inconsistent | awk '{print $1}'); do
ceph pg repair $pg
doneEnable automatic repair:
ceph config set osd osd_scrub_auto_repair true
ceph config set osd osd_scrub_auto_repair_num_errors 5 # max errors to auto-repairceph pg stat | grep repair
# Watch the repair state clear
watch 'ceph health detail | grep -E "inconsistent|repair"'For a specific PG:
ceph pg <pg-id> query | jq '.state'The repair state should clear within minutes for small PGs.
Ceph uses the primary OSD's copy as authoritative in most cases. The decision is based on:
You can inspect the decision:
ceph pg <pg-id> query | jq '.peer_info'After successful repair:
ceph health detail
# No more inconsistent PG messages
ceph pg dump | grep <pg-id>
# State should show active+cleanConfirm the fix with another scrub:
ceph pg deep-scrub <pg-id>If repair does not clear the inconsistency:
ceph health detail | grep "inconsistent"Possible causes:
In this case:
# Identify which objects are still inconsistent
rados list-inconsistent-obj <pg-id>
# If all copies are bad, the object may be unrecoverable
# Remove the corrupt object as a last resort
rados -p <pool-name> rm <object-name>When osd_scrub_auto_repair is enabled, repair happens inline during the scrub cycle. The PG will show scrubbing+repair or scrubbing+deep+repair:
ceph pg dump | grep "scrubbing"The repair PG state is a positive indicator: Ceph has found inconsistencies and is actively correcting them. Repair is triggered manually via ceph pg repair or automatically via osd_scrub_auto_repair. Monitor its completion with ceph health detail and follow up with a deep scrub to verify the repair was successful. Persistent repair failures indicate hardware issues requiring physical inspection.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。