Proxmox VEVIII · CephCeph operations
Ceph day-2: OSD replacement, scrubbing, recovery
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
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:
OSD=5
ceph osd out "$OSD"
ceph -s2. 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.
while ceph pg stat | grep -qE 'degraded|undersized|recovering|backfill'; do
ceph pg stat
sleep 30
doneOSD=5
pveceph osd destroy "$OSD" --cleanup 1
ceph osd tree4. Physically replace the disk (or hot-swap if supported).
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 treeScrubbing
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
sizecopies 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:
| Cause | Symptom | Fix |
|---|---|---|
| Network bottleneck | Recovery throughput much less than link capacity | Upgrade NICs; isolate Ceph network |
| Disk bottleneck | High await on OSDs | Replace slow disks |
| PG count too low | Few PGs to work in parallel | Increase PG count (with autoscaler) |
| Heavy foreground load | Recovery competes with VM I/O | Throttle recovery |
| Cluster overcommitted | nearfull on OSDs | Add capacity |
Node failure
When an entire node fails:
- Identify the impact: which MONs, MGRs, OSDs are down.
- Confirm the failure is real (network blip vs hardware failure).
- Wait for automatic recovery if the failure is transient. Ceph recovers from surviving OSDs.
- 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
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
nooutbefore an OSD replacement. It suppresses exactly the rebalance you need, and the cluster sits degraded for the length of the RMA. - Leaving
nooutset 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 bareceph osd purgecan leave the ID stranded. nooutis for planned downtime where the OSDs are coming back. It is the wrong flag for a replacement, andceph osd statshows what is set.- Schedule scrubs; use deep scrubs for integrity verification.
- Throttle recovery to balance speed against load.
Knowledge check
Knowledge check · 4 questions
Q1. Which sequence correctly replaces a failed OSD?
Q2. Deep scrub is optional in Ceph.
Q3. What is the difference between degraded and misplaced PGs?
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.