Thursday, 5 December 2013

zpool raid1 pool operations

1)To create a mirror pool wiht requiered version
root@solaris1:~# zpool create mirpool mirror c2d7 c2d6
root@solaris1:~# zpool get all mirpool
NAME     PROPERTY       VALUE                SOURCE
mirpool  allocated      152K                 -
mirpool  altroot        -                    default
mirpool  autoexpand     off                  default
mirpool  autoreplace    off                  default
mirpool  bootfs         -                    default
mirpool  cachefile      -                    default
mirpool  capacity       0%                   -
mirpool  dedupditto     0                    default
mirpool  dedupratio     1.00x                -
mirpool  delegation     on                   default
mirpool  failmode       wait                 default
mirpool  free           19.9G                -
mirpool  guid           9707620484583941639  -
mirpool  health         ONLINE               -
mirpool  listshares     off                  default
mirpool  listsnapshots  off                  default
mirpool  readonly       off                  -
mirpool  size           19.9G                -
mirpool  version        34                   default
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  19.9G    85K  19.9G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.68G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors

root@solaris1:~# zpool create -o version=10 mirpool mirror c2d7 c2d6
root@solaris1:~# zpool get all mirpool
NAME     PROPERTY       VALUE               SOURCE
mirpool  allocated      88K                 -
mirpool  altroot        -                   default
mirpool  autoexpand     off                 default
mirpool  autoreplace    off                 default
mirpool  bootfs         -                   default
mirpool  cachefile      -                   default
mirpool  capacity       0%                  -
mirpool  dedupditto     0                   default
mirpool  dedupratio     1.00x               -
mirpool  delegation     on                  default
mirpool  failmode       wait                default
mirpool  free           19.9G               -
mirpool  guid           805868370260713887  -
mirpool  health         ONLINE              -
mirpool  listshares     off                 default
mirpool  listsnapshots  off                 default
mirpool  readonly       off                 -
mirpool  size           19.9G               -
mirpool  version        10                  local


2) To upgrade a pool from version (10) to latest version (34)
root@solaris1:~# zpool upgrade mirpool
This system is currently running ZFS pool version 34.
Successfully upgraded 'mirpool' from version 10 to version 34
root@solaris1:~# zpool get all mirpool
NAME     PROPERTY       VALUE               SOURCE
mirpool  allocated      102K                -
mirpool  altroot        -                   default
mirpool  autoexpand     off                 default
mirpool  autoreplace    off                 default
mirpool  bootfs         -                   default
mirpool  cachefile      -                   default
mirpool  capacity       0%                  -
mirpool  dedupditto     0                   default
mirpool  dedupratio     1.00x               -
mirpool  delegation     on                  default
mirpool  failmode       wait                default
mirpool  free           19.9G               -
mirpool  guid           805868370260713887  -
mirpool  health         ONLINE              -
mirpool  listshares     off                 default
mirpool  listsnapshots  off                 default
mirpool  readonly       off                 -
mirpool  size           19.9G               -
mirpool  version        34                  default

3)To add lun to existing pool
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  19.9G    73K  19.9G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool add mirpool mirror c2d5 c2d4
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
          mirror-1  ONLINE       0     0     0
            c2d5    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  39.8G   110K  39.7G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.68G  52%  1.00x  ONLINE  -


4)To remove lun from raid 1 pool
A) NOT POSSIBLE

root@solaris1:~# zpool remove mirpool  c2d5 c2d4
cannot remove c2d5: operation not supported on this type of pool
cannot remove c2d4: operation not supported on this type of pool

5)To export Zpool
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  39.8G    79K  39.7G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.68G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool export mirpool
root@solaris1:~# zpool list
NAME    SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool  9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -

6)To rename a pool
root@solaris1:~# zpool list
NAME    SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool  9.94G  5.26G  4.68G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool import mirpool oramirrorpool
zpool root@solaris1:~# zpool list
NAME            SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
oramirrorpool  39.8G   174K  39.7G   0%  1.00x  ONLINE  -
rpool          9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -


7)to split mirror pool
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
          mirror-1  ONLINE       0     0     0
            c2d5    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool split mirpool newpool
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: none requested
config:
        NAME    STATE     READ WRITE CKSUM
        mirpool  ONLINE       0     0     0
          c2d7  ONLINE       0     0     0
          c2d5  ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool status newpool
cannot open 'newpool': no such pool
root@solaris1:~# zpool import newpool

8)To conver RAID0===> RAID1
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: none requested
config:
        NAME    STATE     READ WRITE CKSUM
        mirpool  ONLINE       0     0     0
          c2d7  ONLINE       0     0     0
          c2d5  ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool attach mirpool c2d7 c2d6
root@solaris1:~# zpool attach mirpool c2d5 c2d4
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 50.5K in 0h0m with 0 errors on Thu Dec  5 17:58:01 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
          mirror-1  ONLINE       0     0     0
            c2d5    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors

9)To view zpool status
root@solaris1:~# zpool status -x
all pools are healthy
root@solaris1:~# zpool status -lv
  pool: mirpool
 state: ONLINE
  scan: resilvered 50.5K in 0h0m with 0 errors on Thu Dec  5 17:58:01 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
          mirror-1  ONLINE       0     0     0
            c2d5    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors
  pool: rpool
 state: ONLINE
  scan: resilvered 5.16G in 0h19m with 0 errors on Fri Nov  1 17:24:43 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d1s0  ONLINE       0     0     0
            c2d0s0  ONLINE       0     0     0
errors: No known data errors

10)To Know pools which are deported
root@solaris1:~# zpool export mirpool
root@solaris1:~# zpool import
  pool: mirpool
    id: 805868370260713887
 state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
        mirpool     ONLINE
          mirror-0  ONLINE
            c2d7    ONLINE
            c2d6    ONLINE
          mirror-1  ONLINE
            c2d5    ONLINE
            c2d4    ONLINE

11)To Destroy Pool
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  39.8G   160K  39.7G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool destroy mirpool
root@solaris1:~# zpool list
NAME    SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool  9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -

12)To see destroyed pools
root@solaris1:~# zpool import -D
  pool: mirpool
    id: 805868370260713887
 state: ONLINE (DESTROYED)
action: The pool can be imported using its name or numeric identifier.
config:
        mirpool     ONLINE
          mirror-0  ONLINE
            c2d7    ONLINE
            c2d6    ONLINE
          mirror-1  ONLINE
            c2d5    ONLINE
            c2d4    ONLINE
13)To recover Destroyed Pool
root@solaris1:~# zpool import -D
  pool: mirpool
    id: 805868370260713887
 state: ONLINE (DESTROYED)
action: The pool can be imported using its name or numeric identifier.
config:
        mirpool     ONLINE
          mirror-0  ONLINE
            c2d7    ONLINE
            c2d6    ONLINE
          mirror-1  ONLINE
            c2d5    ONLINE
            c2d4    ONLINE
root@solaris1:~#
root@solaris1:~# zpool import -D 805868370260713887
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  39.8G   160K  39.7G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -

14)Conveting raid0====>2way mirror===>3way miroor
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 86.5K in 0h0m with 0 errors on Thu Dec  5 18:05:50 2013
config:
        NAME    STATE     READ WRITE CKSUM
        mirpool  ONLINE       0     0     0
          c2d7  ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool attach mirpool c2d7 c2d6
root@solaris1:~# zpool status
  pool: mirpool
 state: ONLINE
  scan: resilvered 98.5K in 0h0m with 0 errors on Thu Dec  5 18:07:23 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool attach mirpool c2d6 c2d5
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d5    ONLINE       0     0     0
15)Conveting 3way mirror===>2way miroor
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d5    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool detach mirpool c2d5
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors

14)To ADD log devices to RAID-0 Pool
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool add mirpool log c2d5
root@solaris1:~# zpool status
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
        logs
          c2d5      ONLINE       0     0     0
errors: No known data errors

15)To REmove Log devices from pool
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
        logs
          c2d5      ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool remove mirpool c2d5
root@solaris1:~# zpool status
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors

16)To add cache device to pool
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool add mirpool cache c2d5
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
        cache
          c2d5      ONLINE       0     0     0
errors: No known data errors
root@solaris1:~#

17)To Remove cache devices from pool

root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
        cache
          c2d5      ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool remove mirpool c2d5
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors

18)to sparce to mirpool
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  19.9G   104K  19.9G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool add mirpool spare c2d5
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
        spares
          c2d5      AVAIL
errors: No known data errors
19)to remove spare device from mirpool
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
        spares
          c2d5      AVAIL
errors: No known data errors
root@solaris1:~# zpool remove mirpool c2d5
root@solaris1:~# zpool status mirpool
  pool: mirpool
 state: ONLINE
  scan: resilvered 100K in 0h0m with 0 errors on Thu Dec  5 18:07:50 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors
18)To see zpool io status
root@solaris1:~# zpool iostat -v
               capacity     operations    bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
mirpool      108K  19.9G      0      2    114  2.77K
  mirror     108K  19.9G      0      2    138  3.33K
    c2d7        -      -      0      2  1.91K  14.0K
    c2d6        -      -      0      2  1.44K  12.7K
----------  -----  -----  -----  -----  -----  -----
rpool       5.26G  4.67G      0      1  12.5K  6.06K
  mirror    5.26G  4.67G      0      1  12.5K  6.06K
    c2d1s0      -      -      0      0  6.24K  6.12K
    c2d0s0      -      -      0      0  6.47K  6.12K
----------  -----  -----  -----  -----  -----  -----

19)to import a pool with missing log devices
root@solaris1:~# zpool export mirpool
root@solaris1:~# zpool import -m mirpool
root@solaris1:~# zpool list
NAME      SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
mirpool  19.9G   157K  19.9G   0%  1.00x  ONLINE  -
rpool    9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -

20)To scrub a pool
root@solaris1:~# zpool scrub mirpool
root@solaris1:~# zpool status
  pool: mirpool
 state: ONLINE
  scan: scrub repaired 0 in 0h0m with 0 errors on Thu Dec  5 18:18:56 2013
config:
        NAME        STATE     READ WRITE CKSUM
        mirpool     ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
errors: No known data errors





1 comment:

  1. In case you are looking into generating money from your websites/blogs by popup ads - you can embed one of the biggest companies: Clicksor.

    ReplyDelete