Activating and Deactivating Hot Spares in Your Storage
Pool

Manual replacement – You replace a failed device in
a storage pool with a hot spare by using the zpool replace command.

Automatic replacement – When a fault is detected, an
FMA agent examines the pool to determine if it has any available hot spares.
If so, it replaces the faulted device with an available spare.

If
a hot spare that is currently in use fails, the FMA agent detaches the spare
and thereby cancels the replacement. The agent then attempts to replace the
device with another hot spare, if one is available. This feature is currently
limited by the fact that the ZFS diagnostic engine only generates faults when
a device disappears from the system.

If you physically replace a failed device with an active spare, you
can reactivate the original device by using the zpool detach command
to detach the spare. If you set the autoreplace pool property
to on, the spare is automatically detached and returned
to the spare pool when the new device is inserted and the online operation
completes.

You can manually replace a device with a hot spare by using the zpool
replace command. See Example 4–8.

A faulted device is automatically replaced if a hot spare is available.
For example:

Example 4–10 Detaching a Failed Disk and Using the Hot Spare

If you want to replace a failed disk by temporarily or permanently swap
in the hot spare that is currently replacing it, then detach the original
(failed) disk. If the failed disk is eventually replaced, then you can add
it back to the storage pool as a spare. For example: