Playing with ZFS?

I am playing a bit with ZFS on NethServer and ask myself if it is possible to mount /var/lib/nethserver on a ZFS?

What I tried so far is:

##### HowTo install ZFS under NS7 #####


### Step 1: Add ZFS Repository ###

# Check CentOS version:
cat /etc/redhat-release

# Add the repo:
wget https://download.zfsonlinux.org/epel/zfs-release.el7_7.noarch.rpm --no-check-certificate

# Install zfs
yum install zfs-release.el7_7.noarch.rpm -y


### Step 2: DKMS vs kABI ###

# Disable DKMS and enable kABI (enabled=0, enabled=1):
nano /etc/yum.repos.d/zfs.repo

[zfs]
name=ZFS on Linux for EL7 - dkms
baseurl=https://download.zfsonlinux.org/epel/7.4/$basearch/
enabled=0
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux

[zfs-kmod]
name=ZFS on Linux for EL7 - kmod
baseurl=https://download.zfsonlinux.org/epel/7.4/kmod/$basearch/
enabled=1
metadata_expire=7d
gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux


### Step 3: Installing ZFS ###

# install ZFS
yum install zfs -y

# Load zfs module on boot (comment out zfs):
nano /usr/lib/modules-load.d/zfs.conf

# reboot
reboot


### Step 4: Check ZFS Kernel Module ###

# Check if the ZFS kernel module is loaded automatically after reboot:
lsmod | grep zfs


### Step 5: Creating ZFS Pool ###

# To create a mirror pool of just two additional disks:
zpool create zdata mirror /dev/sdb /dev/sdc

# Copy data from /var/lib/nethserver/ to /zdata/:
rsync -avr /var/lib/nethserver/ /zdata/

# Set mountpoint legacy:
zfs set mountpoint=legacy zdata

# Add mountpoint to fstab:
nano /etc/fstab

zdata   /var/lib/nethserver     zfs     defaults 1 2

# Test mounting
mount -a

If I reboot the server I get an error:

After Control-D the server is booting…

What do you think, does ZFS make sense…?

1 Like

Yes.

I haven’t had any need to edit this file.

You can set the mountpoint during pool creation: zpool create -o mountpoint=/var/lib/nethserver zdata mirror /dev/sdb /dev/sdc (although /dev/disk/by-id/ identifiers seem to be preferred). Alternatively, once you’ve finished moving the data over, simply set the mountpoint to the desired location rather than to legacy.

Edit: FWIW, the way I did it was to do the minimal CentOS install, install ZFS, create the pool with the mountpoint at /var/lib/nethserver/, and then do the rest of the Neth installation.

I had to do this to load the module on every boot…

OK, I will test it. After xmas…