We're going to add ZFS support to our Oracle Linux installation. We'll just add the ZFS on Linux Repo, verify the binary signature from GitHub, install the files, ensure the driver loads properly, and verify that it's functional. We'll save things like array creation for another document.
This is mostly a transcription of the process from the CentOS/RHEL ZoL installation manual.
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
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
# Add yum repo coreesponding with EL version.
if [ $OS_RELEASE = '7.3' ] ; then
echo '[ol7_UEKR3]
name=Latest Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/UEKR3/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
[ol7_UEKR3_OFED20]
name=OFED supporting tool packages for Unbreakable Enterprise Kernel on Oracle Linux 7 ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/UEKR3_OFED20/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
priority=20' \
| tee /etc/yum.repos.d/ol7_UEKR3.repo
elif [ $OS_RELEASE = '7.4' ] ; then
echo '[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1' \
| tee /etc/yum.repos.d/ol7_UEKR4.repo
fi
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
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 | sed 's/\.x86_64//') | grep -o $i; done)
# Install the kernel headers first because zfs needs them but does not depend on them
yum install -y kernel-uek-devel-$THIS_KERNEL_PACKAGE
yum install -y zfs
Use modprobe
to load the driver, and then you can confirm by tail
ing dmesg
:
[root@drew-metal ~]# modprobe zfs
[root@drew-metal ~]# 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
[root@drew-metal ~]#
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:
[root@drew-metal ~]# 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
:
[root@drew-metal ~]# zfs list
no datasets available