Erasure Coding Explained: How Storage Survives Lost Drives

Erasure coding explained in plain terms means understanding how a storage system can lose whole drives and still recover every byte. The central question is how to protect data without keeping several full copies of it, and the answer is mathematics: split the data into fragments, add parity fragments, and rebuild any missing piece from the rest.

Erasure coding is a method of data protection that breaks data into a set of fragments, expands it with extra parity fragments, and stores them across different drives or machines, so that the original data can be reconstructed from any sufficient subset of the fragments.

The idea is simple: pay a small amount of extra space, and survive the loss of several drives at once. This article explains what erasure coding is, how it works, and where it is used.

Key takeaways

  • Erasure coding splits data into fragments plus parity fragments.
  • Any sufficient subset of fragments can rebuild the original data.
  • It survives the loss of several drives at once, not just one.
  • It uses far less extra space than keeping full copies.
  • It suits large, rarely changed data stored across many drives.

What erasure coding is

Erasure coding starts with a stripe of data, which is split into k data fragments. The encoder then computes m parity fragments from them, and the k + m fragments are stored on different drives. The original data can be rebuilt from any k of the fragments, so the system can lose any m fragments and still recover everything.

The classic scheme is Reed-Solomon coding, invented in 1960, which treats the fragments as points on a polynomial and uses algebra to fill in the missing ones. A 6 + 3 scheme, for example, stores nine fragments for every six of data, tolerates any three failures, and uses 50 percent extra space, where three full copies would use 200 percent.

The contrast with RAID is instructive. RAID 5 keeps one parity block per stripe and survives one failed drive, while RAID 6 keeps two and survives two. Erasure coding generalises the same idea to any number of parity fragments, and spreads them across machines instead of drives in one box. Our guide to RAID explains the drive-level version of the idea, and our guide to distributed systems explains the setting in which data is spread across machines.

How erasure coding works

Encoding happens when data is written. The stripe is divided into equal data fragments, the encoder computes the parity fragments, and all of them are written to different drives or nodes. The write is slower than a plain copy, because the parity must be calculated, but it happens once, when the data is stored.

Reading is straightforward when nothing is missing. The system reads the k data fragments and reassembles them, without touching the parity at all, so a healthy read costs no more than reading the data itself.

Rebuilding starts when a fragment is lost. The system reads any k of the surviving fragments, including parity fragments if needed, and solves for the missing ones. The mathematics is the same in both directions: any k fragments determine the stripe, so the lost ones can always be computed from the rest.

The choice of k and m is a trade-off between space and safety. A large k means less overhead but a bigger rebuild when a drive fails, while a large m means more safety but more space. Cloud storage often uses schemes like 6 + 3 or 10 + 4, which tolerate several failures at a modest overhead.

Repair is a background job. When a drive fails, the system notices the missing fragments, reads the survivors, rebuilds the lost ones, and writes them to a healthy drive. The data stays protected throughout, as long as no more than m fragments are lost before the repair finishes.

A dark server room with glowing green fragments of data spread across racks, one rack dark while the others rebuild its missing pieces
A dark server room with glowing green fragments of data spread across racks, one rack dark while the others rebuild its missing pieces, shows how erasure coding works: lose any few fragments, rebuild them from the rest.

Comparing erasure coding with other data protection

Erasure coding is one of several ways to protect stored data, and each was built with a different emphasis. Full replication is simple and fast to read, RAID protects one box of drives, and a plain backup protects against deletion, but each approach trades space for safety in a different way.

The table below sets out the main contrasts between the leading approaches.

Aspect Erasure coding Full replication RAID 6
Extra space 30 to 50 percent, typically 200 percent for three copies Two parity drives per stripe
Failures tolerated Any m fragments Any two copies Any two drives
Scope Across machines Across machines Inside one box
Rebuild cost Reads k fragments Copies one copy Reads the surviving drives
Best for Large, cold data at scale Hot data that must be instant A single server’s drives

The practical result is that erasure coding is the right choice for large data stored across many machines, replication suits hot data that must be read instantly, and RAID fits a single server.

Where erasure coding is used

Cloud object storage uses erasure coding for most of its data. Amazon S3, Google Cloud Storage, and Azure Blob Storage all encode objects across drives and data centres, which is how they can promise very high durability while storing exabytes of data.

Distributed file systems use erasure coding to protect large files. Ceph, Hadoop HDFS, and GlusterFS all offer erasure-coded pools, so that a file survives the loss of several storage nodes without keeping several copies of it.

Archival storage uses erasure coding because the data is written once and rarely read. A backup or a media archive can accept slower writes in exchange for much lower storage costs, and erasure coding is the cheapest way to keep that data safe.

Content delivery networks use erasure coding for origin storage. The original copy of a video or a software package is encoded across several locations, so that no single failure can lose the only copy of a popular file.

Spacecraft and deep-space communication use Reed-Solomon codes to survive lost data. A signal from a distant probe loses pieces on the way, and the code lets the receiver rebuild the message from the pieces that do arrive.

Strengths and limits

The greatest strength of erasure coding is its efficiency. It protects data against several simultaneous failures while using far less space than replication, which matters enormously when the data is measured in petabytes.

It is also a strength that the protection scales. Adding more parity fragments tolerates more failures without changing the design, so the same scheme works for a small cluster and a global cloud.

The limits are real, though. Encoding and rebuilding cost CPU time, a small update means rewriting a whole stripe, and a rebuild reads many fragments across the network. For small, hot, frequently changed data, replication is the better choice.

Erasure coding checklist

  • Use erasure coding for large data that is written once and read rarely.
  • Choose k and m from the failures you must survive, not from habit.
  • Spread fragments across failure domains, not just across drives.
  • Monitor rebuilds; a slow repair narrows the safety margin.
  • Test a real drive failure before trusting the scheme in production.
  • Keep hot, small, frequently changed data on replication instead.
  • Budget CPU for encoding; it is not free.
  • Plan for the network cost of reading k fragments during a rebuild.
  • Remember that erasure coding protects against loss, not against deletion.

Frequently asked questions

What is erasure coding in simple terms?

It is splitting data into fragments plus extra parity fragments, so the original can be rebuilt from any sufficient subset, even when some fragments are lost.

What is the difference between erasure coding and RAID?

RAID protects drives inside one box with one or two parity blocks, while erasure coding generalises the idea to any number of parity fragments spread across machines.

What is a Reed-Solomon code?

It is a mathematical code from 1960 that treats fragments as points on a polynomial, and can fill in any missing points from the ones that survive.

How much extra space does erasure coding need?

Typically 30 to 50 percent, against 200 percent for three full copies, which is why clouds use it for large data.

Does erasure coding slow down reads?

Not when nothing is missing: a healthy read uses only the data fragments, and parity is touched only during a rebuild.

When should I not use erasure coding?

For small, hot data that changes often, where the cost of rewriting whole stripes outweighs the space saved.

The bottom line

Erasure coding explained in one line is this: split the data, add parity, and rebuild anything that is lost from what remains.

It is the mathematics that lets a cloud lose whole drives without losing a byte, and the reason storing exabytes can still be affordable.

This article is general information about how erasure coding works, not advice about choosing storage protection for a particular system.

Latest articles

Scroll to Top