Skip to main content
RunBook Academy

CephLXII · Inconsistent PGsInconsistent PGs

Preventing inconsistencies

Intermediate⏱ ~17 mincephsmartctl

What you'll learn

  • Monitor device health proactively
  • Set replacement thresholds before failures
  • Choose configuration that limits exposure
  • Build a device lifecycle practice

Prerequisites

None — start here.

Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18

Not yet marked complete on this device.

Why this matters in production

Most inconsistencies are produced by devices that gave warning first. The warning is available and is usually not being watched.

Ceph’s device monitoring

DEVICE_ID=12
ceph device ls
ceph device ls-by-host ceph-osd-03
ceph device get-health-metrics ${DEVICE_ID}
ceph device predict-life-expectancy ${DEVICE_ID}
# enable collection
ceph config set mgr mgr/devicehealth/enable_monitoring true
ceph config set mgr mgr/devicehealth/scrape_frequency 86400

With monitoring enabled, Ceph collects SMART data daily and raises a health warning when a device is predicted to fail:

ceph health detail | grep -i DEVICE_HEALTH
CheckMeaning
DEVICE_HEALTHa device is predicted to fail soon
DEVICE_HEALTH_IN_USEsuch a device is still in use
DEVICE_HEALTH_TOOMANYtoo many are predicted to fail to replace safely

Replacement thresholds

Waiting for a device to fail means accepting the inconsistencies it produces on the way. Useful thresholds:

MetricThreshold
Reallocated sectorsany increase from the baseline
Current pending sectorsany non-zero value
Offline uncorrectableany non-zero value
NVMe media errorsany increase
NVMe percentage usedabove 90
Read error rate trendrising over successive samples
for h in $(ceph orch host ls --format json | python3 -c 'import sys,json; [print(x["hostname"]) for x in json.load(sys.stdin)]'); do
  echo "== $h"
  ceph device ls-by-host "$h"
done

The threshold that matters most is any pending sectors: a pending sector is a block the device could not read and has not yet been able to reallocate, which is precisely the condition that produces a read_error on the next scrub.

Configuration that limits exposure

ChoiceEffect
size=3 rather than size=2a majority exists for every repair decision
Deep scrub on schedulecorruption found early, in less data
osd_scrub_auto_repair for unambiguous casesreduces exposure window
ECC memory on OSD hostsremoves a class of silent corruption
Device health monitoring enabledfailing devices found before they corrupt
ceph config set osd osd_scrub_auto_repair true
ceph config set osd osd_scrub_auto_repair_num_errors 5

osd_scrub_auto_repair repairs automatically when the error count is below the threshold, which covers the routine single-object read error while still surfacing anything larger for a human.

A device lifecycle practice

1. record the SMART baseline at deployment
2. collect daily via ceph device
3. alert on any pending or reallocated sector increase
4. drain and replace on the alert, not on failure
5. record the device's service life for the fleet model

The fourth step is the one with the return: a device drained on a warning produces no inconsistencies at all.

Quiz

Knowledge check · 4 questions

  1. Q1. Why is any non-zero current pending sector count a replacement trigger?

  2. Q2. `osd_scrub_auto_repair` is a boolean because automatic repair is either safe or unsafe.

  3. Q3. Build a device lifecycle practice.

    A 200-OSD cluster has had four inconsistency events in six months, each traced to a device that had shown pending sectors for weeks. Device health monitoring has never been enabled.

  4. Q4. Name three configuration choices that reduce exposure to inconsistencies.

Passing score: 75%. Answers are checked in this browser.

Production discipline

Enable mgr/devicehealth monitoring and alert on any increase in pending or reallocated sectors, then drain on the alert rather than on failure — a device drained on a warning produces no inconsistencies at all. Prefer size=3 over size=2 so every repair decision has a majority.

Cross-course references

  • Kubernetes: node problem detector draining before failure is the same practice
  • Linux: SMART-triggered proactive replacement is standard fleet discipline