Thursday, February 28, 2013

Solaris: ZFS how to mirror zfs slice not whole disk


ZFS how to mirror zfs slice not whole disk

new disk:
c4t60060E80056F110000006F110000804Bd0
c4t60060E80056F110000006F1100006612d0  

serverA# zpool status phtoolvca1
  pool: phtoolvca1
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: none requested
config:

        NAME                                                 STATE     READ WRITE CKSUM
        phtoolvca1                                           ONLINE       0     0     0
          /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0  ONLINE       0     0     0
          c4t60060E80056F110000006F110000614Ad0              ONLINE       0     0     0

errors: No known data errors
serverA# zpool status | grep c4t60060E80056F110000006F110000804Bd0
serverA# zpool attach -f phtoolvca1 /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0 c4t60060E80056F110000006F110000804Bd0
cannot attach c4t60060E80056F110000006F110000804Bd0 to /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0: no such device in pool
serverA# zpool attach -f phtoolvca1 c4t60060E80056F110000006F11000081A6d0s0 c4t60060E80056F110000006F110000804Bd0
cannot attach c4t60060E80056F110000006F110000804Bd0 to c4t60060E80056F110000006F11000081A6d0s0: no such device in pool
serverA# man zppol
serverA#
serverA# prtvtoc /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s2 | fmthard -s - /dev/rdsk/c4t60060E80056F110000006F110000804Bd0s2
fmthard:  New volume table of contents now in place.
serverA#
serverA# zdb -C phtoolvca1

MOS Configuration:
        version: 10
        name: 'phtoolvca1'
        state: 0
        txg: 1516759
        pool_guid: 17149951849739077007
        hostid: 2238627050
        hostname: 'serverA'
        vdev_tree:
            type: 'root'
            id: 0
            guid: 17149951849739077007
            children[0]:
                type: 'disk'
                id: 0
                guid: 8225298048714506169
                path: '/dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0'
                devid: 'id1,ssd@n60060e80056f110000006f11000081a6/a,raw'
                phys_path: '/scsi_vhci/ssd@g60060e80056f110000006f11000081a6:a,raw'
                whole_disk: 1
                metaslab_array: 14
                metaslab_shift: 28
                ashift: 9
                asize: 53674246144
                is_log: 0
                DTL: 104
            children[1]:
                type: 'disk'
                id: 1
                guid: 6410631449240489329
                path: '/dev/dsk/c4t60060E80056F110000006F110000614Ad0s0'
                devid: 'id1,ssd@n60060e80056f110000006f110000614a/a'
                phys_path: '/scsi_vhci/ssd@g60060e80056f110000006f110000614a:a'
                whole_disk: 1
                metaslab_array: 61
                metaslab_shift: 27
                ashift: 9
                asize: 16092758016
                is_log: 0
                DTL: 103
serverA#
serverA# zpool status phtoolvca1
  pool: phtoolvca1
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: none requested
config:

        NAME                                                 STATE     READ WRITE CKSUM
        phtoolvca1                                           ONLINE       0     0     0
          /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0  ONLINE       0     0     0
          c4t60060E80056F110000006F110000614Ad0              ONLINE       0     0     0

errors: No known data errors
serverA# zpool attach -f phtoolvca1 8225298048714506169 c4t60060E80056F110000006F110000804Bd0s0
serverA# zpool status phtoolvca1
  pool: phtoolvca1
 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.
 scan: resilver in progress since Sat Feb 16 05:34:08 2013
    1.56G scanned out of 10.7G at 133M/s, 0h1m to go
    1.56G scanned out of 10.7G at 133M/s, 0h1m to go
    1.55G resilvered, 14.59% done
config:

        NAME                                                   STATE     READ WRITE CKSUM
        phtoolvca1                                             ONLINE       0     0     0
          mirror-0                                             ONLINE       0     0     0
            /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0  ONLINE       0     0     0
            c4t60060E80056F110000006F110000804Bd0s0            ONLINE       0     0     0  (resilvering)
          c4t60060E80056F110000006F110000614Ad0                ONLINE       0     0     0
serverA# zpool status | grep c4t60060E80056F110000006F1100006612d0
serverA# zpool attach -f phtoolvca1 c4t60060E80056F110000006F110000614Ad0 c4t60060E80056F110000006F1100006612d0
serverA# zpool status phtoolvca1
  pool: phtoolvca1
 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.
 scan: resilver in progress since Sat Feb 16 05:36:48 2013
    5.71G scanned out of 10.7G at 487M/s, 0h0m to go
    5.71G scanned out of 10.7G at 487M/s, 0h0m to go
    1.20G resilvered, 53.37% done
config:

        NAME                                                   STATE     READ WRITE CKSUM
        phtoolvca1                                             ONLINE       0     0     0
          mirror-0                                             ONLINE       0     0     0
            /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0  ONLINE       0     0     0
            c4t60060E80056F110000006F110000804Bd0s0            ONLINE       0     0     0
          mirror-1                                             ONLINE       0     0     0
            c4t60060E80056F110000006F110000614Ad0              ONLINE       0     0     0
            c4t60060E80056F110000006F1100006612d0              ONLINE       0     0     0  (resilvering)

errors: No known data errors
serverA# zpool status phtoolvca1
  pool: phtoolvca1
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: resilvered 2.71G in 0h0m with 0 errors on Sat Feb 16 05:37:21 2013
config:

        NAME                                                   STATE     READ WRITE CKSUM
        phtoolvca1                                             ONLINE       0     0     0
          mirror-0                                             ONLINE       0     0     0
            /dev/rdsk/c4t60060E80056F110000006F11000081A6d0s0  ONLINE       0     0     0
            c4t60060E80056F110000006F110000804Bd0s0            ONLINE       0     0     0
          mirror-1                                             ONLINE       0     0     0
            c4t60060E80056F110000006F110000614Ad0              ONLINE       0     0     0
            c4t60060E80056F110000006F1100006612d0              ONLINE       0     0     0

No comments:

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...