Thursday, June 4, 2015

Create type of ZFS Pools aka "ZPOOL" on Solaris

I am explain how to create multiple type of ZFS pools aka ZPOOL.

Generally we can create file system using traditional method which is reside on single DISK / LUN, and we can't create large size of file system more then DISK or LUN SIZE.

In this case we need Volume Manager Software to compile multiple disks / LUN's to make one group and using that group to create multiple file systems with large size.

ZPOOL is Simplify Storage / Volume Manager Software, one of the good feature from Solaris 10 Operating System.


Capacity:
ZFS is a 128-bit file system,[35][36] so it can address 1.84 × 1019 times more data than 64-bit systems such as Btrfs. The limitations of ZFS are designed to be so large that they should not be encountered in the foreseeable future.
Some theoretical limits in ZFS are:
  • 248 number of entries in any individual directory[37]
  • 16 exbibytes (264 bytes): maximum size of a single file
  • 16 exbibytes: maximum size of any attribute
  • 256 zebibytes (278 bytes): maximum size of any zpool
  • 256 number of attributes of a file (actually constrained to 248 for the number of files in a ZFS file system)
  • 264 number of devices in any zpool
  • 264 number of zpools in a system
  • 264 number of file systems in a zpool
Type of Layouts:

Stripe:
A stripe has no redundancy, but you will get full capacity of the drives.
Stripe concept is useful when speed and capacity is only the concern.
You compare with "raid-0".

In stripe concept if one disk is failed all data will be lost.

Mirror:
Generally we have two type of common use mirror type.

A two-way mirror will lose redundancy if one drive loss.
A three-way mirror will lose redundancy with two drive losses.
You can compare with "raid-1".

RaidZ and RaidZ-1:
RAIDZ and RaisZ1 both are similar.
RAIDZ and RAIDZ-1  will lose redundancy if one drive loss.
May be you can compare with "raid-5", except there’s no "write-hole" problem.

RaidZ-2:
Will lose redundancy if two disk losses on same time.
May be you can compare with "raid-6", except there’s no "write-hole" problem.

RaidZ-3:
Will lose redundancy if three disk losses on same time.

Will see step by step to create multiple type of ZPOOL's with multiple options.

Dry run for pool creation:

TID{root}# zpool create -n drypool c1t2d0
would create 'drypool' with the following layout:

        drypool
          c1t2d0
TID{root}# zpool list drypool
cannot open 'drypool': no such pool
TID{root}#
Creating Basic pool "strip_poole" and check the pools status:
TID{root}# zpool create strip_pool c1t2d0
TID{root}# zpool status strip_pool
  pool: strip_pool
 state: ONLINE
 scan: none requested
config:

        NAME             STATE     READ WRITE CKSUM
        strip_pool       ONLINE       0     0     0
            c1t2d0       ONLINE       0     0     0

errors: No known data errors
TID{root}# zpool list strip_pool
NAME    SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
strip_pool  1.98G  78.5K  1.98G     0%  ONLINE  -
TID{root}# df -h /strip_pool
Filesystem             size   used  avail capacity  Mounted on
strip_pool                  2.0G    31K   2.0G     1%    /strip_pool
TID{root}#
You may see error some time when you use already used disk which was used by some other pool or some where , in that time you have to use "-f" to force the system to create pool, but make sure currently that disk is not having any data and not using anywhere, mean free disk and can be used for. 
e.g
TID{root}# zpool create strip_pool c1t2d0
invalid vdev specification
use '-f' to override the following errors:
/dev/dsk/c1t2d0s0 contains a ufs filesystem.
TID{root}# zpool create -f strip_pool c1t2d0
TID{root}# zpool list strip_pool
NAME    SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
strip_pool  1.98G  78.5K  1.98G     0%  ONLINE  -
TID{root}#
Create pool with different mount point:
TID{root}# zpool create -m /strip_poolmount strip_pool c1t2d0
TID{root}# df -h /strip_poolmount
Filesystem             size   used  avail capacity  Mounted on
strip_pool                  2.0G    31K   2.0G     1%    /strip_poolmount
TID{root}#
Create Mirror Pool:
TID{root}# zpool create poolm mirror c1t5d0 c1t6d0
TID{root}# df -h /poolm
Filesystem             size   used  avail capacity  Mounted on
poolm                  2.0G    31K   2.0G     1%    /poolm
TID{root}# zpool list poolm
NAME    SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
poolm  1.98G  78.5K  1.98G     0%  ONLINE  -
TID{root}# zpool status poolm
  pool: poolm
 state: ONLINE
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        poolm       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c1t5d0  ONLINE       0     0     0
            c1t6d0  ONLINE       0     0     0

errors: No known data errors
TID{root}#
Create two-way mirror and check status:
TID{root}# zpool create mirr2 mirror c1t2d0 c1t5d0 mirror c1t6d0 c1t8d0
TID{root}# df -h /mirr2
Filesystem             size   used  avail capacity  Mounted on
mirr2                  3.9G    31K   3.9G     1%    /mirr2
TID{root}# zpool list mirr2
NAME    SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
mirr2  3.97G  81.5K  3.97G     0%  ONLINE  -
TID{root}# zpool status mirr2
  pool: mirr2
 state: ONLINE
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        mirr2       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c1t2d0  ONLINE       0     0     0
            c1t5d0  ONLINE       0     0     0
          mirror-1  ONLINE       0     0     0
            c1t6d0  ONLINE       0     0     0
            c1t8d0  ONLINE       0     0     0

errors: No known data errors
TID{root}#
Create RAID-Z pool:
TID{root}# zpool create raidz raidz c1t5d0 c1t6d0 c1t8d0
cannot create 'raidz': name is reserved
pool name may have been omitted
TID{root}# zpool create poolz raidz c1t5d0 c1t6d0 c1t8d0
TID{root}# zpool list poolz
NAME    SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
poolz  5.94G   166K  5.94G     0%  ONLINE  -
TID{root}# df -h /poolz
Filesystem             size   used  avail capacity  Mounted on
poolz                  3.9G    34K   3.9G     1%    /poolz
TID{root}# zpool status poolz
  pool: poolz
 state: ONLINE
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        poolz       ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            c1t5d0  ONLINE       0     0     0
            c1t6d0  ONLINE       0     0     0
            c1t8d0  ONLINE       0     0     0

errors: No known data errors
TID{root}#
Create RAID-Z1 pool:
TID{root}# zpool create poolz1 raidz1 c1t2d0 c1t5d0 c1t6d0 c1t8d0 c1t9d0 c1t10d0
TID{root}# zpool status poolz1
  pool: poolz1
 state: ONLINE
 scan: none requested
config:

        NAME         STATE     READ WRITE CKSUM
        poolz1       ONLINE       0     0     0
          raidz1-0   ONLINE       0     0     0
            c1t2d0   ONLINE       0     0     0
            c1t5d0   ONLINE       0     0     0
            c1t6d0   ONLINE       0     0     0
            c1t8d0   ONLINE       0     0     0
            c1t9d0   ONLINE       0     0     0
            c1t10d0  ONLINE       0     0     0

errors: No known data errors
TID{root}#
Create RAID-Z2 pool:
TID{root}# zpool create poolz2 raidz2 c1t2d0 c1t5d0 c1t6d0 c1t8d0 c1t9d0 c1t10d0
TID{root}# zpool status poolz2
  pool: poolz2
 state: ONLINE
 scan: none requested
config:

        NAME         STATE     READ WRITE CKSUM
        poolz2       ONLINE       0     0     0
          raidz2-0   ONLINE       0     0     0
            c1t2d0   ONLINE       0     0     0
            c1t5d0   ONLINE       0     0     0
            c1t6d0   ONLINE       0     0     0
            c1t8d0   ONLINE       0     0     0
            c1t9d0   ONLINE       0     0     0
            c1t10d0  ONLINE       0     0     0

errors: No known data errors
TID{root}#
Create RAID-Z3 pool:
TID{root}# zpool create poolz3 raidz3 c1t2d0 c1t5d0 c1t6d0 c1t8d0 c1t9d0 c1t10d0
TID{root}# zpool status poolz3
  pool: poolz3
 state: ONLINE
 scan: none requested
config:

        NAME         STATE     READ WRITE CKSUM
        poolz3       ONLINE       0     0     0
          raidz3-0   ONLINE       0     0     0
            c1t2d0   ONLINE       0     0     0
            c1t5d0   ONLINE       0     0     0
            c1t6d0   ONLINE       0     0     0
            c1t8d0   ONLINE       0     0     0
            c1t9d0   ONLINE       0     0     0
            c1t10d0  ONLINE       0     0     0

errors: No known data errors
TID{root}#
Adding disk and Expanding existing pool size:
TID{root}# zpool status strip_pool
  pool: strip_pool
 state: ONLINE
 scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        strip_pool    ONLINE       0     0     0
            c1t2d0    ONLINE       0     0     0

errors: No known data errors
TID{root}# df -h /strip_pool
Filesystem             size   used  avail capacity  Mounted on
strip_pool               2.0G    31K   2.0G     1%    /strip_pool
TID{root}# zpool add strip_pool c1t5d0
TID{root}# zpool status strip_pool
  pool: strip_pool
 state: ONLINE
 scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        strip_pool    ONLINE       0     0     0
            c1t2d0    ONLINE       0     0     0
            c1t5d0    ONLINE       0     0     0

errors: No known data errors
TID{root}# zpool add strip_pool c1t5d0
TID{root}# df -h /strip_pool
Filesystem             size   used  avail capacity  Mounted on
strip_pool               3.9G    31K   3.9G     1%    /strip_pool
TID{root}#
Adding spare disk to existing pool:
TID{root}# zpool list strip_pool
NAME       SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
strip_pool  1.98G  78.5K  1.98G     0%  ONLINE  -
TID{root}# zpool status strip_pool
  pool: strip_pool
 state: ONLINE
 scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        strip_pool    ONLINE       0     0     0
            c1t2d0    ONLINE       0     0     0

errors: No known data errors
TID{root}# zpool add strip_pool spare c1t5d0
TID{root}# zpool status strip_pool
  pool: strip_pool
 state: ONLINE
 scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        strip_pool    ONLINE       0     0     0
            c1t2d0    ONLINE       0     0     0
        spares
            c1t5d0    AVAIL

errors: No known data errors
TID{root}# zpool list strip_pool
NAME       SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
strip_pool  1.98G   132K  1.98G     0%  ONLINE  -
TID{root}#
Multiple way to check pool information:
TID{root}# zpool status -x strip_pool
pool 'strip_pool' is healthy
TID{root}# zpool status -v strip_pool
  pool: strip_pool
 state: ONLINE
 scan: none requested
config:

        NAME          STATE     READ WRITE CKSUM
        strip_pool    ONLINE       0     0     0
            c1t2d0    ONLINE       0     0     0
        spares
            c1t5d0    AVAIL

errors: No known data errors
TID{root}# zpool list strip_pool
NAME       SIZE  ALLOC   FREE    CAP  HEALTH  ALTROOT
strip_pool  1.98G  95.5K  1.98G     0%  ONLINE  -
TID{root}#
Still will see more useful commands related to ZPOOL on next posts.....

0 comments:

Post a Comment