Image 对应于 LVM 的 Logical Volume,它将被条带化为 N 个子数据块,每个数据块将会被以对象(object)形式保存在 RADOS 对象存储中的简单块设备
在pool2下创建一个大小为100M的myimage的RBD Image(默认情况下,它被条带化为 4MB 大小的 25 个对象 )
备注:pool2不能创建快照,否则将不能被正常创建images
[ceph@ceph-admin cluster]$ ceph osd pool create pool2 64
pool 'pool2' created
[ceph@ceph-admin cluster]$ rbd create pool2/myimage --size 100
创建一个大小为100M,条带化大小为8M的对象
[ceph@ceph-admin cluster]$ rbd create pool2/myimage2 --size 100 --order 23
查看image
[ceph@ceph-admin cluster]$ rbd info pool2/myimage
rbd image 'myimage':
size 102400 kB in 25 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.10ec6b8b4567
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:
[ceph@ceph-admin cluster]$ rbd info pool2/myimage2
rbd image 'myimage2':
size 102400 kB in 13 objects
order 23 (8192 kB objects)
block_name_prefix: rbd_data.10f56b8b4567
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:
删除image
[ceph@ceph-admin cluster]$ rbd rm pool2/myimage4
image的对象挂载
直接挂载会报错
[ceph@ceph-admin cluster]$ sudo rbd map pool2/myimage
rbd: sysfs write failed
RBD image feature set mismatch. You can disable features unsupported by the kernel with "rbd feature disable".
In some cases useful info is found in syslog - try "dmesg | tail" or so.
rbd: map failed: (6) No such device or address
备注: 提示image特性不支持,不需要删除部分特性
通过
[ceph@ceph-admin cluster]$ rbd info pool2/myimage2|grep features
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
了解到,系统只支持layering特性,因此需要去除其他特性,去除的方式有很多种
第一:
[ceph@ceph-admin cluster]$ rbd feature disable pool2/myimage exclusive-lock object-map fast-diff deep-flatten
第二:
创建rbd镜像时就指明需要的特性,如:
[ceph@ceph-admin cluster]$ $ rbd create --size 4096 pool2/myimage3 --image-feature layering
第三:
如果还想一劳永逸,那么就在执行创建rbd镜像命令的服务器中,修改Ceph配置文件/etc/ceph/ceph.conf,在global section下,增加rbd_default_features = 1
再创建rdb镜像。
[ceph@ceph-admin cluster]$ $ rbd create --size 4096
pool2/myimage4
再次尝试加载为一个设备
[ceph@ceph-admin cluster]$ sudo rbd map pool2/myimage
/dev/rbd0
查看本地加载设备
[ceph@ceph-admin cluster]$ rbd showmapped
id pool image snap device
0 pool2 myimage - /dev/rbd0
挂载
[ceph@ceph-admin cluster]$ sudo mkfs.xfs /dev/rbd0
[ceph@ceph-admin cluster]$ sudo mount /dev/rbd0 /mnt/test
取消映射
[root@ceph-node3 ~]# rbd unmap pool2/myimage
书写文档不易,如果你觉得我写得可以打个赏呗
https://www.fageka.com/store/item/s/id/Yx6TZ1m0747.html
CEPH快速搭建六(cephfs文件存储管理)