Understanding ZFS Scrubs and Data Integrity

https://news.ycombinator.com/rss Hits: 12
Summary

ZFS refuses to trust anything it cannot verify, whereas most filesystems assume that storage hardware will return the correct data unless it reports an error, ZFS makes no such assumptions: every block must be proven correct. That difference matters, because silent corruption is one of the most dangerous failure modes in modern storage—by the time you notice it, the damage is already done. ZFS checks everything it stores, keeps the checksums inside the parent block pointers, and leans on redundancy to repair anything that does not match. Scrubs are a specialized patrol read that walks the entire pool and confirms that the data still matches the record of what should be there. In this article, we will walk through what scrubs do, how the Merkle tree layout lets ZFS validate metadata and data from end to end, how redundancy ties into checksum repair, and why scrubs are not the same as resilvers. What Are ZFS Scrubs? A ZFS scrub is a pool-wide verification procedure that reads every allocated block of data and metadata, and checks it against its stored checksum. This verification includes metadata blocks, user data blocks, and even the parity blocks ZFS stores to be able to recover from checksum errors. Many descriptions of scrubs incorrectly imply that only user data is checked, but on the contrary, ZFS treats metadata with the same level of protection, and a scrub verifies both thoroughly.During a scrub, ZFS walks the entire tree of block pointers that make up the dataset. ZFS is built around a Merkle tree structure in which each parent block contains block pointers for its children, and each block pointer contains the checksum for the block it references. The parent checksum therefore protects the child metadata. This recursive structure continues downward until the physical blocks on disk. If a leaf block is corrupted, the mismatch propagates upward, making it impossible for corruption to hide. When scrub reads a block, it recalculates the checksum from the data re...

First seen: 2026-01-20 04:32

Last seen: 2026-01-20 15:34