null

ZFS Scrub

Enterprise Resource Center • ZFS Knowledge Base

ZFS Scrub

A ZFS scrub is a pool-wide data-integrity operation that reads stored data and verifies its checksums. Scrubbing helps discover latent corruption that may otherwise remain undetected until the affected data is eventually accessed.

ZFS Scrub Checksums Data Integrity Pool Maintenance OpenZFS
Tech Supply Direct
Quick Answer

What Is a ZFS Scrub?

A ZFS scrub reads data in a storage pool and verifies each block against its stored checksum to identify corruption. When valid redundant data is available from a mirror, RAIDZ, dRAID, or another supported redundant copy, ZFS can use that redundancy to repair damaged data discovered during the scrub.

Scrubs are particularly valuable for finding latent errors in blocks that may not have been read during normal system activity for an extended period.

How It Works

How Does a ZFS Scrub Work?

ZFS protects blocks with checksums. During a scrub, the pool is systematically examined so stored blocks can be verified instead of waiting for normal applications to eventually read them.

STEP 01

Scan the Pool

ZFS identifies the allocated data that needs to be examined during the scrub operation.

STEP 02

Read the Blocks

Stored data is read from the pool so ZFS can validate its integrity.

STEP 03

Verify Checksums

ZFS compares the data that was read with the checksum associated with the block.

STEP 04

Repair When Possible

If corruption is detected and a valid redundant copy can be reconstructed, ZFS can repair the damaged data.

Data Integrity

ZFS Scrubbing Relies on End-to-End Checksums

ZFS calculates checksums when blocks are written and stores checksum information so data can later be verified. When data is read during a scrub, ZFS can determine whether the returned data matches what was originally expected.

Checksum Matches The block passes its integrity verification.
Checksum Mismatch ZFS knows the returned data does not match the expected block.
Redundancy Available ZFS can obtain or reconstruct valid data from available redundancy and repair the damaged copy.
No Valid Redundancy ZFS can detect the corruption but may be unable to reconstruct the affected data.
Why Scrubbing Matters

Finding Latent Data Corruption

Some stored blocks may go months or years without being accessed. Without periodically reading those blocks, latent media problems may remain undiscovered.

Latent Errors Scrubbing intentionally reads stored data that normal workloads may rarely access.
Checksum Verification Data is validated rather than assumed to be correct simply because the storage device returned it.
Self-Healing Redundant pools can use a known-good copy or parity reconstruction to repair certain damaged blocks.
Proactive Maintenance Regular scrubbing helps expose storage problems before affected data is urgently needed.
Self-Healing

Can a ZFS Scrub Repair Corrupted Data?

Yes — when ZFS has sufficient valid redundancy. If a block fails checksum verification and another valid copy or parity reconstruction is available, ZFS can use the correct data and repair the damaged copy.

This is one of the major advantages of combining ZFS checksums with redundant storage. ZFS does not merely know that a block is wrong; in a properly redundant pool, it can often determine which version is valid and repair the damaged data.

Mirror A valid copy from another mirror member can be used when sufficient redundancy remains.
RAIDZ Data and parity can be used to reconstruct damaged information when the VDEV remains within its fault tolerance.
No Redundancy ZFS can still detect checksum corruption, but detection alone does not provide another valid copy from which the data can be repaired.
Important Difference

ZFS Scrub vs Resilver

Scrubbing and resilvering both read storage and perform integrity-related work, but they serve different purposes.

Characteristic ZFS Scrub ZFS Resilver
Primary Purpose Verify pool data integrity Restore data known to be missing or out of date
Typical Trigger Scheduled or manually initiated maintenance Device replacement, attachment or return to service
Scope Examines pool data for integrity errors Examines data ZFS knows requires reconstruction
Checksum Verification Core purpose of a normal scrub Depends on reconstruction method
I/O Intensive Yes Yes
Run Simultaneously? No — scrub and resilver do not run concurrently No — resilver takes precedence
Administration

Common ZFS Scrub Commands

OpenZFS provides commands for starting, monitoring, pausing and stopping a pool scrub.

START A SCRUB
zpool scrub poolname
CHECK STATUS
zpool status poolname
PAUSE A SCRUB
zpool scrub -p poolname
STOP A SCRUB
zpool scrub -s poolname
Replace poolname with the actual name of the ZFS storage pool. A paused scrub can be resumed by issuing the normal zpool scrub poolname command again.
Monitoring

How to Check ZFS Scrub Status

The zpool status command reports scrub progress while the operation is running and summarizes the results after it completes.

Scan Status Shows whether a scrub is running, completed, paused or otherwise inactive.
Progress Reports how much of the operation has been scanned and issued for scrub I/O.
Repair Information Reports whether data was repaired during the scan.
Device Errors READ, WRITE and CKSUM counters can help identify storage or data-integrity problems requiring investigation.
Understanding Results

READ, WRITE & CKSUM Errors

ZFS reports several types of device errors through zpool status. These counters provide useful clues when investigating storage hardware and data-integrity problems.

READ
Read Errors I/O errors encountered while attempting to read information from a device.
WRITE
Write Errors I/O errors encountered while attempting to write information to a device.
CKSUM
Checksum Errors Data was returned by the storage path but did not match the checksum ZFS expected.
Maintenance Schedule

How Often Should You Scrub a ZFS Pool?

There is no single scrub interval that is ideal for every ZFS system. The appropriate schedule depends on storage media, workload, pool size, hardware reliability, operational load and how quickly administrators want latent errors to be discovered.

Regular periodic scrubbing is generally preferable to leaving rarely accessed data unchecked indefinitely. Administrators should choose a schedule that provides useful integrity verification without creating unnecessary workload during important production periods.

Pool Size Larger pools may require substantially more time and I/O to complete a scrub.
Workload Production workload patterns should be considered when scheduling I/O-intensive maintenance.
Storage Media Device type, age, performance and reliability can influence maintenance strategy.
Risk Requirements More important datasets may justify more frequent proactive integrity verification.
Performance Consideration

Does a ZFS Scrub Affect Performance?

A scrub generates substantial storage I/O because ZFS must read allocated data throughout the pool. Depending on the storage hardware and workload, this additional activity can compete with normal application I/O.

Administrators of performance-sensitive systems may therefore schedule scrubs during periods of lower activity and monitor application latency while the scrub is running.

Pool Architecture

Scrubbing Works With Your ZFS Redundancy

Scrubbing can detect corruption regardless of whether the pool is redundant. Automatic repair, however, depends on ZFS having valid redundant information available.

Important Distinction

A ZFS Scrub Is Not a Backup

Scrubbing verifies the integrity of data already stored in the pool. It does not create an independent historical copy of that data and therefore does not replace a backup strategy.

A scrub cannot independently recover a file that was legitimately deleted, overwritten or changed before the scrub began. Important data should still be protected with backups appropriate for the required recovery objectives.

Frequently Asked Questions

ZFS Scrub FAQ

What does a ZFS scrub do?

A scrub examines data in the ZFS pool and verifies block checksums to detect corruption.

Does a ZFS scrub repair errors?

ZFS can automatically repair damaged data discovered during a scrub when sufficient valid redundancy is available.

What command starts a ZFS scrub?

Use zpool scrub poolname, replacing poolname with the name of the storage pool.

How do I check scrub progress?

Use zpool status. The scan section reports scrub progress and results.

Can I pause a ZFS scrub?

Yes. OpenZFS supports pausing a scrub with zpool scrub -p poolname.

Can a scrub and resilver run at the same time?

No. Both operations are I/O intensive and OpenZFS allows only one scrub or resilver operation at a time.

Does scrubbing slow down a ZFS pool?

It can. A scrub generates substantial read activity and may compete with normal workloads for storage resources.

Can ZFS detect corruption without redundancy?

Yes. Checksums can identify corrupted data, but without another valid copy or suitable redundancy ZFS may not be able to repair it.

Is a ZFS scrub the same as a backup?

No. Scrubbing validates stored data integrity. It does not create an independent recoverable copy of the data.

Enterprise Storage Hardware

Building or Maintaining a ZFS Storage System?

Tech Supply Direct can help identify compatible enterprise hard drives, SSDs, memory and server hardware for ZFS storage systems based on your platform, workload, capacity and redundancy requirements.