Skip to main content
RunBook Academy

CephXV · CRUSH Maps and RulesCRUSH Maps and Rules

Rule and weight changes that move data — planning the whole event

Advanced⏱ ~17 mincephosdmaptool

What you'll learn

  • Enumerate the operations that cause data movement
  • Estimate movement volume before acting
  • Sequence multiple changes to minimise total movement
  • Monitor a movement event to completion

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

Data movement is the most consequential thing an operator can trigger deliberately. It is also entirely predictable, and treating each of these operations as a planned event rather than a command is what separates smooth clusters from ones that are perpetually rebalancing.

What causes movement

OperationTypical volume
Adding OSDsproportional to capacity added
Removing OSDsproportional to capacity removed
crush reweightproportional to the weight delta
Changing a pool’s crush_rulelarge — every PG recomputes
Changing failure domainlarge
Changing device class of OSDslarge for those OSDs’ pools
Adding a bucket levellarge — every walk changes
Changing tunableslarge
Raising pg_nummetadata split, then movement as pgp_num follows
Enabling the balancersmall, ongoing
Setting osds_per_device (recreate)per device, drain and refill

Estimating before acting

ceph osd getmap -o /tmp/before.bin
osdmaptool /tmp/before.bin --test-map-pgs-dump --pool 7 > /tmp/before.txt

# apply the change to a copy of the map, then
osdmaptool /tmp/after.bin --test-map-pgs-dump --pool 7 > /tmp/after.txt
diff /tmp/before.txt /tmp/after.txt | grep -c '^<'

The count of changed mappings against the total PG count is the fraction of the pool that will move. This takes minutes and turns “probably fine” into a number.

Pacing

ceph config set osd osd_max_backfills 1
ceph config set osd osd_recovery_max_active 2
ceph config set osd osd_recovery_sleep 0.1
ceph config set osd osd_recovery_op_priority 1

Set these before applying the change. Setting them after complaints arrive means the first hour ran unthrottled.

Because a rebalance keeps full redundancy, throttling it hard is a safe trade — unlike throttling a recovery, which extends a period of reduced redundancy.

Monitoring to completion

watch -n 30 'ceph -s | grep -E "objects (misplaced|degraded)|recovery"'
ceph osd pool stats
ceph pg dump_stuck

Watch the counts of misplaced objects fall, not the percentage — the percentage moves as the denominator changes and can appear to stall or reverse.

Completion is active+clean for every PG:

ceph pg stat
# e.g. "4096 pgs: 4096 active+clean"

The event checklist

  1. Estimate the movement.
  2. Confirm the cluster is healthy and active+clean.
  3. Set throttles.
  4. Capture rollback state: CRUSH map, pool rule assignments.
  5. Apply.
  6. Monitor counts to zero.
  7. Restore throttles.

Quiz

Knowledge check · 4 questions

  1. Q1. A rebalance is 96% complete and has slowed dramatically. ceph pg dump shows many PGs in backfill_wait and few backfilling. What does this indicate?

  2. Q2. Recovery throttles should be set before applying a change that causes data movement, not after client impact appears.

  3. Q3. A cluster needs three changes: correcting 12 wrong OSD weights, adding a rack bucket level, and changing the pool failure domain to rack. Sequence them.

    96-OSD cluster, 4 racks, 500 TB stored. Twelve OSDs carry weights for the wrong device size. The CRUSH map has no rack level. The pool must end up with rack-level separation. Clients are active. The team wants minimal total data movement and a clear rollback at each stage.

  4. Q4. Give the checklist for a planned data-movement event.

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

Production discipline

Treat every one of these operations as a planned event: estimate the movement with osdmaptool, confirm active+clean first, set throttles before applying rather than after complaints, capture rollback state, and watch the misplaced object count rather than the percentage. Sequence changes so topology precedes rules and related edits are batched, since separate applications move overlapping data repeatedly. And read a slow tail as reservation queuing rather than a stall — the backfill_wait count confirms it and raising osd_max_backfills is safe by then.

Cross-course references

  • Ceph: Part LIX (Backfill) for the mechanism.
  • Ceph: Part LX (Recovery Tuning) for the throttle settings.
  • Ceph: Part XCIII (Changing CRUSH Topology) for the live procedure.