Docs/存储/ceph/p版本安装/9-为ceph集群添加OSD.md

51 lines
No EOL
3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

> 说明添加OSD时建议将磁盘先格式化为无分区的原始磁盘
```shell
## https://rook.github.io/docs/rook/v1.10/Getting-Started/ceph-teardown/?h=sgdisk#zapping-devices
DISK="/dev/sdX"
## Zap the disk to a fresh, usable state (zap-all is important, b/c MBR has to be clean)
sgdisk --zap-all $DISK
## Wipe a large portion of the beginning of the disk to remove more LVM metadata that may be present
dd if=/dev/zero of="$DISK" bs=1M count=100 oflag=direct,dsync
## SSDs may be better cleaned with blkdiscard instead of dd
blkdiscard $DISK
## Inform the OS of partition table changes
partprobe $DISK
```
```shell
## 查看各ceph节点有哪些磁盘是可用的关注`AVAILABLE`列
# ceph orch device ls
HOST    PATH          TYPE  DEVICE ID                                             SIZE  AVAILABLE  REFRESHED  REJECT REASONS  
ceph01  /dev/nvme0n2  ssd   VMware_Virtual_NVMe_Disk_VMware_NVME_0000             107G  Yes        17m ago                    
ceph01  /dev/sda      hdd   VMware_Virtual_SATA_Hard_Drive_00000000000000000001   107G  Yes        17m ago                    
ceph02  /dev/nvme0n2  ssd   VMware_Virtual_NVMe_Disk_VMware_NVME_0000             107G  Yes        18m ago                    
ceph02  /dev/sda      hdd   VMware_Virtual_SATA_Hard_Drive_00000000000000000001   107G  Yes        18m ago                    
ceph03  /dev/nvme0n2  ssd   VMware_Virtual_NVMe_Disk_VMware_NVME_0000             107G  Yes        25m ago                    
ceph03  /dev/sda      hdd   VMware_Virtual_SATA_Hard_Drive_00000000000000000001   107G  Yes        25m ago                    
ceph04  /dev/nvme0n2  ssd   VMware_Virtual_NVMe_Disk_VMware_NVME_0000             107G  Yes        17m ago                    
ceph04  /dev/sda      hdd   VMware_Virtual_SATA_Hard_Drive_00000000000000000001   107G  Yes        17m ago                    
ceph05  /dev/nvme0n2  ssd   VMware_Virtual_NVMe_Disk_VMware_NVME_0000             107G  Yes        17m ago                    
ceph05  /dev/sda      hdd   VMware_Virtual_SATA_Hard_Drive_00000000000000000001   107G  Yes        17m ago  
## 接下来初始化osd
## 将指定的磁盘格式化为无分区的原始磁盘
# blkdiscard /dev/nvme0n2
# cephadm shell ceph orch device zap ceph01 /dev/sda
## 接着初始化其他节点上磁盘
...
## 添加OSD
# ceph orch daemon add osd ceph01:/dev/nvme0n2
# ceph orch daemon add osd ceph01:/dev/sda
# ceph orch daemon add osd ceph02:/dev/nvme0n2
# ceph orch daemon add osd ceph02:/dev/sda  
# ceph orch daemon add osd ceph03:/dev/nvme0n2
# ceph orch daemon add osd ceph03:/dev/sda  
# ceph orch daemon add osd ceph04:/dev/nvme0n2
# ceph orch daemon add osd ceph04:/dev/sda  
# ceph orch daemon add osd ceph05:/dev/nvme0n2
# ceph orch daemon add osd ceph05:/dev/sda            
```