Monday, December 11, 2017

ZFS on CentOS : Initial setup

CentOS install

Info on the hardware I'm using can be found here.

For this demo, I'm using a minimal CentOS install. All install options are otherwise default.

Post install run a full system update

#yum update

Installing ZFS

I'm following the instructions here from zfsonlinux, annotating with additional steps I had to use to get things working.

First we need to install two required repositories; the epel-release and zfsonlinux repos

# yum install epel-release
# yum install http://download.zfsonlinux.org/epel/zfs-release.el7_4.noarch.rpm 

These will give us access to the various non-standard packages we need to complete the install. Now install kerenl-devel and reboot, I find the reboot here helps prevent errors down the line (which I talk more about below).

# yum install kernel-devel
# reboot

Now install zfs, and reboot again (again this helps with errors)

# yum install zfs
# reboot
This should complete without errors (if you get an error about 'requires dkms >= x.x.x.x' make sure the epel-release repo installed/ is working correctly) Now Let's see if it works correcyly with a zpool status. We don't have any pools yet, so this won't generate any info, but it will throw an error if things didn't install correctly

# zpool status
no pools available

However if we do get an error, then we'll have to do a bit of troubleshooting. I've run through this process four times now, and it hasn't worked exactly the same way twice. Here's a few of the errors I ran into.

DKMS required version

As explain above. This error shows up during the install of zfs if the epel-release repo has not been correctly setup. zfs requires a newer version of dkms than is available through the standard repositories.

The ZFS modules are not loaded

The error comes up after running the 'zpool status' command. This error indicates that the kernel modules didn't install correctly during the zfs install. As mentioned before, I haven't found a precise cause of this but there's a few ways to work around it. First get the status of the modules:

# dkms status
There should be two different modules 'spl' and 'zfs'. These modules should be 'installed' however if they are just listed as 'added' try the following:

  • If both show installed, try using modprobe to load the module
    • modprobe zfs
  • If spl is listed as added, reboot the machine this will often allow that module to install. If spl doesn't install with a reboot, try to manually install it:
    • dkms install -m spl -v x.x.x
    • the version x.x.x will be listed in the 'dkms status' command 
  • if spl is installed, but zfs is just 'added', first try a reboot, if that doesn't work try a manual install
    • dkms install -m zfs -v x.x.x
      • version x.x.x will be listed in the 'dkms status' command
    • If manual install throws an error, run the manual install again
      • This did actually happen to me once, manual install failed, ran the exact same command again, then it worked.
    • If manual install continues to fail, we'll need to clear out the module and start over
      • dkms remove -m zfs -v x.x.x --all
      • dkms add -m zfs -v x.x.x
      • dkms install -m zfs -v x.x.x

No comments:

Post a Comment