This one decision cascades into an astonishing set of benefits. Crash consistency becomes free — the old tree is always a valid file system, so a crash mid-update simply leaves you on the old root, no journal, no fsck. Snapshots become nearly free — the old tree you were going to abandon is a snapshot, sharing every unchanged block. And because each pointer can carry a checksum of what it points to, the file system can detect and even repair silent disk corruption. COW is the design where consistency, snapshots, and integrity all fall out of a single structural rule.
Picture the whole file system as one big tree of blocks: a root block points at interior blocks, which point at more, down to the leaf data blocks. To modify a leaf, COW does not touch it in place. Instead it walks the change bottom-up:
Until the root flips, a reader sees the entire old tree — complete and consistent. After it flips, readers see the entire new tree — complete and consistent. There is no in-between state a crash could expose, because the only thing that changed atomically is one pointer. This is why COW file systems need no journal: the layout itself is always consistent by construction.
Follow the update of a single leaf. Only the blocks on the path from that leaf to the root are copied; every other subtree is shared between the old and new trees, untouched. When the root flips, the old root does not become garbage — it becomes a perfectly usable snapshot.
Because a COW update already leaves the old tree intact, a snapshot costs almost nothing: just keep the old root and refuse to free the blocks it reaches. The snapshot and the live file system share every block they have in common; only blocks that are subsequently changed get new copies, and the changed block's old version stays alive as long as some snapshot references it. This is why you can snapshot a multi-terabyte ZFS pool in milliseconds and it consumes essentially zero extra space until data diverges.
A clone is a writable snapshot — start from a shared tree and let both sides COW their own changes. Databases, container images (each layer a clone), and "time-machine" backups all ride on this. The bookkeeping is reference counting (btrfs) or birth times (ZFS): a block may be freed only when no live tree or snapshot still points at it.
COW hands you integrity almost for free too. Since every block already gets a fresh parent pointer on update, ZFS and btrfs store the block's checksum in its parent rather than beside the data. So when you read a block, you validate it against a checksum that lives somewhere else on the disk — a genuine end-to-end check that catches not just bit-rot but misdirected writes, phantom writes, and a disk returning the wrong block entirely. With a redundant copy (a mirror or RAID-Z), a failed checksum triggers self-healing: read the good copy, hand the caller correct data, and rewrite the bad block. This is why ZFS is trusted for archival storage — it does not just survive crashes, it detects the disk lying.
Because the old versions are freed once nothing references them. When you update a leaf and flip the
root, the old leaf, old parent, and old root become garbage unless a snapshot still points at them — at
which point a background reclaimer (or reference-count drop) returns their space to the free pool. So COW is not
"keep everything forever"; it is "keep the old version alive exactly as long as some tree still needs it." The
cost you do pay is write amplification: changing one leaf forces you to rewrite every
block on the path to the root (a handful of blocks for one data change), and over time all this out-of-place
writing fragments the disk, so a file's blocks scatter and sequential reads slow down. ZFS fights
this with large caches (the ARC) and clever allocation; btrfs offers explicit defragmentation. It is the same
space-and-fragmentation trade that
The seductive picture of COW is "just write the new block somewhere else." But the parent pointer must change to
find that new block, which means the parent is rewritten, which changes its parent, all the way up. So a
one-byte change to a leaf in a tree of height
COW, journaling, and log-structured design are three answers to the one crash-consistency question, and they
share DNA: all three refuse to trust an in-place overwrite as atomic. But even a perfectly consistent COW file
system still faces the last problem in this module — when