Skip to main content
RunBook Academy

CephXXXV · RBD ArchitectureRBD Architecture

Clones: copy-on-write images from snapshots

Advanced⏱ ~17 minrbd

What you'll learn

  • Create a clone from a protected snapshot
  • Explain the parent dependency and its read path
  • Decide when to flatten a clone
  • Manage a golden-image workflow safely

Prerequisites

None — start here.

Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18

Not yet marked complete on this device.

Why this matters in production

Cloning is what makes provisioning a hundred VMs from one template instantaneous instead of a copy operation per VM. It also creates a dependency chain that, unmanaged, becomes a read-performance problem and a deletion obstacle.

The workflow

# 1. prepare and snapshot the golden image
rbd create --size 40G rbd-templates/ubuntu-2404
# ... install and configure ...
rbd snap create rbd-templates/ubuntu-2404@v1

# 2. protect it — clones depend on it and it must not be deleted
rbd snap protect rbd-templates/ubuntu-2404@v1

# 3. clone, instantly
rbd clone rbd-templates/ubuntu-2404@v1 rbd-vms/web-01
rbd clone rbd-templates/ubuntu-2404@v1 rbd-vms/web-02

Each clone is created in milliseconds and initially consumes nothing.

The read path

graph LR
    A[read from clone] --> B{object exists in clone?}
    B -->|yes| C[return it]
    B -->|no| D[read from parent snapshot]

Unwritten regions of a clone read through to the parent — an extra RADOS lookup per such read. On a lightly-modified clone that is most reads.

Writes always allocate in the clone, so a clone diverges from its parent progressively as it is used.

Inspecting the relationship

rbd info rbd-vms/web-01 | grep -A2 parent
# parent: rbd-templates/ubuntu-2404@v1
# overlap: 40 GiB

rbd children rbd-templates/ubuntu-2404@v1
# rbd-vms/web-01
# rbd-vms/web-02

rbd du rbd-vms/web-01

overlap is how much of the clone still reads through to the parent.

Flattening

rbd flatten rbd-vms/web-01

Copies all parent data into the clone, removing the dependency. Afterwards the clone is an independent image consuming its full allocated size.

Flatten whenReason
The clone is long-livedremoves the read-through cost
You need to delete the parentthe dependency blocks deletion
The clone has diverged substantiallylittle benefit remains
Read latency on the clone matterseliminates the extra lookup

Do not flatten when clones are short-lived — a CI runner’s disk that exists for twenty minutes should stay thin.

The deletion obstacle

rbd snap unprotect rbd-templates/ubuntu-2404@v1
# Error: snapshot is protected and has children

A protected snapshot with children cannot be unprotected or removed. To retire a template you must flatten or delete every clone first — which is why rbd children should be checked before any template lifecycle decision.

Quiz

Knowledge check · 4 questions

  1. Q1. A read to an unwritten region of a clone does what?

  2. Q2. A protected snapshot with existing clones can be deleted once the template is no longer needed.

  3. Q3. Retire an old VM template.

    A platform has provisioned VMs from `rbd-templates/ubuntu-2204@v3` for two years. The template must be retired for compliance. `rbd children` lists 340 clones, some created last week.

  4. Q4. Why should object-map be kept enabled on clones in particular?

Passing score: 75%. Answers are checked in this browser.

Production discipline

Record which template and version each provisioned volume came from, and flatten clones once they exceed a defined age — template retirement is otherwise an open-ended hunt. Keep object-map enabled on clones specifically, since the read-through path is where its absence costs most.

Cross-course references

  • Kubernetes: PVC provisioning from a VolumeSnapshot uses the same mechanism
  • Linux: overlayfs lower and upper layers behave identically, including the lookup cost