- Ceph Cookbook(Second Edition)
- Vikhyat Umrao Michael Hackett Karan Singh
- 449字
- 2021-07-02 23:19:10
How to do it...
To demonstrate RBD cloning, we will intentionally create an RBD image (specifying the layering feature) then create and protect its snapshot, and finally, create COW clones out of it:
- Create an RBD image with layering feature specified and check it's details:
# rbd create rbd2 --size 10240
--image-feature layering --name client.rbd
# rbd info --image rbd2 --name client.rbd

- Create a snapshot of this RBD image:
# rbd snap create rbd/rbd2@snapshot_for_cloning
--name client.rbd
- To create a COW clone, protect the snapshot. This is an important step, we should protect the snapshot because if the snapshot gets deleted, all the attached COW clones will be destroyed:
# rbd snap protect rbd/rbd2@snapshot_for_cloning
--name client.rbd
- Next, we will create a cloned RBD image, specifying the layering feature, using this snapshot. The syntax is as follows:
# rbd clone <pool-name>/<parent-image-name>@<snap-name>
<pool-name>/<child_image-name>
--image-feature <feature-name>
# rbd clone rbd/rbd2@snapshot_for_cloning rbd/clone_rbd2
--image-feature layering --name client.rbd
- Creating a clone is a quick process. Once it's completed, check the new image information. You will notice that its parent pool, image, and snapshot information will be displayed:
# rbd info rbd/clone_rbd2 --name client.rbd
The clients do not always provide equivalent functionality, for example the fuse client supports client-enforced quotas while the kernel client does not:

- You also have the ability to list children of a snapshot. To list the children of a snapshot execute the following:
# rbd children rbd/rbd2@snapshot_for_cloning
We now have a cloned RBD image that is dependent on it's parent image. To split this cloned image from it's parent snapshot we will need to flatten the image which would require copying all the data from the parent snapshot image to the clone. Flattening may take awhile to complete and depends on the size of the parent snapshot image. One the cloned image is flattened there is no longer a relationship between the parent snapshot and the RBD clone. Please note that a flattened image will contain all information from the snapshot and will use more space than a clone.
- To initiate the flattening process, use the following:
# rbd flatten rbd/clone_rbd2 --name client.rbd
# rbd info --image clone_rbd2 --name client.rbd
After the completion of the flattening process, if you check image information, you will notice that the parent image/snapshot name is not present and the clone is independent:

If the deep-flatten feature is enabled on an image the image clone is dissociated from it's parent by default.
- You can also remove the parent image snapshot if you no longer require it. Before removing the snapshot, you first have to unprotect it:
# rbd snap unprotect rbd/rbd2@snapshot_for_cloning
--name client.rbd
- Once the snapshot is unprotected, you can remove it:
# rbd snap rm rbd/rbd2@snapshot_for_cloning --name client.rbd
- 大數據導論:思維、技術與應用
- Circos Data Visualization How-to
- 西門子PLC與InTouch綜合應用
- AWS:Security Best Practices on AWS
- UTM(統一威脅管理)技術概論
- 新編計算機圖形學
- Chef:Powerful Infrastructure Automation
- Mastering Ansible(Second Edition)
- 貫通開源Web圖形與報表技術全集
- Linux Shell Scripting Cookbook(Third Edition)
- 無人駕駛感知智能
- PostgreSQL High Performance Cookbook
- 大數據:從基礎理論到最佳實踐
- 歐姆龍PLC應用系統設計實例精解
- 工業機器人與自控系統的集成應用