[root@node4 ~]# sgdisk -n 1:10487808:4194301951 -t 1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d -p /dev/sdb Disk /dev/sdb: 4194304000 sectors, 2.0 TiB Logical sector size: 512 bytes Disk identifier (GUID): A996FDA1-5621-45CD-871A-028E30E33027 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 4194303966 Partitions will be aligned on 2048-sector boundaries Total free space is 10489789 sectors (5.0 GiB)
Number Start (sector) End (sector) Size Code Name 1 10487808 4194301951 1.9 TiB FFFF The operation has completed successfully.
[root@node4 ~]# sgdisk -n 2:2048:10487807 -t 2:45b0969e-9b03-4f30-b4c6-b4b80ceff106 -p /dev/sdb Disk /dev/sdb: 4194304000 sectors, 2.0 TiB Logical sector size: 512 bytes Disk identifier (GUID): A996FDA1-5621-45CD-871A-028E30E33027 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 4194303966 Partitions will be aligned on 2048-sector boundaries Total free space is 4029 sectors (2.0 MiB)
Number Start (sector) End (sector) Size Code Name 1 10487808 4194301951 1.9 TiB FFFF 2 2048 10487807 5.0 GiB FFFF The operation has completed successfully.
[root@node4 ~]# /usr/sbin/sgdisk --change-name=2:'ceph journal' --typecode=2:45b0969e-9b03-4f30-b4c6-b4b80ceff106 -- /dev/sdb The operation has completed successfully.
[root@node4 ~]# /usr/sbin/sgdisk --change-name=1:'ceph data' --typecode=1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d -- /dev/sdb Warning: The kernel is still using the old partition table. The new table will be used at the next reboot. The operation has completed successfully.
[root@node4 ceph-9]# mkfs.xfs /dev/sdb1 [root@node4 ceph-9]# mount /dev/sdb1 /var/lib/ceph/osd/ceph-9
[root@node4 ~]# ceph-osd -i 9 --mkfs --mkkey 2017-06-29 16:23:05.161478 7f614226e800 -1 journal FileJournal::_open: disabling aio for non-block journal. Use journal_force_aio to force use of aio anyway 2017-06-29 16:23:05.200065 7f614226e800 -1 journal FileJournal::_open: disabling aio for non-block journal. Use journal_force_aio to force use of aio anyway 2017-06-29 16:23:05.221105 7f614226e800 -1 filestore(/var/lib/ceph/osd/ceph-9) could not find #-1:7b3f43c4:::osd_superblock:0# in index: (2) No such file or directory 2017-06-29 16:23:05.237813 7f614226e800 -1 created object store /var/lib/ceph/osd/ceph-9 for osd.9 fsid d6d92de4-2a08-4bd6-a749-6c104c88fc40 2017-06-29 16:23:05.237987 7f614226e800 -1 auth: error reading file: /var/lib/ceph/osd/ceph-9/keyring: can't open /var/lib/ceph/osd/ceph-9/keyring: (2) No such file or directory 2017-06-29 16:23:05.238397 7f614226e800 -1 created new key in keyring /var/lib/ceph/osd/ceph-9/keyring
activate 命令会让 OSD 进入 up 且 in 状态。该命令使用的分区路径是前面 prepare 命令创建的
删除 OSD(手动)
在 Ceph 里,一个 OSD 通常是一台主机上的一个 ceph-osd 守护进程、它运行在一个硬盘之上。 如果一台主机上有多个数据盘,你得逐个删除其对应 ceph-osd。 通常,操作前应该检查集群容量,看是否快达到上限了,确保删除 OSD 后不会使集群达到 near full 比率 警告:删除 OSD 时不要让集群达到 full ratio 值,删除 OSD 可能导致集群达到或超过 full ratio 值。