ceph分配块设备

  sre

#创建一个大小为 1024M 的 ceph image

[root@node01 ~]# rbd create foo --size 1024
[root@node01 ~]# rbd list
foo

#临时关闭内核不支持的特性

[root@node01 ~]# rbd feature disable foo exclusive-lock, object-map, fast-diff, deep-flatten
2019-01-27 02:45:07.963903 7f8986011d80 -1 librbd: one or more requested features are already disabled
rbd: failed to update image features: (22) Invalid argument
[root@node01 ~]# rbd info foo
rbd image 'foo':
    size 1024 MB in 256 objects
    order 22 (4096 kB objects)
    block_name_prefix: rbd_data.373a6b8b4567
    format: 2
    features: layering
    flags:

#把 foo image 映射到内核

[root@node01 ~]# rbd map foo
/dev/rbd0
[root@node01 ~]# rbd showmapped
id pool image snap device
0  rbd  foo   -    /dev/rbd0

#将 foo image 格式化为 ext4 格式的文件系统

mkfs.ext4 -m0 /dev/rbd0

LEAVE A COMMENT

Captcha Code