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.
This will install ZFS v0.7 release on OEL 7.7 and earlier, and ZFS 0.8 on OEL 7.8 and later.
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
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.
# Enable the Oracle Linux kernel repo
sudo yum-config-manager --enable ol7_UEKR4
# 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 | uniq)
# 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
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
Updated gist with fixes: https://gist.github.com/jaytaylor/ecaf836bc678accd1cc2852597a9a594
Thanks for sharing this excellent writeup and instructions, it's certainly saved me a lot of time and probably from much anguish :)
Some changes were needed to get it working on EL7.4:
Use $OS_RELEASE_MAJOR instead of $OS_RELEASE when adding repo.
uname -r
output needs the arch component trimmed from the end.Added o7_UEKR$OS_VERSION_MAJOR repo.
THIS_KERNEL_PACKAGE=$(for i in $(yum -v list kernel-uek-devel --show-duplicates); do echo $(uname -r) | grep -o $i; done)
Notes:
uname -r
bit didn't quite align with the output fromyum -v list ...
command.$ uname -r 4.1.12-112.14.13.el7uek.x86_64 $ yum -v list ... ... > kernel-uek-devel.x86_64 4.1.12-112.14.13.el7uek ol7_UEKR4 ...
As you can see, there is a trailing ".x86_64" in the output from
uname -r
which is not present in theyum list
output.Working line: