Replacing a Disk
procedureA disk has died. The instinct is either panicked speed or frozen
paralysis. Actually, a pool that lost a disk is stable and still
serving—the procedure is unhurried, and the danger that actually bites
people is imprecision: pulling the wrong disk out of a machine full of
identical-looking drives. The command itself is one line: zpool replace "is equivalent to attaching new-device, waiting for it to
resilver, and then detaching device" (zpool-replace(8)). Everything around
that one line is about being absolutely sure which physical object you're
touching.
⚠ DESTRUCTIVE—verify before running: zpool replace wipes and takes
over the new disk, and pulling the wrong disk from a pool that's already
down one can kill the pool. Semantics per zpool-replace(8).
The procedure:
- Identify beyond doubt. Map the failed device to a physical serial
number (
zpool statusnames the device; smartctl or /dev/disk/by-id gives the serial printed on the label). This step is the whole game—this is why pools should be built withby-idpaths, not/dev/sdXnames that reshuffle across reboots. - Swap the hardware (hot-swap bays or a powered-off swap—either is fine; the pool imports degraded and waits).
zpool replace tank <old-device> <new-device>—the new disk must be at least "the minimum size of all the devices" in the vdev (zpool-replace(8)). Resilver begins immediately; the pool serves throughout.- Watch it finish (
zpool status), then scrub to certify the whole pool. Note: starting the replace "cancels any in-progress scrub" (man page)—resilver first, scrub after, not the reverse.