ZPOOL: Create a new zpool for zfs filesystems


ZPOOL: Create a new zpool for zfs filesystems

# Tested on RHEL 6 & 7


# ZFS is a combined file system and logical volume manager designed by Sun Microsystems.
# The features of ZFS include protection against data corruption, support for high storage
# capacities, integration of the concepts of filesystem and volume management, snapshots
# and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and
# native NFSv4 ACLs. ZFS is implemented as open-source software, licensed under the Common
# Development and Distribution License (CDDL).


# Even if ZFS can use partitions, it is recommended to use whole disks.

# 'zfs' daemon must be started at boot-up. zpool are not defined in /etc/fstab; the zfs
# daemon will import and mount zfs pools automatically. It reads the file
# /etc/zfs/zpool.cache.



# ------------------------------------------------------------------------------------------
# Creating a concat zpool
# ------------------------------------------------------------------------------------------

POOLNAME=c_pool
POOLMNTP=/c_pool
DEVICE01=/dev/sdb
DEVICE02=/dev/sdc


# At the time of creation, mount point for the newly created pool may be specified. If not
# specified, pool will be mounted under /<zpool_name> (on the other hand, if specified at
# the moment of creation, mountpoint won't be automatically removed when destroying the
# pool)


zpool create -m $POOLMNTP $POOLNAME $DEVICE01 $DEVICE02

# If you have an error like this one:

   invalid vdev specification
   use '-f' to override the following errors:
   /dev/sdb does not contain an EFI label but it may contain partition
   information in the MBR.

# you should use '-f' option to create the pool - first ensure that disk(s) are the
# right one(s):

# zpool create -f -m $POOLMNTP $POOLNAME $DEVICE01 $DEVICE02


# Check

zpool list
   NAME         SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
   c_pool  19.9G   104K  19.9G     0%  1.00x  ONLINE  -


zpool status $
POOLNAME
     pool: c_pool
    state: ONLINE
    scan: none requested
   config:

           NAME        STATE     READ WRITE CKSUM
           c_pool  ONLINE       0     0     0
             sdb       ONLINE       0     0     0
             sdc       ONLINE       0     0     0


zfs list
   NAME         USED  AVAIL  REFER  MOUNTPOINT
   c_pool   104K  19.6G    30K  /c_pool



# ------------------------------------------------------------------------------------------
# Creating a mirrored zpool
# ------------------------------------------------------------------------------------------

POOLNAME=m_pool
POOLMNTP=/m_pool
SUBMIRR1=/dev/sdb
SUBMIRR2=/dev/sdc


# At the time of creation, mount point for the newly created pool may be specified. If not
# specified, pool will be mounted under /<zpool_name> (on the other hand, if specified at
# the moment of creation, mountpoint won't be automatically removed when destroying the
# pool)


zpool create -m $POOLMNTP $POOLNAME mirror $SUBMIRR1 $SUBMIRR2

# If you have an error like this one:

   invalid vdev specification
   use '-f' to override the following errors:
   /dev/sdb does not contain an EFI label but it may contain partition
   information in the MBR.

# you should use '-f' option to create the pool - first ensure that disk(s) are the
# right one(s):

# zpool create -f -m $POOLMNTP $POOLNAME mirror $SUBMIRR1 $SUBMIRR2


# Check

zpool list
   NAME     SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
   m_pool  9.94G   100K  9.94G     0%  1.00x  ONLINE  -


   zpool status
$POOLNAME
     pool: m_pool
    state: ONLINE
    scan: none requested
   config:

           NAME        STATE     READ WRITE CKSUM
           m_pool      ONLINE       0     0     0
             mirror-0  ONLINE       0     0     0
               sdb     ONLINE       0     0     0
               sdc     ONLINE       0     0     0

   errors: No known data errors


zfs list
   NAME     USED  AVAIL  REFER  MOUNTPOINT
   m_pool   100K  9.78G    30K  /m_pool


Article Number: 186
Posted: Sun, Jun 3, 2018 9:14 AM
Last Updated: Sun, Jun 3, 2018 9:14 AM

Online URL: http://kb.ictbanking.net/article.php?id=186