Replacing Devices in a Storage Pool

You can replace a device in a storage pool by using the zpool replace command.

$ zpool replace pool replaced-device [new-device]

If you are installing a device's replacement on the same location in a redundant pool, you might only need to identify the replaced device. On some hardware, ZFS recognizes the new device on the same location. However, if you install the replacement on a different location, you must specify both the replaced device and the new device.

The automatic detection of replaced devices is hardware-dependent and might not be supported on all platforms. Furthermore, some hardware types support the autoreplace pool property. If this property is enabled, then a device's replacement on the same location is automatically formatted and replaced. Running the zpool replace command is unnecessary.

Note the following guidelines:

  • A hot spare device, if available, automatically replaces a device that is removed while the system is running. After a failed disk is replaced, you might need to detach the spare by using the zpool detach command. For information about detaching a hot spare, see Activating and Deactivating Hot Spares in Your Storage Pool.

  • A device that is removed and then reinserted is automatically brought online. In this case, no replacement occurred. The replacement hot spare device is automatically removed after the reinserted device is brought back online.

When you replace a device with one that has a larger capacity, the new device is not automatically expanded to its full size after you add it to the pool. The autoexpand pool property determines the automatic expansion of a replacement LUN. By default, this property is disabled. You can enable it before or after the larger LUN is added to the pool.

On some systems with SATA disks, you must unconfigure a disk before you can take it offline. If you are replacing a disk in the same slot position on this system, then you can just run the zpool replace command as described in Replacing Devices in a Mirrored Poolthe first example in this section. For an example of replacing a SATA disk, see Replacing a SATA Disk in a ZFS Storage Pool.

Because of the resilvering of data onto new disks, replacing disks is time-consuming. Between disk replacements, run the zpool scrub command to ensure that the replacement devices are operational and that the data is written correctly.

For more information about replacing devices, see Resolving a Missing or Removed Device and Replacing or Repairing a Damaged Device.