Filestore类型OSD的换盘操作:

1、umount坏盘目录
umount /var/lib/ceph/osd/ceph-176
2、通过MegaCli建立Riad0硬盘
MegaCli64 -CfgLdAdd -r0 [32:3] WT RA Direct -a0
3、对磁盘分区
parted /dev/sdj "mklabel gpt"
parted /dev/sdj "mkpart primary 1 -1"
4、格式化硬盘并挂载到OSD目录
mkfs.xfs -m uuid=“$(ceph osd dump |grep osd.176 |awk ‘{print $NF}')” /dev/sdj1
mount /dev/sdj1 /var/lib/ceph/osd/ceph-176
5、恢复fsid和journal
cd /var/lib/ceph/osd/ceph-176
echo “$(blkid -o export /dev/sdj1 |grep -i ^uuid |awk -F= ‘{print $2}’)” > fsid
ln -sf /dev/disk/ceph/by-uuid/[journal_id] journal
6、初始化OSD数据目录
dd if=/dev/zero of=/dev/sdo3 bs=100M count=1
ceph-osd -i 176 —mkfs
chown -R ceph:ceph /var/lib/ceph/osd/ceph-176
7、启动OSD并加入集群
systemctl start ceph-osd@176
ceph osd in 176

Bluestore类型OSD的换盘操作:

1、删除OSD目录下ready和mkfs_done文件
cd /var/lib/ceph/osd/ceph-1/
rm -f mkfs_done ready
2、通过MegaCli建立Riad0硬盘
MegaCli64 -CfgLdAdd -r0 [32:3] WT RA Direct -a0
3、天生OSD block链接
cd /dev/disk/ceph/by-uuid/
ln -sf /dev/sde d93d1c35-ee59-4b64-a339-8d00915a08df
4、初始化OSD目录
ceph-osd -i 1 —mkfs
chown ceph:ceph -R /var/lib/ceph/osd/ceph-1
systemctl start ceph-osd\@1