Skip to main content
RunBook Academy

CephXX · PG PeeringPG Peering

Peering after an OSD restart

Intermediate⏱ ~15 mincephcephadm

What you'll learn

  • Trace the sequence from OSD restart to active+clean
  • Explain why a brief absence produces recovery rather than backfill
  • Estimate the cost of a rolling restart
  • Plan restarts to minimise disruption

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

OSD restarts happen for upgrades, configuration changes, and troubleshooting. Understanding what they cost makes rolling maintenance predictable.

The sequence

t+0     OSD stops; peers notice heartbeat loss
t+20s   peers report; monitors mark it down
        → its PGs go active+undersized+degraded, still serving
t+30s   OSD restarts, loads its PGs, rejoins
        → affected PGs go peering briefly
t+35s   peering completes; recovery of missed operations begins
t+~1m   active+clean

The OSD is never marked out, because that takes 600 seconds by default. So no re-replication occurs — only the writes it missed are copied back.

ceph orch daemon restart osd.12
watch -n 5 'ceph -s | grep -E "degraded|recovering"'

Why it is cheap

The PG log covers the gap. Peering compares logs, identifies exactly which operations osd.12 missed during its 30 seconds away, and recovery copies only those.

30 seconds of writes at 100 ops/s = 3000 operations
osd_max_pg_log_entries = 10000    → comfortably covered

Compare with backfill, which would copy the OSD’s entire contents.

Rolling restarts

For a fleet-wide restart — a configuration change, a version upgrade:

ceph osd set noout
for h in ceph-01 ceph-02 ceph-03; do
  ceph orch daemon restart osd --host $h        # or per-OSD
  while ! ceph pg stat | grep -q '^.*active+clean$'; do sleep 10; done
done
ceph osd unset noout

The gating condition — waiting for active+clean between hosts — is what keeps degradation from overlapping. Restarting two hosts simultaneously on a size 3 pool with a host failure domain can take PGs below min_size.

Verifying

ceph -s
ceph pg stat
ceph osd tree | grep -w osd.12
cephadm logs --name osd.12 --since 10m | tail -20

Quiz

Knowledge check · 4 questions

  1. Q1. An OSD is restarted and returns in 30 seconds. What data movement follows?

  2. Q2. The PG log window is measured against cluster-wide write rate.

  3. Q3. Plan a rolling restart of all OSDs across 12 hosts for a configuration change.

    12 hosts with 8 OSDs each, 96 OSDs total. Pool size 3, min_size 2, host failure domain. Cluster serves 200 VMs continuously. The change requires every OSD daemon to restart. Estimated restart time per host is two to three minutes. Write rate is moderate and steady.

  4. Q4. Explain why noout should be set before a planned OSD restart even when the restart is expected to be brief.

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

Production discipline

Set noout before any planned OSD or host stop, because the down-out timer cannot be set retroactively and a brief restart occasionally becomes a long one. Gate rolling restarts on active+clean between hosts rather than on a timer, since that is what prevents degradation overlapping and taking PGs below min_size. And expect busy PGs to fall out of the log window on restarts of more than a minute or two — that produces backfill and is normal rather than a fault.

Cross-course references

  • Ceph: Part XCVI (Node Maintenance) for the full procedure.
  • Ceph: Part LVIII (Recovery) for what recovery copies.
  • Ceph: Part XCV (Maintenance Flags) for noout and relatives.