1.创建一个存储池,存储池的名称为testpool
[root@localhost ~]# ceph osd pool create testpool 128
pool 'testpool' created
[root@localhost ~]# ceph osd pool ls
testpool
2.上传一个对象到testpool存储池,对象的名称为testobject
[root@localhost ~]# touch hello.txt
[root@localhost ~]# rados -p testpool put testobject hello.txt
[root@localhost ~]# rados -p testpool ls
testobject
3.创建一个RBD的image,image名称为testimage,大小为100M
[root@localhost ~]# rbd create testpool/testimage --size 100M
[root@localhost ~]# rbd info testpool/testimage
rbd image 'testimage':
size 100 MiB in 25 objects
order 22 (4 MiB objects)
snapshot_count: 0
id: 1140963892e
block_name_prefix: rbd_data.1140963892e
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
op_features:
flags:
create_timestamp: Tue Jul 26 19:32:56 2022
access_timestamp: Tue Jul 26 19:32:56 2022
modify_timestamp: Tue Jul 26 19:32:56 202
4.将testimage映射为块设备
[root@localhost ~]# rbd device map testimage
5.删除testpool存储池
[root@localhost ~]# vim /etc/ceph/ceph.conf
mon_allow_pool_delete = true
[root@localhost ~]# systemctl restart ceph-mon.target
[root@localhost ~]# ceph osd pool delete testpool testpool --yes-i-really-really-mean-it
pool 'testpool' removed