Converting a ZFS pool to be mirrored

So, the ZFS syntax is quite different to that of SVM which can lead to confusion. Ben Rockwood does a good job of explaning the difference, but does not show how to convert an un-mirrored ZFS pool into mirrored one. So, here's how to do it

o We start with a pool called realzfs (because it's made out of real devices rather than files)
# zpool list
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
realzfs                 544G   1.17G    543G     0%  ONLINE     -

o We can see that it is made up of 4 disks
# zpool status
  pool: realzfs
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        realzfs     ONLINE       0     0     0
          c3t0d0    ONLINE       0     0     0
          c3t1d0    ONLINE       0     0     0
          c3t2d0    ONLINE       0     0     0
          c3t5d0    ONLINE       0     0     0


o The correct way is to attach a new device to each existing ldev e.g.

# zpool attach -f realzfs c3t0d0 c3t8d0


# zpool status
  pool: realzfs
 state: ONLINE
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.
 scrub: resilver in progress, 99.99% done, 0h0m to go
config:

        NAME        STATE     READ WRITE CKSUM
        realzfs     ONLINE       0     0     0
          mirror    ONLINE       0     0     0
            c3t0d0  ONLINE       0     0     0
            c3t8d0  ONLINE       0     0     0  178.3 resilvered
          c3t1d0    ONLINE       0     0     0
          c3t2d0    ONLINE       0     0     0
          c3t5d0    ONLINE       0     0     0

# zpool attach -f realzfs c3t1d0 c3t9d0
# zpool attach -f realzfs c3t2d0 c3t10d0
# zpool attach -f realzfs c3t5d0 c3t11d0

o Finally we see all our ldevs mirrored.

# zpool status
  pool: realzfs
 state: ONLINE
 scrub: resilver completed with 0 errors on Mon Jan 23 15:26:16 2006
config:

        NAME         STATE     READ WRITE CKSUM
        realzfs      ONLINE       0     0     0
          mirror     ONLINE       0     0     0
            c3t0d0   ONLINE       0     0     0
            c3t8d0   ONLINE       0     0     0
          mirror     ONLINE       0     0     0
            c3t1d0   ONLINE       0     0     0
            c3t9d0   ONLINE       0     0     0
          mirror     ONLINE       0     0     0
            c3t2d0   ONLINE       0     0     0
            c3t10d0  ONLINE       0     0     0
          mirror     ONLINE       0     0     0
            c3t5d0   ONLINE       0     0     0
            c3t11d0  ONLINE       0     0     0

o The WRONG way to do it is as follows:-

# zpool add -f realzfs mirror  c3t8d0  c3t9d0 c3t10d0 c3t11d0


# zpool status
  pool: realzfs
 state: ONLINE
 scrub: resilver completed with 0 errors on Mon Jan 23 15:26:16 2006
config:

        NAME         STATE     READ WRITE CKSUM
        realzfs      ONLINE       0     0     0
          c3t0d0     ONLINE       0     0     0
          c3t1d0     ONLINE       0     0     0
          c3t2d0     ONLINE       0     0     0
          c3t5d0     ONLINE       0     0     0
          mirror     ONLINE       0     0     0
            c3t8d0   ONLINE       0     0     0
            c3t9d0   ONLINE       0     0     0
            c3t10d0  ONLINE       0     0     0
            c3t11d0  ONLINE       0     0     0

Which is 4 single disk ldevs and one 4way mirrored ldev.  NOT 4 mirrored ldev's which is what we actually wanted.


        
    
Comments:

Post a Comment:
Comments are closed for this entry.
About

gjl

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today