All HowTo's Linux Redhat, Fedora and CentOS Linux

Create a ZFS filesystem & Extend it over a new disk on CentOS or Redhat

In this tutorial we’re going to create a ZFS filesystem on Disk1 and then extend it to Disk2. We’re not going to worry about redundancy because this is a tutorial but ZFS does support common RAID types. We’ll configure ZFS for RAID0 (no parity, no redundancy). In the real world, you’d almost certainly use a RAID with redundancy unless your joining disks from a SAN perhaps.

This tutorial is for Redhat or CentOS 7.x.

yum upgrade
yum localinstall --nogpgcheck https://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
yum localinstall --nogpgcheck http://archive.zfsonlinux.org/epel/zfs-release.el7.noarch.rpm
yum install zfs 

List your current ZFS filesystems. I don’t have any so none appear in the results:

zfs list

If you have problems with modules at this point, try running “yum install kernel*”. Otherwise the “yum upgrade” at the top of this tutorial should help. You may need to reboot to load the new kernel after an upgrade.

Let’s create the first ZFS filesystem where “/dev/sdb” is your first ZFS disk:

zpool create -f zfs_volume /dev/sdb

TIP: You can use create these kinds of RAID:

# RAID0 - striped
zpool create -f zfs_volume /dev/sdb /dev/sdc /dev/sdd

# RAID1 - mirror
zpool create mirror -f zfs_volume /dev/sdb /dev/sdc

# RAID5 - striped with parity
zpool create raidz -f zfs_volume /dev/sdb /dev/sdc /dev/sdd

# RAID6 - striped with two parity
zpool create raidz2 -f zfs_volume /dev/sdb /dev/sdc /dev/sdd /dev/sde

# RAID10 - striped over mirror
zpool create mirror -f zfs_volume /dev/sdb /dev/sdc
zpool add mirror -f zfs_volume /dev/sdd /dev/sde

It should have mounted for you. And check that it worked:

zfs list
df -h

And expand it over the second disk where “/dev/sdc” is your second ZFS disk:

zpool add -f zfs_volume /dev/sdc

And confirm it worked:

zfs list
df -h

References:

An Introduction to the Z File System (ZFS) for Linux


http://zfsonlinux.org/epel.html

ZFS RAID levels

Leave a Reply

Your email address will not be published. Required fields are marked *