Managing ZFS File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: December 2014
 
 

Replacing Devices in a Storage Pool

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

If you are physically replacing a device with another device in the same location in a redundant pool, then you might only need to identify the replaced device. On some hardware, ZFS recognizes that the device is a different disk in the same location. For example, to replace a failed disk (c1t1d0) by removing the disk and replacing it in the same location, use the following syntax:

# zpool replace tank c1t1d0

If you are replacing a device in a storage pool with a disk in a different physical location, you must specify both devices. For example:

# zpool replace tank c1t1d0 c1t2d0

If you are replacing a disk in the ZFS root pool, see How to Replace a Disk in a ZFS Root Pool (SPARC or x86/VTOC).

    The following are the basic steps for replacing a disk:

  1. Offline the disk, if necessary, with the zpool offline command.

  2. Remove the disk to be replaced.

  3. Insert the replacement disk.

  4. Review the format output to determine if the replacement disk is visible.

    In addition, check to see whether the device ID has changed. If the replacement disk has a WWN, then the device ID for the failed disk is changed.

  5. Let ZFS know the disk is replaced. For example:

    # zpool replace tank c1t1d0

    If the replacement disk has a different device ID as identified above, include the new device ID.

    # zpool replace tank c0t5000C500335FC3E7d0 c0t5000C500335BA8C3d0
  6. Bring the disk online with the zpool online command, if necessary.

  7. Notify FMA that the device is replaced.

    From fmadm faulty output, identify the zfs://pool=name/vdev=guid string in the Affects: section and provide that string as an argument to the fmadm repaired command.

    # fmadm faulty
    # fmadm repaired zfs://pool=name/vdev=guid

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 the first example in this section.

For an example of replacing a SATA disk, see Example 10–1.

    Consider the following when replacing devices in a ZFS storage pool:

  • If you set the autoreplace pool property to on, then any new device found in the same physical location as a device that previously belonged to the pool is automatically formatted and replaced. You are not required to use the zpool replace command when this property is enabled. This feature might not be available on all hardware types.

  • The storage pool state REMOVED is provided when a device or hot spare has been physically removed while the system was running. A hot spare device is substituted for the removed device, if available.

  • If a device is removed and then reinserted, the device is placed online. If a hot spare was activated when the device was reinserted, the hot spare is removed when the online operation completes.

  • Automatic detection when devices are removed or inserted is hardware-dependent and might not be supported on all platforms. For example, USB devices are automatically configured upon insertion. However, you might have to use the cfgadm –c configure command to configure a SATA drive.

  • Hot spares are checked periodically to ensure that they are online and available.

  • The size of the replacement device must be equal to or larger than the smallest disk in a mirrored or RAID-Z configuration.

  • When a replacement device that is larger in size than the device it is replacing is added to a pool, it is not automatically expanded to its full size. The autoexpand pool property value determines whether a replacement LUN is expanded to its full size when the disk is added to the pool. By default, the autoexpand property is disabled. You can enable this property to expand the LUN size before or after the larger LUN is added to the pool.

    In the following example, two 16-GB disks in a mirrored pool are replaced with two 72-GB disks. Ensure that the first device is completely resilvered before attempting the second device replacement. The autoexpand property is enabled after the disk replacements to expand the full disk sizes.

    # zpool create pool mirror c1t16d0 c1t17d0
    # zpool status
    pool: pool
    state: ONLINE
    scrub: none requested
    config:
    
    NAME            STATE     READ  WRITE  CKSUM
    pool            ONLINE       0      0      0
       mirror       ONLINE       0      0      0
          c1t16d0   ONLINE       0      0      0
          c1t17d0   ONLINE       0      0      0
    
    zpool list pool
    NAME   SIZE   ALLOC  FREE    CAP  HEALTH  ALTROOT
    pool  16.8G  76.5K  16.7G     0%  ONLINE  -
    # zpool replace pool c1t16d0 c1t1d0
    # zpool replace pool c1t17d0 c1t2d0
    # zpool list pool
    NAME   SIZE   ALLOC  FREE    CAP  HEALTH  ALTROOT
    pool  16.8G  88.5K  16.7G     0%  ONLINE  -
    # zpool set autoexpand=on pool
    # zpool list pool
    NAME   SIZE   ALLOC  FREE    CAP  HEALTH  ALTROOT
    pool  68.2G   117K  68.2G     0%  ONLINE  -
  • Replacing many disks in a large pool is time-consuming due to resilvering the data onto the new disks. In addition, you might consider running the zpool scrub command between disk replacements to ensure that the replacement devices are operational and that the data is written correctly.

  • If a failed disk has been replaced automatically with a hot spare, then you might need to detach the spare after the failed disk is replaced. You can use the zpool detach command to detach a spare in a mirrored or RAID-Z pool. For information about detaching a hot spare, see Activating and Deactivating Hot Spares in Your Storage Pool.

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