About this task
You can remove failed or unwanted Ceph provisioned using local storage devices by following the
steps in the procedure.Important: Scaling down of cluster is supported only with the
help of the Red Hat support team.
Warning:
-
Removing an OSD when the Ceph component is not in a healthy state can result in data loss.
-
Removing two or more OSDs at the same time results in data loss.
Procedure
- Forcibly, mark the OSD down by scaling the replicas on the OSD deployment to 0. You can
skip this step if the OSD is already down due to failure.
oc scale deployment rook-ceph-osd-<osd-id> --replicas=0
- Remove the failed OSD from the cluster.
# failed_osd_id=<osd_id>
# oc process -n openshift-storage ocs-osd-removal -p FAILED_OSD_IDS=$<failed_osd_id> | oc create -f -
- Verify that the OSD is removed successfully by checking the logs.
# oc logs -n openshift-storage ocs-osd-removal-$<failed_osd_id>-<pod-suffix>
- Optional: If you get an error as
cephosd:osd.0 is NOT ok to destroy
from
the ocs-osd-removal-job pod in OpenShift Container Platform, seeTroubleshooting the error cephosd:osd.0 is NOT ok to
destroy
while removing failed or unwanted Ceph OSDs.
- Delete persistent volume claim (PVC) resources associated with the failed OSD.
- Get the PVC associated with the failed OSD.
oc get -n openshift-storage -o yaml deployment rook-ceph-osd-<osd-id> | grep ceph.rook.io/pvc
- Get the persistent volume (PV) associated with the PVC.
oc get -n openshift-storage pvc <pvc-name>
- Get the failed device name.
oc get pv <pv-name-from-above-command> -oyaml | grep path
- Get the prepare-pod associated with the failed OSD.
oc describe -n openshift-storage pvc ocs-deviceset-0-0-nvs68 | grep Mounted
- Delete the osd-prepare pod before removing the associated PVC.
oc delete -n openshift-storage pod <osd-prepare-pod-from-above-command>
- Delete the PVC associated with the failed OSD.
oc delete -n openshift-storage pvc <pvc-name-from-step-a>
- Remove failed device entry from the
LocalVolume custom
resource
(CR).
- Log in to node with the failed device.
oc debug node/<node_with_failed_osd>
- Record the /dev/disk/by-id/<id> for the failed device name.
ls -alh /mnt/local-storage/localblock/
- Optional: In case, Local Storage Operator is used for provisioning OSD, login to the
machine with {osd-id} and remove the device symlink.
oc debug node/<node_with_failed_osd>
- Get the OSD symlink for the failed device name.
ls -alh /mnt/local-storage/localblock
- Remove the symlink
rm /mnt/local-storage/localblock/<failed-device-name>
- Delete the PV associated to the
OSD.