Site Tools


server:zfs_actions

ZFS actions for spare drives

from http://docs.oracle.com/cd/E19082-01/817-2271/gcvcw/index.html


<div class=“pc11 imgMax-590” style=“margin: 10px;”><a xmlns:str=“http://xml.apache.org/xalan/java/java.lang.String” name=“6mhupg6js”></a><h2 class=“sol”>Designating Hot Spares in Your Storage Pool</h2> <p>The hot spares feature enables you to identify disks that could be used to replace a failed or faulted device in one or more storage pools. Designating a device as a <b>hot spare</b> means that the device is not an active device in a pool, but if an active device in the pool fails, the hot spare automatically replaces the failed device.<a name=“indexterm-180”></a> </p> <p>Devices can be designated as hot spares in the following ways:</p> <a name=“”></a><ul> <li> <p>When the pool is created with the <kbd>zpool create</kbd> command</p>

</li> <li> <p>After the pool is created with the <kbd>zpool add</kbd> command</p>

</li> <li> <p>Hot spare devices can be shared between multiple pools, but spares cannot be shared between multiple pools on different systems</p>

</li> </ul> <p>Designate devices as hot spares when the pool is created. For example:<a name=“indexterm-181”></a> </p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool create trinity mirror c1t1d0 c2t1d0 spare c1t2d0 c2t2d0</kbd></b> # <b><kbd>zpool status trinity</kbd></b>

pool: trinity

state: ONLINE scrub: none requested config:

      NAME        STATE     READ WRITE CKSUM
      trinity     ONLINE       0     0     0
        mirror-0  ONLINE       0     0     0
          c1t1d0  ONLINE       0     0     0
          c2t1d0  ONLINE       0     0     0
      spares
        c1t2d0    AVAIL   
        c2t2d0    AVAIL   

errors: No known data errors</pre> </td> </tr> </tbody></table><p>Designate hot spares by adding them to a pool after the pool is created. For example:</p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool add neo spare c5t3d0 c6t3d0</kbd></b> # <b><kbd>zpool status neo</kbd></b>

pool: neo

state: ONLINE scrub: none requested config:

      NAME        STATE     READ WRITE CKSUM
      neo         ONLINE       0     0     0
        mirror-0  ONLINE       0     0     0
          c3t3d0  ONLINE       0     0     0
          c4t3d0  ONLINE       0     0     0
      spares
        c5t3d0    AVAIL   
        c6t3d0    AVAIL   

errors: No known data errors</pre> </td> </tr> </tbody></table><p>Multiple pools can share devices that are designated as hot spares. For example:</p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool create zeepool mirror c1t1d0 c2t1d0 spare c1t2d0 c2t2d0</kbd></b> # <b><kbd>zpool create tank raidz c3t1d0 c4t1d0 spare c1t2d0 c2t2d0</kbd></b> </pre> </td> </tr> </tbody></table><p>Hot spares can be removed from a storage pool by using the <kbd>zpool remove</kbd> command. For example:</p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool remove zeepool c2t3d0</kbd></b> # <b><kbd>zpool status zeepool</kbd></b>

pool: zeepool

state: ONLINE scrub: none requested config:

      NAME        STATE     READ WRITE CKSUM
      zeepool     ONLINE       0     0     0
        mirror-0  ONLINE       0     0     0
          c1t1d0  ONLINE       0     0     0
          c2t1d0  ONLINE       0     0     0
      spares
        c1t3d0    AVAIL   

errors: No known data errors</pre> </td> </tr> </tbody></table><p>A hot spare cannot be removed if it is currently used by the storage pool.</p> <p>Keep the following points in mind when using ZFS hot spares:</p> <a name=“”></a><ul> <li> <p>Currently, the <kbd>zpool remove</kbd> command can only be used to remove hot spares, cache devices, and log devices.</p>

</li> <li> <p>Add a disk as a spare that is equal to or larger than the size of the largest disk in the pool. Adding a smaller disk as a spare to a pool is allowed. However, when the smaller spare disk is activated, either automatically or with the <kbd>zpool replace</kbd> command, the operation fails with an error similar to the following:</p>

<table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre>cannot replace <var>disk3</var> with <var>disk4</var>: device is too small</pre> </td> </tr> </tbody></table>

</li> <li> <p>You can share a hot spare between pools. However, you cannot export a pool with an in-use shared spare unless you use the <kbd>zpool export</kbd> <kbd><b>-f</b></kbd> (force) option. This behavior prevents the potential data corruption scenario of exporting a pool with an in-use shared spare and another pool attempts to use the shared spare from the exported pool. If you export a pool with an in-use shared spare by using the <kbd><b>-f</b></kbd> option, be aware that this operation might lead to data corruption if another pool attempts to activate the in-use shared spare.</p>

</li> </ul> <a name=“6mhupg6ju”></a><h3 class=“sol”>Activating and Deactivating Hot Spares in Your Storage Pool</h3> <p>Hot spares are activated in the following ways:</p> <a name=“”></a><ul> <li> <p>Manual replacement – Replace a failed device in a storage pool with a hot spare by using the <kbd>zpool replace</kbd> command.</p>

</li> <li> <p>Automatic replacement – When a fault is received, an FMA agent examines the pool to see if it has any available hot spares. If so, it replaces the faulted device with an available spare.</p>

<p>If a hot spare that is currently in use fails, the 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 diagnosis engine only emits faults when a device disappears from the system. </p>

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

</li> </ul> <p>Manually replace a device with a hot spare by using the <kbd>zpool replace</kbd> command. See <a href=“../6mhupg6ju/index.html#gjfdg”>Example&nbsp;4–7</a>.</p> <p>A faulted device is automatically replaced if a hot spare is available. For example:</p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool status -x</kbd></b>

pool: zeepool

state: DEGRADED status: One or more devices could not be opened. Sufficient replicas exist for

      the pool to continue functioning in a degraded state.

action: Attach the missing device and online it using 'zpool online'.

 see: http://www.sun.com/msg/ZFS-8000-2Q

scrub: resilver completed after 0h0m with 0 errors on Mon Jan 11 10:20:35 2010 config:

      NAME          STATE     READ WRITE CKSUM
      zeepool       DEGRADED     0     0     0
        mirror-0    DEGRADED     0     0     0
          c1t2d0    ONLINE       0     0     0
          spare-1   DEGRADED     0     0     0
            c2t1d0  UNAVAIL      0     0     0  cannot open
            c2t3d0  ONLINE       0     0     0  88.5K resilvered
      spares
        c2t3d0      INUSE     currently in use

errors: No known data errors</pre> </td> </tr> </tbody></table><p>Currently, three ways to deactivate hot spares are available:</p> <a name=“”></a><ul> <li> <p>Removing the hot spare from the storage pool</p>

</li> <li> <p>Detaching a hot spare after a failed disk is physically replaced. See <a href=“../6mhupg6ju/index.html#gjfbs”>Example&nbsp;4–8</a>.</p>

</li> <li> <p>Temporarily or permanently swapping in the hot spare. See <a href=“../6mhupg6ju/index.html#gjfbz”>Example&nbsp;4–9</a>.</p>

</li> </ul> <a name=“gjfdg”></a><hr><h5 class=“sol”>Example&nbsp;4–7 Manually Replacing a Disk With a Hot Spare</h5><br><p>In this example, the <kbd>zpool replace</kbd> command is used to replace disk <tt>c2t1d0</tt> with the spare disk <tt>c2t3d0</tt>.</p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool replace zeepool c2t1d0 c2t3d0</kbd></b> # <b><kbd>zpool status zeepool</kbd></b>

pool: zeepool

state: ONLINE scrub: resilver completed after 0h0m with 0 errors on Wed Oct 21 12:47:29 2009 config:

      NAME           STATE     READ WRITE CKSUM
      zeepool        ONLINE       0     0     0
        mirror       ONLINE       0     0     0
          c1t2d0     ONLINE       0     0     0
          spare      ONLINE       0     0     0
            c2t1d0   ONLINE       0     0     0
            c2t3d0   ONLINE       0     0     0  76.5K resilvered
      spares
        c2t3d0      INUSE     currently in use

errors: No known data errors</pre> </td> </tr> </tbody></table><hr> <a name=“gjfbs”></a><hr><h5 class=“sol”>Example&nbsp;4–8 Detaching a Hot Spare After the Failed Disk is Replaced</h5><br><p>After the faulted device is replaced, use the <kbd>zpool detach</kbd> command to return the hot spare back to the spare set. For example:</p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool detach zeepool c2t3d0</kbd></b> # <b><kbd>zpool status zeepool</kbd></b>

pool: zeepool

state: ONLINE scrub: resilver completed with 0 errors on Fri Aug 28 14:21:02 2009 config:

      NAME               STATE     READ WRITE CKSUM
      zeepool            ONLINE       0     0     0
        mirror           ONLINE       0     0     0
          c1t2d0         ONLINE       0     0     0
          c2t1d0         ONLINE       0     0     0
      spares
        c2t3d0           AVAIL

errors: No known data errors</pre> </td> </tr> </tbody></table><hr> <a name=“gjfbz”></a><hr><h5 class=“sol”>Example&nbsp;4–9 Detaching a Failed Disk and Using the Hot Spare</h5><br><p>If you want to replace a failed disk with a 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:</p> <table border=“1” cellpadding=“1” width=“100%”> <tbody><tr> <td nowrap=“1”> <br> <pre># <b><kbd>zpool status zeepool</kbd></b>

pool: zeepool

state: DEGRADED status: One or more devices could not be opened. Sufficient replicas exist for

      the pool to continue functioning in a degraded state.

action: Attach the missing device and online it using 'zpool online'.

 see: http://www.sun.com/msg/ZFS-8000-2Q

scrub: resilver in progress for 0h0m, 70.47% done, 0h0m to go config:

      NAME          STATE     READ WRITE CKSUM
      zeepool       DEGRADED     0     0     0
        mirror-0    DEGRADED     0     0     0
          c1t2d0    ONLINE       0     0     0
          spare-1   DEGRADED     0     0     0
            c2t1d0  UNAVAIL      0     0     0  cannot open
            c2t3d0  ONLINE       0     0     0  51.5M resilvered
      spares
        c2t3d0      INUSE     currently in use

errors: No known data errors # <b><kbd>zpool detach zeepool c2t1d0</kbd></b> # <b><kbd>zpool status zeepool</kbd></b>

pool: zeepool

state: ONLINE scrub: resilver completed after 0h0m with 0 errors on Tue Oct 20 11:58:43 2009 config:

      NAME        STATE     READ WRITE CKSUM
      zeepool     ONLINE       0     0     0
        mirror-0  ONLINE       0     0     0
          c1t2d0  ONLINE       0     0     0
          c2t3d0  ONLINE       0     0     0  70.5M resilvered

errors: No known data errors (Original failed disk c2t1d0 is physically replaced) # <b><kbd>zpool add zeepool spare c2t1d0</kbd></b> # <b><kbd>zpool status zeepool</kbd></b>

pool: zeepool

state: ONLINE scrub: resilver completed after 0h0m with 0 errors on Tue Oct 20 11:58:43 2009 config:

      NAME        STATE     READ WRITE CKSUM
      zeepool     ONLINE       0     0     0
        mirror-0  ONLINE       0     0     0
          c1t2d0  ONLINE       0     0     0
          c2t3d0  ONLINE       0     0     0  70.5M resilvered
      spares
        c2t1d0    AVAIL   

errors: No known data errors</pre> </td> </tr> </tbody></table><hr> </div>

server/zfs_actions.txt · Last modified: (external edit)