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
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
CentOS / RHEL 7 : Configuring an NFS server and NFS client Linux NFS
Viewed 16552 times since Fri, Feb 21, 2020
Automatic YUM Updates with Yum-cron
Viewed 10705 times since Fri, Oct 26, 2018
RHEL: GPT/MBR partition tables (using disks larger than 2 TiB)
Viewed 12405 times since Sun, May 27, 2018
Stunnel Setup
Viewed 17886 times since Fri, Sep 28, 2018
RHCS6: Extend an existing Logical Volume / GFS2 filesystem
Viewed 3340 times since Sun, Jun 3, 2018
Linux – delete the LUN and remove traces from OS
Viewed 3699 times since Tue, May 22, 2018
RHEL: Displaying/setting kernel parameters - ’sysctl’
Viewed 3102 times since Sat, Jun 2, 2018
LVM: Move allocated PE between Physical Volumes
Viewed 3988 times since Sat, Jun 2, 2018
Linux - How to unlock and reset user’s account
Viewed 4652 times since Fri, Jun 8, 2018
An easier way to manage disk decryption at boot with Red Hat Enterprise Linux 7.5 using NBDE
Viewed 7675 times since Mon, Aug 6, 2018