[root@ceph-admin ~]# rbd clone ceph-rbdpool/vol01@vol01-snap3 ceph-rbdpool/image1[root@ceph-admin ~]# rbd ls ceph-rbdpoolimage1vol01[root@ceph-admin ~]# rbd ls ceph-rbdpool -lNAMESIZE PARENTFMT PROT LOCKimage15 GiB ceph-rbdpool/vol01@vol01-snap32vol015 GiB2vol01@vol01-snap3 5 GiB2 yes[root@ceph-admin ~]#提示:克隆快照 , 最终生成的是对应存储池里的image;所以我们需要指定对应目标的存储池和image名称;这里需要注意克隆快照 , 前提是快照需做保护 , 否则不予被克隆;
列出快照的子项
命令格式:rbd children [--pool <pool>] --image <image> --snap <snap>
[root@ceph-admin ~]# rbd snap list ceph-rbdpool/vol01SNAPID NAMESIZE TIMESTAMP12 vol01-snap3 5 GiB Tue Oct4 23:49:25 2022[root@ceph-admin ~]# rbd children ceph-rbdpool/vol01@vol01-snap3ceph-rbdpool/image1[root@ceph-admin ~]#展平克隆的image
克隆的映像会保留对父快照的引用 , 删除子克隆对父快照的引用时 , 可通过将信息从快照复制到克隆 , 进行image的“展平”操作;展平克隆所需的时间随着映像大小的增加而延长;要删除某拥有克隆子项的快照 , 必须先平展其子image;命令格式: rbd flatten [--pool <pool>] --image <image> --no-progress
[root@ceph-admin ~]# rbd ls ceph-rbdpool -lNAMESIZE PARENTFMT PROT LOCKimage15 GiB ceph-rbdpool/vol01@vol01-snap32vol015 GiB2vol01@vol01-snap3 5 GiB2 yes[root@ceph-admin ~]# rbd flatten ceph-rbdpool/image1Image flatten: 100% complete...done.[root@ceph-admin ~]# rbd ls ceph-rbdpool -lNAMESIZE PARENT FMT PROT LOCKimage15 GiB2vol015 GiB2vol01@vol01-snap3 5 GiB2 yes[root@ceph-admin ~]# rbd children ceph-rbdpool/vol01@vol01-snap3[root@ceph-admin ~]#提示:可以看到我们把子镜像进行展品操作以后 , 对父镜像的信息就没了;查看对应快照的子项也没有了;这意味着现在展品的子镜像是一个独立的镜像;
取消快照保护
命令格式:命令:rbd snap unprotect [--pool <pool>] --image <image> --snap <snap>
[root@ceph-admin ~]# rbd snap list ceph-rbdpool/vol01SNAPID NAMESIZE TIMESTAMP12 vol01-snap3 5 GiB Tue Oct4 23:49:25 2022[root@ceph-admin ~]# rbd snap rm ceph-rbdpool/vol01@vol01-snap3Removing snap: 0% complete...failed.rbd: snapshot 'vol01-snap3' is protected from removal.2022-10-05 00:05:04.059 7f5e35e95840 -1 librbd::Operations: snapshot is protected[root@ceph-admin ~]# rbd snap unprotect ceph-rbdpool/vol01@vol01-snap3[root@ceph-admin ~]# rbd snap rm ceph-rbdpool/vol01@vol01-snap3Removing snap: 100% complete...done.[root@ceph-admin ~]# rbd snap list ceph-rbdpool/vol01[root@ceph-admin ~]#提示:被保护的快照是不能被删除的必须先取消保护快照 , 然后才能删除它;其次用户无法删除克隆所引用的快照 , 需要先平展其每个克隆 , 然后才能删除快照;
KVM使用rbd image
1、准备kvm环境 , 在kvm宿主机上除了安装ceph-common和epel源之外 , 我们还需要安装安装libvirt与qemu-kvm;
yum install qemu-kvm qemu-kvm-tools libvirt virt-manager virt-install提示:我这里直接使用adminhost来做kvm宿主机 , 所以ceph-common、epel源都是准备好的 , 只需安装qemu-kvm qemu-kvm-tools libvirt virt-manager virt-install即可;
2、启动libvirtd守护进程
[root@ceph-admin ~]# systemctl start libvirtd[root@ceph-admin ~]# systemctl status libvirtd -l● libvirtd.service - Virtualization daemonLoaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)Active: active (running) since Wed 2022-10-05 01:27:34 CST; 1min 32s agoDocs: man:libvirtd(8)https://libvirt.org Main PID: 940 (libvirtd)Tasks: 19 (limit: 32768)CGroup: /system.slice/libvirtd.service├─ 940 /usr/sbin/libvirtd├─1237 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper└─1238 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelperOct 05 01:27:35 ceph-admin.ilinux.io dnsmasq[1232]: listening on virbr0(#3): 192.168.122.1Oct 05 01:27:35 ceph-admin.ilinux.io dnsmasq[1237]: started, version 2.76 cachesize 150Oct 05 01:27:35 ceph-admin.ilinux.io dnsmasq[1237]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth nettlehash no-DNSSEC loop-detect inotifyOct 05 01:27:35 ceph-admin.ilinux.io dnsmasq-dhcp[1237]: DHCP, IP range 192.168.122.2 -- 192.168.122.254, lease time 1hOct 05 01:27:35 ceph-admin.ilinux.io dnsmasq-dhcp[1237]: DHCP, sockets bound exclusively to interface virbr0Oct 05 01:27:35 ceph-admin.ilinux.io dnsmasq[1237]: reading /etc/resolv.confOct 05 01:27:35 ceph-admin.ilinux.io dnsmasq[1237]: using nameserver 192.168.0.1#53Oct 05 01:27:35 ceph-admin.ilinux.io dnsmasq[1237]: read /etc/hosts - 15 addressesOct 05 01:27:35 ceph-admin.ilinux.io dnsmasq[1237]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addressesOct 05 01:27:35 ceph-admin.ilinux.io dnsmasq-dhcp[1237]: read /var/lib/libvirt/dnsmasq/default.hostsfile[root@ceph-admin ~]#
经验总结扩展阅读
- 荣耀magic3支持鸿蒙系统吗_荣耀magic3能升级鸿蒙吗
- 微信点餐系统怎么做
- docker搭建yapi接口文档系统、Idea中上传接口、在线调用
- 戴尔电脑如何重装系统
- 大葱过冬的存储方法
- 人体中枢神经系统用来产生能量的营养素是
- 分布式存储系统之Ceph集群CephX认证和授权
- 肾结石有遗传因素吗
- 分布式存储系统之Ceph集群存储池操作
- 阴阳师剧情收录系统有什么功能