Skip to main content
RunBook Academy

CephXXVII · Replication vs Erasure CodingReplication vs Erasure Coding

Why RBD generally wants replication

Intermediate⏱ ~16 mincephrbd

What you'll learn

  • Characterise the RBD write pattern precisely
  • Explain why that pattern suits replication
  • Identify RBD workloads where EC is appropriate
  • Structure StorageClasses around the distinction

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

RBD is the most-deployed Ceph interface and the one where the pool choice has the most visible consequences. Getting it right at provisioning time costs nothing; getting it wrong costs a migration of every image.

What a block device actually does

An RBD image is a flat address space carved into objects — 4 MiB by default. The guest filesystem and application write into it with whatever pattern they have, and the common ones are all small:

Guest activityTypical write
ext4/XFS journal4–32 KiB, frequent, fsync’d
Database page write8–16 KiB random
Filesystem metadata4 KiB, scattered
Application log appendsmall sequential with fsync
Bulk file copylarge sequential

Only the last row is EC-friendly, and it is the least common in steady state.

Why replication fits

  • Small random writes are cheap. Three writes, no read phase, one device-latency term.
  • Latency is bounded by three OSDs, not k+m.
  • Overwrites are native — no read-modify-write path exists.
  • Degraded reads stay fast, served from the primary at normal speed.

The cost is 3× capacity, and for the volumes that carry a workload’s working set that is usually the right purchase.

The RBD exceptions

EC-backed RBD is a good fit when the write pattern is large and sequential:

  • Backup target volumes — an agent streaming multi-megabyte blocks
  • Media and archive volumes — written once, read occasionally
  • Container image layer storage — write-once, medium-sized objects
  • Cold VM images — powered-off templates and snapshots

The test is not “is it RBD” but “does it write large aligned blocks.”

Structuring the choice

# replicated: the default class
ceph osd pool create rbd-standard replicated
ceph osd pool application enable rbd-standard rbd

# EC-backed: for bulk volumes
ceph osd pool create rbd-bulk-meta 32 32 replicated
ceph osd pool create rbd-bulk-data erasure ec42
ceph osd pool set rbd-bulk-data allow_ec_overwrites true
ceph osd pool application enable rbd-bulk-meta rbd
ceph osd pool application enable rbd-bulk-data rbd

rbd create --size 20T --data-pool rbd-bulk-data rbd-bulk-meta/backup-target-01

Expose both as distinct StorageClasses or provisioning options so the choice is made once, explicitly, at creation.

Quiz

Knowledge check · 4 questions

  1. Q1. Which RBD workload is the best candidate for an erasure-coded data pool?

  2. Q2. A 4 KiB guest write to an EC-backed RBD image takes the read-modify-write path whatever object order the image was created with.

  3. Q3. Design the RBD storage offering for a platform team.

    You provide RBD to internal teams via Kubernetes StorageClasses. Consumers include databases, general-purpose application volumes, CI build scratch space, and a large backup archive. Capacity pressure is real and finance is asking about EC.

  4. Q4. Why should the replicated pool be the default for RBD rather than EC?

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

Production discipline

Make the write-pattern criterion explicit in the storage catalogue so consumers can self-select, and audit placements periodically against measured write sizes rather than against what teams declared at provisioning. Where a volume is on the wrong class, plan the migration during a window rather than leaving a known mismatch in place.

Cross-course references

  • Kubernetes: StorageClass selection is exactly where this decision belongs
  • Linux: choosing a RAID level per LUN according to workload is the same practice