我们经常面临 ceph的磁盘损坏,需要更换磁盘。以下是更换磁盘的步骤:
note: when disk is bad and the raid0, afterreboot, dev number(sdh, sdi) will be changed for no raid conf for this newdisk. it will cause journal dev number is changed, and osd can not be started
1. 查询osd和磁盘的信息
ceph osd tree #get the osd id:
sdi is ssd dev partition for osd journal
for i in `ls -1`; do ls -la $i/; done #get ssd dev
ceph -s #check pg status #确保pg是active状态
2. osd删除,在任意节点上执行
ceph osd out {osd-num}
/etc/init.d/ceph stop osd.{osd-num}
ceph osd crush remove osd.{osd-num}
ceph auth del osd.{osd-num}
ceph osd rm {osd-num}
ceph -s #check pg status #确保pg是active状态
3. 新增osd. 在任意节点上执行.
在/opt/ceph-deploy 目录,执行
# ceph-deploy --overwrite-conf osd prepare node-xx:/dev/sde:/dev/sdi1
# ceph-deploy --overwrite-conf osd activate node-xx:/dev/sde1:/dev/sdi1
activate时磁盘已分区,注意加分区号
ceph -s #check pg status #确保pg是active状态