Skip to main content
RunBook Academy

Proxmox VEVIII · CephCeph operations

Ceph day-2: OSD replacement, scrubbing, recovery

Advanced⏱ ~18 min

What you'll learn

  • Replace a failed OSD safely
  • Schedule and monitor scrubs
  • Investigate slow recovery or rebalancing
  • Manage the cluster through node failures

Prerequisites

Verified against Proxmox VE 9.2.4 · Proxmox Backup Server 4.2.5 · Ceph Squid / Tentacle · Debian 13 (Trixie) · Linux kernel 7.0 (PVE 9.2 default) · 2026-08-12

Not yet marked complete on this device.

Why this matters in production

A Ceph cluster that handles routine operations well but falls apart during a failure is not production-ready. This lesson covers the day-2 procedures: how to replace an OSD, schedule scrubs, watch rebalancing, and recover from a node failure.

OSD replacement

When an OSD fails:

ceph osd tree
...
 osd.5  down  1.0  host pve-01
flowchart LR
  A[OSD 5 fails] --> B[CRUSH marks it down]
  B --> C[PGs enter degraded]
  C --> D[Recovery copies data from surviving OSDs]
  D --> E[OSD replaced, PG returns to active+clean]

The replacement procedure:

Service impact possible1. mark the OSD out
OSD=5
ceph osd out "$OSD"
ceph -s

2. Wait for the rebalance. Do not proceed while placement groups are still recovering. Removing the OSD mid-rebuild takes the affected PGs to one fewer copy than the recovery is already working with.

Read-only / Safewait for clean before continuing
while ceph pg stat | grep -qE 'degraded|undersized|recovering|backfill'; do
ceph pg stat
sleep 30
done
Destructive3. destroy the OSD
OSD=5
pveceph osd destroy "$OSD" --cleanup 1
ceph osd tree

4. Physically replace the disk (or hot-swap if supported).

Destructive5. create a new OSD on the new disk
DEV=/dev/sdX

lsblk -o NAME,SIZE,SERIAL,MODEL "$DEV"
ceph-volume lvm zap "$DEV" --destroy

pveceph osd create "$DEV" --crush-device-class ssd
ceph osd tree

Scrubbing

Ceph scrubs verify data integrity by reading every object and comparing checksums. There are two kinds:

  • Scrub: read metadata + data, lightweight checksum verification.
  • Deep scrub: read all data, full byte-level comparison. Catches silent corruption.

Schedule both regularly:

ceph osd pool set vm-storage scrub_min_interval 86400
ceph osd pool set vm-storage deep_scrub_interval 604800

This scrubs the pool daily, with a deep scrub weekly.

Recovery and backfill

When an OSD or node fails, Ceph recovers data from surviving OSDs:

ceph -s
...
  recovery: 1234/3000 objects degraded (41%)
  recovery: 5678/3000 objects misplaced (189%)
  • Degraded: fewer than size copies exist for some objects. Self-healing in progress.
  • Misplaced: copies exist but on the wrong OSDs (e.g., after CRUSH rule change). Rebalancing in progress.

Recovery uses osd_recovery_max_active and osd_recovery_sleep to throttle I/O. On a busy cluster, increase recovery throughput by raising the active count; on a slow cluster, reduce it to avoid impacting workloads.

ceph config set osd osd_recovery_max_active 5
ceph config set osd osd_recovery_sleep 0

Investigating slow recovery

Common causes:

CauseSymptomFix
Network bottleneckRecovery throughput much less than link capacityUpgrade NICs; isolate Ceph network
Disk bottleneckHigh await on OSDsReplace slow disks
PG count too lowFew PGs to work in parallelIncrease PG count (with autoscaler)
Heavy foreground loadRecovery competes with VM I/OThrottle recovery
Cluster overcommittednearfull on OSDsAdd capacity

Node failure

When an entire node fails:

  1. Identify the impact: which MONs, MGRs, OSDs are down.
  2. Confirm the failure is real (network blip vs hardware failure).
  3. Wait for automatic recovery if the failure is transient. Ceph recovers from surviving OSDs.
  4. Replace the failed node if the failure is permanent.

After a node returns:

  • OSDs come back up; PGs re-peer.
  • If the OSDs were out long enough to trigger rebalancing, PGs may already be on other OSDs. Ceph reconciles.
ceph -s && ceph osd tree && ceph pg stat

A break/fix exercise

Break/Fixadvanced25 minceph

OSD replacement triggers cascade of warnings

Symptoms

  • After replacing OSD 7, HEALTH_WARN persists
  • ceph osd tree shows OSD 7 up but 'exists' flag missing
  • Recovery is stalled

Available evidence

  • ceph -s shows 'recovery: stalled'
  • ceph health detail says '1 OSDs are not in the crush map'
  • ceph osd tree shows the OSD outside any host bucket
Show diagnosis & remediation

Root cause

When the OSD was destroyed with ceph osd purge without first removing it from CRUSH, the OSD ID lingers outside the cluster map. Recovery cannot proceed.

Safe remediation

Re-add the OSD to CRUSH with a weight matching its capacity in TiB, for example: ceph osd crush create-or-move osd.7 3.64 host=pve-01 for a 4 TB device. Read the weights of the sibling OSDs from ceph osd tree and match them. Verify CRUSH placement; recovery resumes.

Verification

ceph -s shows recovery progressing. ceph osd tree shows the OSD inside the host bucket. HEALTH_OK once recovery completes.

Prevention

Always use the Proxmox GUI or pveceph osd destroy command, which handles CRUSH removal atomically. Avoid bare ceph osd purge unless you know the implications.

Production considerations

Common mistakes

  • Skipping the “out + wait + stop + destroy” sequence.
  • Setting noout before an OSD replacement. It suppresses exactly the rebalance you need, and the cluster sits degraded for the length of the RMA.
  • Leaving noout set after a planned reboot. A genuine disk failure then never triggers a rebuild.
  • Replacing multiple OSDs simultaneously (slows recovery dramatically).
  • Not testing deep scrub completion.

Key takeaways

  • OSD replacement follows out → wait for clean → destroy → create.
  • Use pveceph osd destroy, which removes the CRUSH and auth entries together; a bare ceph osd purge can leave the ID stranded.
  • noout is for planned downtime where the OSDs are coming back. It is the wrong flag for a replacement, and ceph osd stat shows what is set.
  • Schedule scrubs; use deep scrubs for integrity verification.
  • Throttle recovery to balance speed against load.

Knowledge check

Knowledge check · 4 questions

  1. Q1. Which sequence correctly replaces a failed OSD?

  2. Q2. Deep scrub is optional in Ceph.

  3. Q3. What is the difference between degraded and misplaced PGs?

  4. Q4. An OSD has failed and its disk is out for RMA. An operator has set noout so that "the cluster does not thrash". A week later the pool is still degraded. Which statements are correct? Select all that apply.

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