ZFS, Actually Storage you can finally reason about.

Replacing a Disk

procedure
depth 2/3 − deeper + surface

A 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:

  1. Identify beyond doubt. Map the failed device to a physical serial number (zpool status names 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 with by-id paths, not /dev/sdX names that reshuffle across reboots.
  2. Swap the hardware (hot-swap bays or a powered-off swap—either is fine; the pool imports degraded and waits).
  3. 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.
  4. 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.