Replace a Ceph OSD disk¶
How to swap the SATA OSD disk of one mc node, as done for mc3 on 2026-12-02 (worn Crucial MX500 500 GB to a used Samsung PM883 960 GB).
mc1 and mc2 follow the same way when their disks are bought (.plans/TODO.md, SATA OSD item). The full run with every result is archived in
.archive/.plans/mc3-osd-replacement/ (history; check the live state first).
Every cluster command below changes runtime state and needs the owner's consent in the session, per action (AGENTS.md, Permissions and
Consent). Ceph exec beyond status, health detail, df, osd perf, osd tree and config get counts as a mutation.
Facts that shape the procedure¶
| Node | IP | OSD |
|---|---|---|
| mc1 | 192.168.48.2 | osd.1 |
| mc2 | 192.168.48.3 | osd.0 |
| mc3 | 192.168.48.4 | osd.2 |
Check the mapping before starting: ceph osd tree (the OSD under the host).
- No drain of data first. Three hosts, pools
size 3,failureDomain: host: there is nowhere to move the copies. From the shutdown until backfill ends the cluster runs on 2 copies (readable and writable atmin_size2). A second disk failure in that window stops I/O on the affected PGs. - Rook only takes disks its filter names.
devicePathFilterincluster/apps/core/rook-ceph/cluster/values.yamllists disk models by their/dev/disk/by-id/ata-<model>_<serial>prefix, not serials. A new model needs a PR before it can become an OSD. The suffix matters:MZ7LH960HAJR-00005is listed; another suffix or a Dell/HPE variant is not. Ask the seller for the full model number. - Swap first, purge after. Until
ceph osd purge, putting the old disk back restores the OSD as it was. The purge is the point of no return, so it comes only after the new disk is checked in the node. - Merge the filter PR only after the purge and the uncordon, so the prepare job runs on a clean disk on a schedulable node.
SATAWearHighreads both models: attribute 202Percent_Lifetime_Remain(MX500) and 177Wear_Leveling_Count(PM883), normalized value = % life left. A new model with another wear attribute needs the rule and its test (cluster/apps/system/prometheus-stack/tests/smart.promtool.yaml) extended.- Never use
cluster/.tools/wipe-rook.yamlfor this: it wipes every MX500 on all three nodes. - Do not run it across the tuppr window (Sunday 07:00 to 11:00 Europe/Warsaw).
Steps¶
- Test the new disk off-cluster. SMART readout, then a full read: over the owner's USB adapter (ASMedia ASM1156) the extended self-test
is aborted by the host at 90 %, so read the disk end to end instead (WSL
wsl --mount --bare, thendd if=/dev/sdX of=/dev/null bs=4M iflag=direct, about 40 minutes for 960 GB). Pass: no I/O error, attributes 5, 179, 181 to 184, 187, 195, 197 and 199 still 0 after the read. Note model, firmware and sector sizes (smartctl -i). Return the disk if it fails. - PR (no effect until merged): add the model to
devicePathFilterif it is new; extendSATAWearHighif the wear attribute is new. Render and lint (.taskfiles/lint/resources/check-manifests.sh rook-ceph-cluster prometheus-stack). Open it as a draft withdo-not-merge. - Pre-checks (read-only), the same day:
ceph statusHEALTH_OK, all PGsactive+clean; SMART health 1 and error counts 0 on the two other nodes; no tuppr run in progress; last CNPG and VolSync backups succeeded;kubectl get pdb -A. The CNPG primary PDBs allow 0 disruptions: if any primary runs on the node to drain, the drain blocks. On 2026-12-01 and 12-02 all eight primaries were on mc2, so mc2's swap needs a CNPG switchover of each first (consent). - Drain and shut down (consent):
kubectl -n rook-ceph exec deploy/rook-ceph-tools -- ceph osd set noout
kubectl cordon <node>
kubectl drain <node> --ignore-daemonsets --delete-emptydir-data
TALOSCONFIG=/workspaces/home-ops/provision/talos/clusterconfig/talosconfig talosctl shutdown --nodes <ip>
Expected: the node NotReady, 1 mon out of quorum, 1 OSD down, every PG active (active+undersized, some +degraded). Pending pods:
the node's mon and OSD, and one adguard-home-replica (anti-affinity, the other replicas run).
- Swap the disk (owner) and check it (read-only): after power-on the node stays cordoned and the old OSD pod stays
Pending.talosctl -n <ip> get disks <dev> -o yaml: model, size, sector size and the by-id name, which must match the filter; the owner checks the serial against the purchase (do not write serials of new disks into the repo).talosctl -n <ip> get discoveredvolumes: signatures. - Wipe the new disk (consent): re-check the device is the new disk (model, size, WWID) immediately before, then
talosctl -n <ip> wipe disk <dev> --method FAST. Never the NVMe system disk. A used server disk can carry RAID metadata Talos does not show, so wipe even whendiscoveredvolumesis empty;--method ZEROES(about 30 minutes) if Rook still rejects it. - Purge the old OSD and uncordon (consent, point of no return):
kubectl -n rook-ceph exec deploy/rook-ceph-tools -- ceph osd out osd.<id>
kubectl -n rook-ceph delete deployment rook-ceph-osd-<id>
kubectl -n rook-ceph exec deploy/rook-ceph-tools -- ceph osd purge <id> --yes-i-really-mean-it
kubectl uncordon <node>
Expected: no osd.<id>, host weight 0, the mon back in quorum within a minute or two, OSD count 2 < osd_pool_default_size 3.
The uncordon starts a prepare run at once; with the old filter its log shows the new disk as available but skipped by the filter,
which confirms the wipe.
- Merge the PR (GitOps trigger, consent). Rebase or merge
mainfirst if it conflicts. Themainruleset needs a code-owner approval, so the owner merges. ArgoCD applies within a minute; the operator reran the prepare jobs within 2 minutes without a restart and the new OSD (usually the same id) came up about 4 minutes after the merge. If nothing happens in 10 minutes, ask before restarting the operator. - Backfill, then clear the flag (consent): wait for all PGs
active+clean(mc3: about 80 minutes for 266 GiB of data at 43 to 70 MiB/s, client I/O unaffected). Rook clears its own per-host NOOUT flag; thenceph crash ls-new(archive after reading, consent) andceph osd unset noout. Done whenHEALTH_OKand no flags. - Verify and record:
smartctl_deviceshows the new model on the node, the wear attribute about the seller's value, noSATAWearHigh;ceph osd perfnext to the other OSDs. Update the hardware tables in ceph-write-load.md and thenode-disk-healthskill.
Rollback until step 7: shut down, put the old disk back, power on, ceph osd unset noout. After step 7 the old disk can only come back as
a new OSD (wipe and backfill).
Result on mc3 (2026-12-02)¶
- New
osd.2: PM883 960 GB, CRUSH weight 0.873 (the MX500s are 0.455; with three hosts and size 3 each host still holds one full copy). ceph osd perfafter backfill: 1 ms on the PM883 against 4 ms on the MX500s (data-centre disk with power-loss protection).- Wear:
Wear_Leveling_Count98 (% left), against 19 % left on the MX500 it replaced.
_[VIP]: Virtual IP (Used for high-availability controlplanes)
_[HA]: High Availability (often reduntant hardware/software)
_[PVC]: k8s resource - Persistent Volume Claim
_[PV]: k8s resource - Persistent Volume
_[CNI]: k8s networking - Container Network Interface
_[k8s]: Shortening of Kurbenetes
_[CRD]: Custom Resource Definitions
_[S3]: Simple Storage Service
_[NFS]: Network File System
_[DR]: Disaster Recovery