- 磁盘处理
#查看磁盘
[root@ecs-5195-0623507 ~]# lsblk
#保证磁盘是以下状态(无磁盘分区)
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdc 253:32 0 1000G 0 disk
##如果磁盘是以下状态(存在磁盘分区)
vdc 253:32 0 1000G 0 disk
├─vdc1 253:33 0 16M 0 part
└─vdc2 253:34 0 1000G 0 part
#进行以下步骤(删除磁盘分区)
[root@ecs-5195-0623507 ~]# fdisk /dev/vdc
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Selected partition 1
Partition 1 is deleted
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@ecs-5195-0623507 ~]# mkfs.xfs -f /dev/vdc
meta-data=/dev/vdc isize=512 agcount=4, agsize=65536000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=262144000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=128000, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@ecs-5195-0623507 ~]# pvcreate -ff --metadatasize=128M --dataalignment=256K /dev/vdc
Wiping xfs signature on /dev/vdc.
Physical volume "/dev/vdc" successfully created.
- 为heketi磁盘配置文件添加新磁盘
[root@ecs-5195-0623507 ~]# vim /etc/heketi/topology.json
{
"clusters": [
{
"nodes": [
{
"node": {
"hostnames": {
"manage": [
"192.168.0.117"
],
"storage": [
"192.168.0.117"
]
},
"zone": 1
},
"devices": [
"/dev/vdb"
]
},
{ ####新增内容开始
"node": {
"hostnames": {
"manage": [
"192.168.0.117" #注意修改ip地址
],
"storage": [
"192.168.0.117" #
]
},
"zone": 1
},
"devices": [
"/dev/vdc" #注意修改磁盘名称
]
}, ####新增内容结束
{
"node": {
"hostnames": {
"manage": [
"192.168.0.151"
],
"storage": [
"192.168.0.151"
]
},
"zone": 1
},
"devices": [
"/dev/vdb"
]
},
{
"node": {
"hostnames": {
"manage": [
"192.168.0.152"
],
"storage": [
"192.168.0.152"
]
},
"zone": 1
},
"devices": [
"/dev/vdb"
]
}
]
}
]
}
- 增加磁盘
[root@ecs-5195-0623507 ~]# heketi-cli topology load --json=/etc/heketi/topology.json
Found node 192.168.0.117 on cluster 292465319051d0be61c8ec0f3c33f051
Found device /dev/vdb
Found node 192.168.0.117 on cluster 292465319051d0be61c8ec0f3c33f051
Adding device /dev/vdc ... OK
Found node 192.168.0.151 on cluster 292465319051d0be61c8ec0f3c33f051
Found device /dev/vdb
Found node 192.168.0.152 on cluster 292465319051d0be61c8ec0f3c33f051
Found device /dev/vdb