Friday, 6 December 2013

raidzpool operations

1)To create a mirror pool wiht requiered version
root@solaris1:~# zpool list
NAME    SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool  9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool create rzpool raidz c2d7 c2d6 c2d5
root@solaris1:~# zpool list
NAME     SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool   9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
rzpool  59.5G   241K  59.5G   0%  1.00x  ONLINE  -
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-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

RAID2Z(Double Parity):-
root@solaris1:~# zpool create rzpool raidz2 c2d7 c2d6 c2d5 c2d4 c2d3
root@solaris1:~# zpool status
  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
  pool: rzpool
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz2-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d5    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
            c2d3    ONLINE       0     0     0
errors: No known data errors

RAID3Z(Triple Parity):-
root@solaris1:~# zpool create rzpool raidz2 c2d7 c2d6 c2d5 c2d4 c2d3 c2d2

2) To upgrade a pool from version (10) to latest version (34)
root@solaris1:~# zpool create -o version=10 rzpool raidz c2d7 c2d6 c2d5
root@solaris1:~# zpool status rzpool
  pool: rzpool
 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
        rzpool      ONLINE       0     0     0
          raidz1-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 get all rzpool
NAME    PROPERTY       VALUE                 SOURCE
rzpool  allocated      113K                  -
rzpool  altroot        -                     default
rzpool  autoexpand     off                   default
rzpool  autoreplace    off                   default
rzpool  bootfs         -                     default
rzpool  cachefile      -                     default
rzpool  capacity       0%                    -
rzpool  dedupditto     0                     default
rzpool  dedupratio     1.00x                 -
rzpool  delegation     on                    default
rzpool  failmode       wait                  default
rzpool  free           59.5G                 -
rzpool  guid           15664146462690317344  -
rzpool  health         ONLINE                -
rzpool  listshares     off                   default
rzpool  listsnapshots  off                   default
rzpool  readonly       off                   -
rzpool  size           59.5G                 -
rzpool  version        10                    local
root@solaris1:~# zpool upgrade rzpool
This system is currently running ZFS pool version 34.
Successfully upgraded 'rzpool' from version 10 to version 34
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-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 get all rzpool
NAME    PROPERTY       VALUE                 SOURCE
rzpool  allocated      207K                  -
rzpool  altroot        -                     default
rzpool  autoexpand     off                   default
rzpool  autoreplace    off                   default
rzpool  bootfs         -                     default
rzpool  cachefile      -                     default
rzpool  capacity       0%                    -
rzpool  dedupditto     0                     default
rzpool  dedupratio     1.00x                 -
rzpool  delegation     on                    default
rzpool  failmode       wait                  default
rzpool  free           59.5G                 -
rzpool  guid           15664146462690317344  -
rzpool  health         ONLINE                -
rzpool  listshares     off                   default
rzpool  listsnapshots  off                   default
rzpool  readonly       off                   -
rzpool  size           59.5G                 -
rzpool  version        34                    default

3)to offline a device in  pool
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-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 offline rzpool c2d5
root@solaris1:~# zpool status
 pool: rzpool
 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
        rzpool      DEGRADED     0     0     0
          raidz1-0  DEGRADED     0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d5    OFFLINE      0     0     0
errors: No known data errors

4)to online a device in  pool
root@solaris1:~# zpool online rzpool c2d5
warning: device 'c2d5' onlined, but remains in degraded state
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 25.5K in 0h0m with 0 errors on Fri Dec  6 13:20:44 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-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

5)To replace a device in  a pool
root@solaris1:~# zpool status rzpool
  pool: rzpool
 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: resilvered 25.5K in 0h0m with 0 errors on Fri Dec  6 13:20:44 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      DEGRADED     0     0     0
          raidz1-0  DEGRADED     0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d5    OFFLINE      0     0     0
errors: No known data errors
root@solaris1:~# zpool replace rzpool c2d5 c2d4
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors


3)To add lun to existing pool
root@solaris1:~# zpool add rzpool lun4 lun5 lun6

4)To remove lun from raid 1 pool
A) NOT POSSIBLE ( only for LOG/CACHE/SPARE )

5)To export Zpool
root@solaris1:~# zpool list
NAME     SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool   9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
rzpool  59.5G   271K  59.5G   0%  1.00x  ONLINE  -
root@solaris1:~# zpool export rzpool
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.67G  52%  1.00x  ONLINE  -
root@solaris1:~# zpool import rzpool newrzpool
root@solaris1:~# zpool list
NAME        SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
newrzpool  59.5G   291K  59.5G   0%  1.00x  ONLINE  -
rpool      9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -

8)To conver RAIDZ===> RAID1
NOTPOSSIBLE
root@solaris1:~# zpool attach rzpool c2d7 c2d5
cannot attach c2d5 to c2d7: can only attach to mirrors and top-level disks
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors

9)To view zpool status
root@solaris1:~# zpool status -lv rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors

10)To Know pools which are exported
root@solaris1:~# zpool list
NAME     SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool   9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
rzpool  59.5G   189K  59.5G   0%  1.00x  ONLINE  -
root@solaris1:~# zpool export rzpool
root@solaris1:~# zpool import
  pool: rzpool
    id: 15664146462690317344
 state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:
        rzpool      ONLINE
          raidz1-0  ONLINE
            c2d7    ONLINE
            c2d6    ONLINE
            c2d4    ONLINE
root@solaris1:~# zpool list
NAME    SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool  9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -

11)To Destroy Pool
root@solaris1:~# zpool list
NAME     SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool   9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
rzpool  59.5G   299K  59.5G   0%  1.00x  ONLINE  -
root@solaris1:~# zpool destroy rzpool
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: rzpool
    id: 15664146462690317344
 state: ONLINE (DESTROYED)
action: The pool can be imported using its name or numeric identifier.
config:
        rzpool      ONLINE
          raidz1-0  ONLINE
            c2d7    ONLINE
            c2d6    ONLINE
            c2d4    ONLINE
BUG:-
i deleted same disks for multiplie times it throws following errors
pool: rzpool
    id: 18039609402263420255
 state: UNAVAIL (DESTROYED)
status: One or more devices are unavailable.
action: The pool cannot be imported due to unavailable devices or data.
config:
        rzpool      UNAVAIL  insufficient replicas
          raidz2-0  UNAVAIL  insufficient replicas
            c2d7    UNAVAIL  corrupted data
            c2d6    UNAVAIL  corrupted data
            c2d5    UNAVAIL  corrupted data
            c2d4    UNAVAIL  corrupted data
            c2d3    ONLINE
device details:
        c2d7      UNAVAIL         corrupted data
        status: ZFS detected errors on this device.
                The device has bad label or disk contents.
        c2d6      UNAVAIL         corrupted data
        status: ZFS detected errors on this device.
                The device has bad label or disk contents.
        c2d5      UNAVAIL         corrupted data
        status: ZFS detected errors on this device.
                The device has bad label or disk contents.
        c2d4      UNAVAIL         corrupted data
        status: ZFS detected errors on this device.
                The device has bad label or disk contents.

13)To recover Destroyed Pool
root@solaris1:~# zpool import -D 15664146462690317344
root@solaris1:~# zpool list
NAME     SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
rpool   9.94G  5.26G  4.67G  52%  1.00x  ONLINE  -
rzpool  59.5G   189K  59.5G   0%  1.00x  ONLINE  -

14)To ADD log devices to RAID-0 Pool
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool add rzpool log c2d5
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    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 rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
        logs
          c2d5      ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool remove rzpool c2d5
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors

16)To add cache device to pool
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors
root@solaris1:~# zpool add rzpool cache c2d5
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
        cache
          c2d5      ONLINE       0     0     0
errors: No known data errors

17)To Remove cache devices from pool
root@solaris1:~# zpool remove rzpool c2d5
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors

18)to sparce to raidz pool
root@solaris1:~# zpool add rzpool spare c2d5
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
        spares
          c2d5      AVAIL
errors: No known data errors

19)to remove spare device from mirpool
root@solaris1:~# zpool remove rzpool c2d5
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: resilvered 103K in 0h0m with 0 errors on Fri Dec  6 13:23:10 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors

20)To see zpool io status
root@solaris1:~# zpool iostat rzpool
               capacity     operations    bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
rzpool       203K  59.5G      0      2    219  3.16K
root@solaris1:~# zpool iostat -lv  rzpool
               capacity     operations    bandwidth
pool        alloc   free   read  write   read  write
----------  -----  -----  -----  -----  -----  -----
rzpool       203K  59.5G      0      2    216  3.11K
  raidz1     203K  59.5G      0      2    216  3.11K
    c2d7        -      -      0      2  2.50K  12.0K
    c2d6        -      -      0      2  2.60K  12.0K
    c2d4        -      -      0      2  2.53K  12.0K
----------  -----  -----  -----  -----  -----  -----

21)to import a pool with missing log devices
#zpool import -m rzpool

22)To scrub a pool
root@solaris1:~# zpool scrub rzpool
root@solaris1:~# zpool status rzpool
  pool: rzpool
 state: ONLINE
  scan: scrub repaired 0 in 0h0m with 0 errors on Fri Dec  6 13:43:28 2013
config:
        NAME        STATE     READ WRITE CKSUM
        rzpool      ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c2d7    ONLINE       0     0     0
            c2d6    ONLINE       0     0     0
            c2d4    ONLINE       0     0     0
errors: No known data errors




1 comment:

  1. In case you are interested in making cash from your visitors by popunder advertisments - you can try one of the biggest networks - PopAds.

    ReplyDelete