ZFS on Oracle Linux 7

Primary tabs

This is mostly a transcription of the process from the CentOS/RHEL ZoL installation manual.

Install the repo file

Add the ZFSonLinux repo and verify the fingerprint.

Note — manual fingerprint verification is atypical but we'll do it anyway just for kicks.

# Get OS release number in the format used by the ZoL repo
OS_RELEASE=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release) | sed 's/\./_/g')
# Populate this from GitHub if necessary
GITHUB_FINGERPRINT="C93A FFFD 9F3F 7B03 C310 CEB6 A9D5 A1C0 F14A B620"
# Install repo
sudo yum install -y http://download.zfsonlinux.org/epel/zfs-release.el$OS_RELEASE.noarch.rpm
# Get repo fingerprint and normalize it (remove spaces)
REPO_FINGERPRINT=$(gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux | grep "Key fingerprint =" | sed -e 's/ //g' -e 's/Keyfingerprint=//g')
# Compare
if [ $(echo $GITHUB_FINGERPRINT | sed -e 's/ //g') == "$REPO_FINGERPRINT" ]; then
  echo "Fingerprint verified."
fi

Install the DKMS-style packages

Add the EPEL repo if we haven't already:

# Get OS Release number
OS_RELEASE=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))
# Pull the major version number from that
OS_RELEASE_MAJOR=$(echo $OS_RELEASE | cut -d. -f1)
# Install the corresponding EPEL repo
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$OS_RELEASE_MAJOR.noarch.rpm

Install the DKMS ZoL package. Note that we're installing kernel-uek-devel instead of kernel-devel because OL7 ships with the UEK instead of the regular kernel by default. You could always install both packages without any issue if you're unsure.

# Match the installed kernel to a specific kernel-uek-devel release
THIS_KERNEL_PACKAGE=$(for i in $(yum -v list kernel-uek-devel --show-duplicates); do echo $(uname -r) | grep -o $i; done)
# Install the kernel headers first because zfs needs them but does not depend on them
sudo yum install -y kernel-uek-devel-$THIS_KERNEL_PACKAGE
sudo yum install -y zfs

Load the driver

Use modprobe to load the driver, and then you can confirm by tailing dmesg:

[[email protected] ~]# modprobe zfs
[[email protected] ~]# dmesg | tail
<snip>
[165105.669011] <6>fioinf Fusion-io ioDrive Duo 640GB 0000:0e:00.0: Attach succeeded.
[552041.207486] SPL: Loaded module v0.7.3-1
[552042.862591] ZFS: Loaded module v0.7.3-1, ZFS pool version 5000, ZFS filesystem version 5
[[email protected] ~]# 

Set driver to load on boot

The DKMS-style package seems to have a problem ensuring that the driver is set to load on system startup. We have to set that up manually (details):

# Link the dependent services together in systemd
systemctl preset zfs-import-cache zfs-import-scan zfs-mount zfs-share zfs-zed zfs.target
# Then enable the zfs-import-scan service that chains the entire set
systemctl enable zfs-import-scan

Verify that they're all set to load up correctly:

[[email protected] ~]# systemctl list-unit-files | grep zfs
zfs-import-cache.service                      enabled 
zfs-import-scan.service                       enabled 
zfs-mount.service                             enabled 
zfs-share.service                             enabled 
zfs-zed.service                               enabled 
zfs.target                                    enabled 

Reboot, then test a zfs list:

[[email protected] ~]# zfs list
no datasets available

Gist

Tags 
zfs oraclelinux7


QR Code for https://setupexample.com/zfs-oracle-linux-7