How to remove/add OSD from Ceph cluster
- Remove OSD from Ceph Cluster
Firstly check which OSD is down and want to remove from Ceph Cluster by using given command: ceph osd tree . Let’s say it is osd.20 which is down and want to remove. Now use the following commands
a. ceph osd out osd.20 (If you see “osd.20 is already out” — it’s ok.)
b. ceph osd down osd.20
c. Remove it: ceph osd rm osd.20If it says ‘Error EBUSY: osd.11 is still up; must be down before removal.’ that means OSD is not dead yet. Go to the host it resides on and kill it (systemctl stop ceph-osd@20), and repeat rm operation.
d. ceph osd crush rm osd.20
e. remove it authorization (it should prevent problems with ‘couldn’t add new osd with same number’): ceph auth del osd.20.
f. Make sure it is safe to destroy the OSD:
ceph osd destroy 20 --yes-i-really-mean-it
g. Now check with the following command: ceph -s or ceph -w
h. If want to remove ceph LVM volume created on host machine (suppose lvm created on sdb) so use given command :
To find ceph volume group name : lvs
To remove Logical Volume : lvremove <ceph-VG-name>
2. Add OSD on Ceph Cluster
a. Ceph cluster required ceph volume and it will auto generate the osd number (also required ceph-osd package on host machine apt install ceph-osd). So following command needed to add OSD
b. Zap a disk for the new OSD: ceph-volume lvm zap /dev/sdb
c. batch Creates OSDs from a list of devices using a filestore
or bluestore
(default) setup: ceph-volume lvm batch --bluestore /dev/sdb
d. ceph-volume lvm activate --all
e. Now OSD has been added . Check using: systemctl status ceph-osd@20