Monday, June 4, 2018

Replacing HDs in RAIDZ2

Here is a plan on how to replace a defective HD in RAIDZ2:

1. Take the Defective Disk offline

# zpool offline 'tank' '/dev/ada1'

  pool: tank
 state: DEGRADED
status: One or more devices has been taken offline by the administrator.
 Sufficient replicas exist for the pool to continue functioning in a
 degraded state.
action: Online the device using 'zpool online' or replace the device with
 'zpool replace'.
  scan: none requested
config:

 NAME                      STATE     READ WRITE CKSUM
 tank                      DEGRADED     0     0     0
   raidz2-0                DEGRADED     0     0     0
     ada0                  ONLINE       0     0     0
     15564787101436659472  OFFLINE      0     0     0  was /dev/ada1
     ada2                  ONLINE       0     0     0
     ada3                  ONLINE       0     0     0
     ada4                  ONLINE       0     0     0

errors: No known data errors

2. Physically Remove the Old Drive

Skipped.

3. Physically Add the New Drive

Done.

4. Partition the New Drive

# gpart create -s GPT ada5
ada5 created

5. Replace the Old Drive with the New One in the Pool


# zpool replace tank 15564787101436659472 ada5
# zpool status
  pool: tank
 state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Tue Jun  5 10:51:44 2018
        3.46G scanned out of 9.48T at 322M/s, 8h34m to go
        706M resilvered, 0.04% done
config:

        NAME                        STATE     READ WRITE CKSUM
        tank                        DEGRADED     0     0     0
          raidz2-0                  DEGRADED     0     0     0
            ada0                    ONLINE       0     0     0
            replacing-1             OFFLINE      0     0     0
              15564787101436659472  OFFLINE      0     0     0  was /dev/ada1
              ada5                  ONLINE       0     0     0  (resilvering)
            ada2                    ONLINE       0     0     0
            ada3                    ONLINE       0     0     0
            ada4                    ONLINE       0     0     0

errors: No known data errors

6. Wait for the Resilver Process to Finish


# zpool status
  pool: tank
 state: ONLINE
  scan: resilvered 1.90T in 6h8m with 0 errors on Tue Jun  5 17:00:00 2018
config:

 NAME        STATE     READ WRITE CKSUM
 tank        ONLINE       0     0     0
   raidz2-0  ONLINE       0     0     0
     ada0    ONLINE       0     0     0
     ada4    ONLINE       0     0     0
     ada1    ONLINE       0     0     0
     ada2    ONLINE       0     0     0
     ada3    ONLINE       0     0     0

errors: No known data errors

No comments:

Post a Comment