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
Installing and Configuring an OCFS2 Clustered File System
Viewed 5493 times since Sat, Jun 2, 2018
Linux Network (TCP) Performance Tuning with Sysctl
Viewed 10821 times since Fri, Aug 3, 2018
Linux Customizing Bash
Viewed 1845 times since Sun, Dec 6, 2020
Linux RAID Mdadm Cheat Sheet
Viewed 4906 times since Fri, May 15, 2020
Using IOzone for Linux disk performance analysis
Viewed 7190 times since Wed, Jul 25, 2018
12 Linux Rsync Options in Linux Explained
Viewed 11579 times since Wed, Oct 31, 2018
debian How to check Debian CVE status using python script
Viewed 3302 times since Sun, Sep 23, 2018
Linux Linux Network Statistics Tools / Commands
Viewed 8706 times since Mon, Sep 21, 2020
Moving SSL Certificate from IIS to Apache
Viewed 1667 times since Mon, Feb 18, 2019
RHEL: Rebuilding the initial ramdisk image
Viewed 6529 times since Sat, Jun 2, 2018