Go to main content

Managing ZFS File Systems in Oracle® Solaris 11.4

Exit Print View

Updated: July 2019
 
 

Attaching and Detaching Devices in a Storage Pool

To add a new device to an existing virtual device, use the following command:

$ zpool attach pool existing-device new-device

You can use the zpool detach command to detach a device provided one of the following conditions applies:

  • The device belongs to a mirrored pool configuration.

  • In a RAID-Z configuration, the detached device is replaced by another physical device or by a spare.

Outside of these conditions, detaching a device generates an error similar to the following:

cannot detach c1t2d0: only applicable to mirror and replacing vdevs

The following examples show how to apply zfs attach commands.

Example 10  Converting a Two-Way Mirrored Storage Pool to a Three-Way Mirrored Storage Pool

In this example, mpool is an existing two-way mirror pool. It is converted into a three-way mirror pool by attaching c2t1d0, the new device, to the existing device c1t1d0. The newly attached device is immediately resilvered.

$ zpool attach mpool c1t1d0 c2t1d0
$ zpool status mpool
pool: mpool
state: ONLINE
scrub: resilver completed after 0h0m with 0 errors on Fri Jan  8 12:59:20 2010
config:

NAME           STATE     READ  WRITE  CKSUM
mpool          ONLINE       0      0      0
   mirror-0    ONLINE       0      0      0
      c0t1d0   ONLINE       0      0      0
      c1t1d0   ONLINE       0      0      0
      c2t1d0   ONLINE       0      0      0  592K resilveredAttached device creates a 3-way mirror pool

errors: No known data errors
Example 11  Converting a Nonredundant Storage Pool to a Mirrored Storage Pool

The zpool attach command also enables you to convert a storage pool or a log device from a nonredundant to a redundant configuration.

The following example shows the status of the nonredundant pool system1 before and after it is converted into a redundant pool.

$ zpool status system1
pool: system1
state: ONLINE
scrub: none requested
config:
NAME           STATE      READ  WRITE  CKSUM
system1        ONLINE        0      0      0
     c0t1d0    ONLINE        0      0      0

errors: No known data errors
$ zpool attach system1 c0t1d0 c1t1d0
$ zpool status system1
pool: system1
state: ONLINE
scrub: resilver completed after 0h0m with 0 errors on Fri Jan  8 14:28:23 2010
config:

NAME           STATE     READ  WRITE  CKSUM
system1        ONLINE       0      0      0Pool becomes mirrored
   mirror-0    ONLINE       0      0      0
      c0t1d0   ONLINE       0      0      0
      c1t1d0   ONLINE       0      0      0  73.5K resilvered

errors: No known data errors