30.5. Health Checks and Device Replacement
ZFS expects to detect and repair corruption continuously. Checksums are verified on read, scrubs verify all blocks proactively, and redundant vdevs provide another copy to repair from. None of that removes the need to watch error counters, replace failing devices, and keep an independent backup.
30.5.1. Checksums, Scrubs, Error Counters, and Event Monitoring
The checksum property controls the algorithm used for new blocks:
# zfs get -o property,value,source checksum tank/data
PROPERTY VALUE SOURCE
checksum on default
on selects the default Fletcher-4 checksum on this build. The alternatives
trade CPU cost for stronger detection:
| Value | Relative cost | Use |
|---|---|---|
off |
None | Almost never; disables end-to-end verification |
fletcher2 |
Low | Legacy compatibility |
fletcher4 |
Low | Default and a good general choice |
sha256 |
Moderate | Stronger integrity where CPU is available |
sha512 |
Moderate | Stronger integrity; supported by the sha512 feature |
skein |
Moderate | Alternative strong hash; supported by the skein feature |
edonr |
Moderate | Alternative strong hash; supported by the edonr feature |
blake3 |
Moderate | Modern cryptographic hash; requires the blake3 feature where available |
Checksums detect corruption, but repair requires redundancy. A single-disk pool
with a bad checksum can report the error but cannot reconstruct the data. A
mirror or RAIDZ vdev can read another copy or reconstruct from parity, then
rewrite the bad block. The CKSUM counter in zpool status records detected
checksum errors; a scrub is the proactive check.
Start a scrub:
# zpool scrub tank
The command is silent and returns immediately; the scrub runs in the background. Status reports the result:
# zpool status tank
pool: tank
state: ONLINE
scan: scrub repaired 0B in 00:00:01 with 0 errors on Tue Nov 24 15:00:52 2026
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
vdb ONLINE 0 0 0
vdc ONLINE 0 0 0
errors: No known data errors
repaired 0B and 0 errors mean the scrub found nothing to fix. On a larger
pool the scan line shows progress and an estimated completion time. Wait for
the scrub to finish before relying on the result:
# zpool wait -t scrub tank
The command is silent when the scrub completes. A verbose status includes the error list:
# zpool status -v tank
pool: tank
state: ONLINE
scan: scrub repaired 0B in 00:00:01 with 0 errors on Tue Nov 24 15:00:52 2026
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
vdb ONLINE 0 0 0
vdc ONLINE 0 0 0
errors: No known data errors
A health summary across all pools is:
# zpool status -x
all pools are healthy
Schedule scrubs according to data size and change rate. A monthly scrub is a
common default for small pools; large pools may need a longer interval to avoid
constant scanning. Avoid running a scrub during peak I/O, and do not run
multiple scrubs on the same pool at once. zpool scrub -s pool stops a scrub;
zpool scrub -p pool pauses it. A paused scrub resumes with another
zpool scrub command.
ZFS also emits events for pool history, import/export, vdev state changes, and errors. The event log is useful when a failure happened while nobody was watching:
# zpool events -v | sed -n '1,28p'
TIME CLASS
Nov 24 2026 14:48:33.520222512 sysevent.fs.zfs.history_event
version = 0x0
class = "sysevent.fs.zfs.history_event"
pool = "raidpool"
pool_guid = 0xdc139071ad72681d
pool_state = 0x0
pool_context = 0x0
history_hostname = "zfs1"
history_internal_str = "pool version 5000; software version zfs-2.3.9-0-g4c0eb72-dist; uts zfs1 6.12.118+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.118-1 (2026-11-20) x86_64"
history_internal_name = "open"
history_txg = 0x95
history_time = 0x6b05a3c1
time = 0x6b05a3c1 0x1f01f730
eid = 0x1
Nov 24 2026 14:48:34.372218754 sysevent.fs.zfs.config_sync
version = 0x0
class = "sysevent.fs.zfs.config_sync"
pool = "raidpool"
pool_guid = 0xdc139071ad72681d
pool_state = 0x0
pool_context = 0x0
time = 0x6b05a3c2 0x162f9b82
eid = 0x2
Nov 24 2026 14:48:34.372218754 sysevent.fs.zfs.pool_import
version = 0x0
The sed command only limits the output to the first 28 lines; the full event
log can be long. zpool events -c clears the log, so archive it before clearing
if you need a history. The zfs-zed service consumes these events and can run
scripts configured under /etc/zfs/zed.d/. A common use is to send a mail or
alert when a vdev becomes degraded or a scrub finds errors. ZED is not a
replacement for external monitoring: it runs on the same host, so a host that
is down cannot report its own failure.
30.5.2. Offlining and Replacing a Member and Following Resilvering
A device can be taken offline administratively for testing or maintenance. The pool remains available if the remaining redundancy is sufficient. Check the replacement policy first:
# zpool get autoreplace tank
NAME PROPERTY VALUE SOURCE
tank autoreplace off default
autoreplace=off means device replacement must be initiated with
zpool replace rather than happening automatically when a new disk appears in
the failed device's slot. Take one mirror leg offline:
# zpool offline tank /dev/vdc
# zpool status tank
pool: tank
state: DEGRADED
status: One or more devices has been taken offline by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using 'zpool online' or replace the device with
'zpool replace'.
scan: scrub repaired 0B in 00:00:01 with 0 errors on Tue Nov 24 15:00:52 2026
config:
NAME STATE READ WRITE CKSUM
tank DEGRADED 0 0 0
mirror-0 DEGRADED 0 0 0
vdb ONLINE 0 0 0
vdc OFFLINE 0 0 0
errors: No known data errors
The pool is DEGRADED because one mirror leg is offline, but the data is still
available. Read a file to confirm service continuity:
$ cat /tank/data/docs/report.txt
original
Replace the offline device with a new disk. The pool is still using /dev/vdc
as the logical member; zpool replace attaches /dev/vdf and resilvers the
mirror:
# zpool replace tank /dev/vdc /dev/vdf
# zpool status tank
pool: tank
state: ONLINE
scan: resilvered 321M in 00:00:08 with 0 errors on Tue Nov 24 15:01:28 2026
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
vdb ONLINE 0 0 0
vdf ONLINE 0 0 0
errors: No known data errors
The replace command returns after starting the resilver. On this small pool the
status query already shows completion; on a larger pool, the same status would
show a resilver in progress line with a percentage and an estimated time.
zpool replace -w waits for completion instead of returning immediately.
zpool replace -s requests a sequential resilver, which can be faster for some
workloads but is not supported for every vdev type. -f forces replacement of
a device that appears in use; use it only after confirming the old device is
really gone.
The pool now uses /dev/vdb and /dev/vdf:
# zpool list -v tank
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
tank 960M 319M 641M - - 14% 33% 1.00x ONLINE -
mirror-0 960M 319M 641M - - 14% 33.2% - ONLINE
vdb 1014M - - - - - - - ONLINE
vdf 1014M - - - - - - - ONLINE
/dev/vdc is no longer a member. The old device can be returned to service
later only after it is wiped and added as a new member; do not put it back into
the pool with stale labels. If the failed device is physically replaced in the
same slot, zpool replace tank /dev/vdc with no new device uses the same path
after the hardware swap. That form is common when the controller assigns the
same name to the replacement disk.
The relevant commands are:
| Command | Description |
|---|---|
zpool offline pool device |
Marks a device offline; the pool degrades if redundancy is reduced |
zpool online pool device |
Brings an offline device back; a resilver may be needed |
zpool replace pool old new |
Replaces a member with a new device and resilvers |
zpool replace pool device |
Reuses the same path after physical replacement |
zpool replace -w ... |
Waits for the replacement resilver to finish |
zpool replace -s ... |
Requests a sequential resilver where supported |
zpool detach pool device |
Removes a mirror leg, reducing redundancy |
zpool clear pool |
Clears error counters after the cause is fixed |
A replacement is not complete just because the status shows 100%. Wait for the
resilver line to report completion and for zpool status -x to report the pool
healthy. On a mirror, the pool can tolerate another failure during the resilver
only if a third leg exists; on a two-way mirror, a second failure during the
resilver loses the pool. This is why mirror pools with important data often use
three-way mirrors or keep a cold spare ready.
30.5.3. Degraded Pools, Unavailable Devices, and Recovery Choices
A degraded pool is still serving data, but its redundancy is reduced. A pool with an unavailable device may be serving data if another copy exists, or may be unable to import if too many members are missing. The status text distinguishes the states:
| State | Meaning | Typical action |
|---|---|---|
ONLINE |
Device is present and healthy | None |
DEGRADED |
Pool or vdev has lost redundancy but is still available | Replace or online the missing device |
OFFLINE |
Administrator took the device offline | Online it or replace it |
FAULTED |
Device is inaccessible or has fatal errors | Replace it; do not expect data from it |
UNAVAIL |
Device cannot be opened or is missing | Check cabling, power, and device paths; replace if needed |
REMOVED |
Device was removed from a mirror or pool | Confirm the removal was intentional |
The degraded-state check needs some data to read back. On zfs1, as root,
create a dataset on the RAIDZ pool and make it writable by john:
# zfs create raidpool/keep
# chown john:john /raidpool/keep
Both commands are silent. In john's shell, write a file:
$ echo redundancy > /raidpool/keep/value.txt
The write is silent. Take a RAIDZ member offline to see the degraded state:
# zpool offline raidpool /dev/vde
# zpool status raidpool
pool: raidpool
state: DEGRADED
status: One or more devices has been taken offline by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using 'zpool online' or replace the device with
'zpool replace'.
scan: scrub repaired 0B in 00:00:00 with 0 errors on Tue Nov 24 14:53:25 2026
expand: expanded raidz1-0 copied 1.14M in 00:00:04, on Tue Nov 24 14:53:25 2026
config:
NAME STATE READ WRITE CKSUM
raidpool DEGRADED 0 0 0
raidz1-0 DEGRADED 0 0 0
vdd ONLINE 0 0 0
vde OFFLINE 0 0 0
vdg ONLINE 0 0 0
errors: No known data errors
The data is still readable while one RAIDZ1 member is missing:
$ cat /raidpool/keep/value.txt
redundancy
Bring the member back online:
# zpool online raidpool /dev/vde
# zpool wait -t resilver raidpool
# zpool status -x raidpool
pool 'raidpool' is healthy
The online and wait commands are silent; the status query reports health.
If a device was replaced rather than temporarily offline, use zpool replace
instead of zpool online. If the pool is faulted because a device is missing,
do not run zpool clear in the hope of making it healthy; clear only clears
counters after the underlying problem is fixed.
Recovery choices depend on how many members are missing and whether the data has an independent copy:
| Situation | First action | If that fails |
|---|---|---|
| One mirror leg offline or failed | Online or replace the leg; let it resilver | Restore from a replica if the surviving leg is also bad |
| One RAIDZ1 member failed | Replace the member; pool remains available | Restore from backup if a second member fails before resilver completes |
| Two RAIDZ2 members failed | Replace both; pool remains available | Restore from backup if a third member fails |
| Too many members missing for the vdev | Do not force-import repeatedly; preserve the devices | Restore from the most recent verified replica or stream |
| Pool imported on another host | Export there or disconnect it; do not import concurrently | Use multihost and host identity checks to prevent recurrence |
| Device paths changed after reboot | Import by pool ID or by-id path | Update the pool configuration and boot cache after recovery |
zpool import -f can force an import when ZFS thinks the pool is active
elsewhere. It is appropriate only after verifying that the other host is not
using the storage. zpool labelclear removes labels from a device that is no
longer part of a pool; running it on an active member destroys the pool's
metadata on that device. Keep a record of the original device paths and pool
GUIDs before any recovery attempt.
If the pool cannot be imported because a device is missing, attach the missing device or a replacement with the same or larger size and import in read-only mode first if the tools support it. A read-only import lets you copy data off before making changes. Do not run a scrub or resilver on a pool with known hardware problems until the failing component is isolated; the extra I/O can turn a recoverable situation into a lost pool.
30.5.4. Distinguishing Redundancy, Snapshots, and Independent Backups
The previous sections show three different protections that are easy to confuse:
| Mechanism | Lives where | Survives | Does not survive |
|---|---|---|---|
| Mirror or RAIDZ | Inside the pool, across devices | A device failure within the redundancy limit | Pool loss, controller failure affecting all members, deletion, corruption copied to all members |
| Snapshot | Inside the pool, as a read-only point in time | Accidental change or deletion while the snapshot exists | Pool loss, device failure beyond redundancy, site loss |
| Replica or stream on another host | Separate pool or media | Pool loss, host loss, many operational errors | Site loss if co-located, loss of the encryption key, an untested restore |
A snapshot on the same pool is not an independent backup. If the pool is
destroyed, the snapshot goes with it. A mirror is not a backup either: a
mistaken zfs destroy -r removes the dataset from every mirror leg. The
replication exercise in Section 30.4.5 showed the difference: after
zfs destroy -r tank/protect, the source dataset was gone, but the replica on
zfs2 still contained the snapshot and the file.
A practical data-protection plan combines all three:
- Use mirror or RAIDZ vdevs to survive disk failure and repair checksum errors.
- Take snapshots on a schedule matched to the recovery point objective, and keep enough history to recover from user error.
- Replicate snapshots to an independent host or media, verify the stream, and test a restore.
- Protect encryption keys separately from the data; a replica without its key is not restorable.
- Monitor scrubs, error counters, capacity, and replication status; a backup that silently stopped running is not a backup.
The next section covers the boot and service integration that makes these pools available after a reboot, and the recovery paths when the ZFS module or pool import fails.