Useful Ceph commands

How to bootstrap a new Ceph cluster

cephadm bootstrap --mon-ip --cluster-network

How to ZAP an OSD with Ceph Orch

ceph orch device zap stor1 /dev/sdb --force

How to add an OSD to the Ceph cluster

ceph orch daemon add osd stor1:/dev/sdb

How to remove an OSD from Ceph

Mark the OSD as out:

ceph osd out <osd_id>

Remove the OSD with rm:

ceph osd rm <osd_id>

Purge the OSD:

ceph osd purge <osd_id>

How to remove rogue OSD daemon

ceph orch daemon rm osd.93 --force

How to check space used by image in RBD pool

rbd du -p your_pool_name

How to remove image from RBD pool

rbd rm vm-166-disk-0 -p your_pool_name

How to force backfill with Ceph

ceph pg force-backfill <pg_id>

How to get the crush rule of a pool in Ceph

ceph osd pool get your_pool crush_rule

Identify on which OSD’s an inconsistent PG is running

rados list-inconsistent-obj <pg_id> --format=json-pretty

Create replicated rule for SSD with replication on host level

ceph osd crush rule create-replicated <replicated_rule_name> default host ssd

Assign replicated rule to specific pool

ceph osd pool set <pool_name> crush_rule <replicate_rule_name>