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
ZPOOL: Verify/change properties of a zpool
Viewed 2114 times since Sun, Jun 3, 2018
20 IPtables Examples For New SysAdmins
Viewed 2202 times since Fri, May 15, 2020
20 Linux Command Tips and Tricks That Will Save You A Lot of Time linux
Viewed 4762 times since Thu, Apr 18, 2019
How To Find Largest Top 10 Files and Directories On Linux / UNIX / BSD find
Viewed 3866 times since Mon, Oct 29, 2018
Fałszujemy rozpoznania skanerów #1
Viewed 3035 times since Mon, May 21, 2018
YUM CRON Enabling automatic updates in Centos 7 and RHEL 7
Viewed 11945 times since Fri, Oct 26, 2018
RHEL: How to rebuild and/or patch a RPM package
Viewed 8736 times since Sat, Jun 2, 2018
LVM: Reduce SWAP size by removing a Logical Volume
Viewed 2062 times since Sat, Jun 2, 2018
RHEL: Allowing users to ’su’ to "root" / Allowing ’root’ to login directly to the system using ’ssh’
Viewed 2888 times since Sat, Jun 2, 2018
Creating SWAP partition using FDISK & FALLOCATE commands
Viewed 3460 times since Thu, Jan 16, 2020