Skip to main content
RunBook Academy

CephLV · OSD StatesOSD States

The lifecycle of an OSD through its states

Intermediate⏱ ~17 minceph

What you'll learn

  • Trace an OSD through its full lifecycle
  • Identify the command driving each transition
  • Predict the cost of each transition
  • Recognise where a lifecycle has stalled

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

Every OSD passes through the same sequence, and knowing which transition you are performing — and what it costs — is what distinguishes a planned operation from an improvised one.

The lifecycle

graph TD
    A[device available] -->|orch apply osd| B[up / in - filling]
    B -->|backfill completes| C[up / in - steady]
    C -->|daemon fails| D[down / in]
    D -->|restart| C
    D -->|down-out interval| E[down / out]
    C -->|ceph osd out| F[up / out - draining]
    F -->|ceph osd in| C
    F -->|drain completes, stop daemon| E
    E -->|ceph osd purge| G[removed]
    E -->|start daemon, ceph osd in| C

Each transition

TransitionCommandCost
Created → up/inceph orch apply osdbackfill in, hours
up/in → down/infailure, or systemctl stopnone
down/in → up/insystemctl startrecovery of the gap
down/in → down/outtimer, or ceph osd outfull rebalance
up/in → up/outceph osd outfull rebalance
up/out → up/inceph osd infull rebalance back
down/out → removedceph osd purgeCRUSH weight change, further rebalance

Two costs are worth noting. down/in → up/in costs only the recovery of what changed during the absence, which is why a quick restart is cheap. And purge changes the CRUSH bucket weight, producing movement beyond what marking out already caused.

The planned retirement sequence

# 1. exclude from placement, daemon still serving
ceph osd out 13

# 2. wait for the drain
ceph -s
ceph osd safe-to-destroy 13

# 3. stop the daemon
ceph orch daemon stop osd.13

# 4. remove from the cluster
ceph osd purge 13 --yes-i-really-mean-it

ceph osd safe-to-destroy is the check that makes step 3 safe — it confirms no PG depends on this OSD’s data.

ceph osd safe-to-destroy 13
# OSD(s) 13 are safe to destroy without reducing data durability.

Where lifecycles stall

StallCause
Stuck fillingbackfill blocked; check backfill_toofull
Stuck in up/outdrain not completing; check recovery progress
down/out but not purgedforgotten cleanup, holds a CRUSH entry
Purged but device not zappeddevice unavailable for reuse
# OSD map entries with no daemon
ceph osd tree | grep -E 'destroyed|down'
ceph orch ps --daemon-type osd

Comparing the OSD map against running daemons finds the entries left behind by an incomplete retirement.

Quiz

Knowledge check · 4 questions

  1. Q1. Why does purging an OSD cause data movement beyond what marking it out already caused?

  2. Q2. `ceph osd safe-to-destroy` should be checked before stopping a draining OSD.

  3. Q3. Retire several OSDs from a host.

    Six OSDs on one host must be retired as their devices are being replaced with larger ones. The cluster has capacity and time.

  4. Q4. Why is a quick OSD restart much cheaper than the OSD being marked out and back in?

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

Production discipline

Batch OSD retirements from the same host rather than processing them individually; the drain and the weight-change rebalance are each paid once for the group instead of once per OSD. Check safe-to-destroy before stopping any draining OSD — it is the confirmation that the drain achieved its purpose.

Cross-course references

  • Kubernetes: batching node removals reduces the number of rescheduling waves the same way
  • Linux: a documented lifecycle per component is what keeps retirements from leaving residue