Skip to content
Get a quote

Reliability

ZFS data integrity: checksums, scrubs and silent corruption

Drives and cables occasionally return wrong data without reporting an error. ZFS checksums every block, repairs from redundancy and scrubs to find problems early.

Panaro Tech · · 7 min read

ZFS data integrity features exist because storage hardware is not perfectly honest. Drives, controllers, cables and memory occasionally return data that differs from what was written, and do so without reporting any error. Traditional RAID cannot tell which copy is right: it assumes that if the drive did not complain, the data is good.

For archives, medical images, research data and financial records, a file that silently changes is worse than one that is visibly lost, because nobody knows to restore it. This post explains how ZFS detects and repairs such corruption, what a scrub does, and how to run and read scrubs on a NAS built on ZFS, such as Awanstor SDS.

What silent data corruption is

Silent corruption, sometimes called bit rot, means data read back is wrong but no component reports a failure. Common causes include:

  • Sectors that degrade on the platter or in flash over time.
  • Firmware bugs that write data to the wrong location, or report a write as complete when it was not (lost writes).
  • Faulty cables, backplanes or controllers corrupting data in flight.
  • Memory errors in systems without ECC RAM.

Each event is rare, but across many drives and many years, rare becomes likely. The danger is that corruption sits unnoticed until the file is opened, by which time every backup may hold the same damaged copy.

How ZFS checksums work

ZFS calculates a checksum for every block it writes, data and metadata alike. Crucially, the checksum is not stored alongside the block; it is stored in the parent block pointer that references it. Those parents are themselves checksummed by their parents, all the way up to the root of the pool. The result is a Merkle tree: the whole pool can be validated from the top.

Storing checksums apart from the data is what catches the hard cases. A misdirected write puts correct-looking data in the wrong place; a lost write leaves stale data. In both cases the block on disk is internally consistent, but it does not match the checksum its parent expects, so ZFS notices.

Self-healing reads

On every read, ZFS verifies the checksum. If it does not match and the pool has redundancy (a mirror or raidz), ZFS reads the other copy or reconstructs from parity, checks that the result matches, returns correct data to the application, and rewrites the bad block. The application never sees the error; the event is counted in the pool status.

Without redundancy, ZFS still detects the error and reports which file is damaged, rather than returning wrong data silently. That is why single-drive pools are fine for scratch data but not for anything you care about.

Copy-on-write: no half-written blocks

ZFS never overwrites live data in place. Changes go to new blocks, and the pointer tree is updated last, atomically. A power failure mid-write leaves the old consistent state intact, so ZFS does not need a lengthy file system check after a crash. The same mechanism makes snapshots cheap, which is why they underpin ransomware recovery on ZFS.

ZFS also avoids the RAID 5 write hole, where a crash between writing data and parity leaves them inconsistent, because each raidz stripe is written as a whole into new space.

Scrubs: checking data nobody is reading

Self-healing only works on blocks that are read. Archive data may sit untouched for years. A scrub walks every allocated block in the pool, verifies every checksum, and repairs any block that fails from redundancy.

  • Frequency: a common practice is monthly for enterprise drives and every two weeks for desktop-class drives; whatever you choose, schedule it.
  • Duration: proportional to allocated data, not raw capacity. A half-full pool scrubs in roughly half the time of a full one.
  • Impact: scrubs run at lower priority, but on busy systems schedule them for nights or weekends.
  • Before risky work: run a scrub before replacing drives or expanding a pool, so you start from verified data.

Reading scrub results

ResultMeaningAction
0 errors, nothing repairedAll blocks verifiedNone
Some bytes repaired, one drive shows CKSUM errorsBad data found and fixed from redundancyCheck that drive's SMART data, cable and slot; watch for repeats
Rising errors on one drive across scrubsDrive or path is degradingReplace the drive or fix the path
Errors across many drives at onceCommon component: controller, backplane, cable, power or RAMInvestigate shared hardware before swapping drives
Permanent errors listed for filesNo good copy existedRestore those files from backup

Scrubs complement, not replace, drive health monitoring; see designing storage for uptime for alerting.

The rest of the chain: ECC memory

ZFS protects data from the moment it computes the checksum in RAM. If memory flips a bit before that, ZFS will faithfully checksum and store corrupted data. ECC memory detects and corrects single-bit errors, closing that gap. Every Panaro storage series uses ECC memory: DDR4 ECC on the JP series and DDR5 ECC on the CL series, for example.

Integrity beyond the pool: replication and backups

Checksums protect data inside one pool. Data also moves: to a replica, a backup system or new hardware at the end of a system's life. Each move is a chance for corruption to slip in.

  • ZFS replication sends snapshots as a stream that is verified on receipt, and the receiving pool checksums blocks as it writes them. Corruption in transit is detected rather than stored.
  • File-level copies with general tools do not carry ZFS checksums across. For important migrations, compare hashes of source and destination files after copying.
  • Backups should be verified by the backup software after writing, and the backup target should itself be scrubbed if it runs ZFS.

Choosing the checksum and record size

The default checksum algorithm in current OpenZFS is fast and suitable for almost all workloads; stronger cryptographic hashes are available and are required for some features such as deduplication. Leave the default unless your vendor recommends otherwise. Record size affects performance and space efficiency more than integrity: large records suit video and backups, smaller ones suit databases and virtual machine disks.

What a healthy pool looks like over time

Keep a simple record of each scrub: date, duration, bytes repaired and any drive with errors. A pool that shows zero repairs month after month, with scrub time growing in line with data, is healthy. A sudden increase in scrub duration can indicate a slow drive; a single repair is worth noting; a pattern of repairs on the same drive is a signal to replace it before it fails outright.

Checklist: integrity questions for any storage purchase

  • Does the file system checksum data as well as metadata, and where are checksums stored?
  • Will the system repair bad blocks automatically from redundancy?
  • Is a scrub or patrol read scheduled by default? How often?
  • How are checksum errors reported and alerted?
  • Does the server use ECC memory?
  • Does replication or backup verify data integrity at the target?

Awanstor NAS systems run ZFS-based Awanstor SDS on ECC-equipped Panaro hardware; see the Awanstor NAS range. If you are moving long-term archives to new storage, send your requirement and we will suggest a pool layout and scrub schedule.

Frequently asked questions

What does a ZFS scrub do?

A scrub reads every allocated block in the pool and verifies it against its stored checksum. Any block that fails is repaired from a mirror copy or parity, and the result is reported in the pool status. It finds corruption in data that has not been read recently, before you need it.

How often should I scrub a ZFS pool?

A common practice is monthly for enterprise-class drives and every two weeks for desktop-class drives. Schedule scrubs during quieter hours on busy systems, and run one before replacing drives or expanding a pool so that you start from verified data.

Can traditional RAID detect silent corruption?

Usually not reliably. Hardware RAID trusts that a drive returning data without an error is correct. It may detect parity mismatches during a check, but often cannot tell which copy is right. ZFS stores checksums separately from data, so it knows which copy is good and repairs the other.

Does ZFS need ECC memory?

ZFS works without ECC, but memory errors that occur before a checksum is calculated can corrupt data that ZFS then stores as valid. ECC memory detects and corrects single-bit errors, closing that gap, so it is strongly recommended for any server holding important data.