Skip to main content
RunBook Academy

CephCV · Backup StrategyBackup Strategy

Snapshots as a control: what they cover and what they cost

Intermediate⏱ ~18 minrbdceph

What you'll learn

  • Identify what snapshots protect against
  • Understand snapshot capacity behaviour
  • Manage snapshot retention
  • Recognise the limits

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

Snapshots are the cheapest data protection available and their capacity behaviour surprises people who treat them as free.

What snapshots cover

ThreatSame-cluster snapshot
Accidental deletion of a file inside an imageyes
Accidental deletion of the imageyes, if the snapshot survives
Application corruption, detected quicklyyes
A bad application deploymentyes
Cluster lossno
An actor who can delete snapshotsno
Ransomware with cluster credentialsno
POOL=rbd-vms
IMAGE=vm-disk-01
rbd snap create ${POOL}/${IMAGE}@pre-deploy
rbd snap ls ${POOL}/${IMAGE}
# Substitute your own values before running:
POOL=rbd-vms
IMAGE=vm-disk-01

# and the fast recovery path they enable
rbd snap rollback "$POOL/$IMAGE@pre-deploy"
A pre-change snapshot before any risky operation is the highest-value
minute in most maintenance procedures.

Capacity behaviour

A snapshot costs nothing at creation. It costs as the live image
diverges from it: every overwritten object must retain its snapshotted
version.
POOL=rbd-vms
IMAGE=vm-disk-01
rbd du ${POOL}/${IMAGE}
NAME             PROVISIONED  USED
image01@snap1        500 GiB   80 GiB
image01@snap2        500 GiB   14 GiB
image01              500 GiB  180 GiB
<TOTAL>              500 GiB  274 GiB
WorkloadSnapshot growth
Read-heavynegligible
Append-onlysmall
Random overwriteapproaches the overwrite volume
A full-image rewriteapproaches the image size
# what snapshots are costing across a pool
POOL=rbd-vms
rbd ls ${POOL} | while read img; do
  rbd du "${POOL}/$img" --format json 2>/dev/null | python3 -c '
import sys,json
d = json.load(sys.stdin)
tot = sum(i.get("used_size",0) for i in d.get("images", []))
snaps = sum(i.get("used_size",0) for i in d.get("images", []) if i.get("snapshot"))
if tot: print("%-24s total %7.1f GiB  snapshots %7.1f GiB" %
              (d["images"][0]["name"], tot/1024**3, snaps/1024**3))'
done

Retention

# snapshot schedules, managed by the rbd_support module
rbd mirror snapshot schedule ls 2>/dev/null
ceph mgr module ls --format json | python3 -c '
import sys,json; print("rbd_support" in json.load(sys.stdin)["enabled_modules"])'
# Substitute your own values before running:
POOL=rbd-vms
IMAGE=vm-disk-01

# manual retention: keep the last 14
rbd snap ls "$POOL/$IMAGE" --format json | python3 -c '
import sys,json
snaps = sorted(json.load(sys.stdin), key=lambda s: s["id"])
for s in snaps[:-14]: print(s["name"])' | \
while read s; do rbd snap rm "$POOL/$IMAGE@$s"; done
Removing a snapshot returns capacity but generates work: the objects it
was holding must be trimmed, which is I/O the cluster does in the
background.
ceph -s | grep -i snaptrim

The limits

A snapshot is a control against the threats that reach the data.
It is not a control against the threats that reach the cluster.
LimitConsequence
On the same clustershares the cluster’s fate
Deletable by the same credentialan actor with access removes both
Capacity cost scales with changeunbounded retention is not free
Trim load on removalbulk removal generates background I/O
Rollback loses post-snapshot datait is a revert, not a merge

Quiz

Knowledge check · 4 questions

  1. Q1. What does removing many snapshots at once generate?

  2. Q2. A snapshot of a read-heavy image can be retained for months at almost no capacity cost.

  3. Q3. Design a snapshot retention policy.

    RBD images serving VMs are snapshotted hourly with no retention limit. Pool usage is growing faster than the VMs' data.

  4. Q4. What does `rbd snap rollback` do to data written after the snapshot?

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

Production discipline

Take a snapshot before any risky change — it costs seconds and converts an unrecoverable operation into a revertible one. Stage bulk snapshot removal rather than scripting one cleanup; releasing a month of snapshots on a heavily-overwritten image can generate hours of trim load.

Cross-course references

  • Kubernetes: a pre-upgrade volume snapshot serves the same rollback role
  • Linux: copy-on-write snapshot cost tracks change rate, not data size