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
UUIDs and Linux: Everything you ever need to know [Update]
Viewed 4834 times since Tue, Jul 17, 2018
Linux - How to get IP and MAC address of ethernet adapter in Linux
Viewed 2560 times since Fri, Jun 8, 2018
How to configure an SSH proxy server with Squid
Viewed 2912 times since Sun, Dec 6, 2020
How to maximise SSD performance with Linux
Viewed 8510 times since Fri, May 15, 2020
Linux Network (TCP) Performance Tuning with Sysctl
Viewed 11335 times since Fri, Aug 3, 2018
An easier way to manage disk decryption at boot with Red Hat Enterprise Linux 7.5 using NBDE
Viewed 7275 times since Mon, Aug 6, 2018
Stunnel Setup
Viewed 17584 times since Fri, Sep 28, 2018
RHEL: Retrieve and generate a unique SCSI identifier
Viewed 2922 times since Sat, Jun 2, 2018
RHEL7 slow ssh login
Viewed 4180 times since Tue, Aug 6, 2019
RHEL: Route network packets to go out via the same interface they came in
Viewed 2881 times since Sat, Jun 2, 2018