ZFS is a file system that system administration nerds love. With it, you can do incredible things like pool all of your hard drives together, mirror them, take system snapshots, and a lot more. In fact, the ZFS file system is quickly becoming the file system of choice in data centers. Unfortunately, Linux is being left behind, as there are some legal conflicts. These legal issues make it so that Linux distributions can’t lawfully distribute the source code inside of the Linux kernel, or on individual operating systems. Luckily, fans of this file system can still get it working, thanks to ZFS on Linux. Here’s how to get it for your Linux distribution.
Installing ZFS On Linux
The ZFS file system will not work on Linux like other file systems. This is because there isn’t any code in it that goes well with the GPL. Despite this, many users really like the file system, and have taken the time to make it work with the Linux operating system. To use it, you’ll need to install modules in the kernel, and etc.
sudo apt install zfsutils
Those using Ubuntu 16.04 need to install a different package:
sudo apt install zfs
To install the ZFS file system and tools on Debian, you have to first install the kernel headers:
sudo apt-get install linux-headers-$(uname -r)
With the Linux headers added to the system, Debian can now compile kernel modules on its own. This is important, as ZFS will not work on Debian without a kernel module, and considering the ZFS software license isn’t compliant with the GPL software license, Debian can’t distribute the software pre-compiled.
To start compiling the kernel module, install the following software:
sudo apt-get install zfs-dkms zfsutils-linux
Building the DKMS kernel module may take a bit of time. When it completes, the ZFS file system is ready to use.
Boot From ZFS On Debian
Want to boot from ZFS on Debian? If so, you’ll need to install additional software:
sudo apt-get install zfs-initramfs
Want to use ZFS on Arch Linux? Here’s how. First, head over to this page, look for “Download snapshot“and click it. With the snapshot downloaded, open a file manager and use the CD command to go to the Downloads directory where the ZFS package was downloaded.
Extract the snapshot using the tar command.
tar xvzf zfs-linux.tar.gz
sudo pacman -U *.tar.xz
Boot From ZFS On Arch Linux
ZFS on Linux doesn’t require any compiling, but it’s not directly distributed by Redhat either. To fix this, you’ll need to download an RPM and install it.
Fedora 27 users: this Fedora 26 binary should work OK, but use at your own risk!
sudo dnf install https://download.zfsonlinux.org/fedora/zfs-release.fc26.noarch.rpm -y
In addition to installing this RPM, you should also install:
sudo dnf install kernel-devel -y
Getting ZFS to work on OpenSUSE is a little easier than most RPM based distributions. This is due to the fact that it has a large repository of software that users can submit, and create easy one-click install pages. ZFS is no different. To get the file system working on your OpenSUSE system, head over to this page here, and click on the version of OpenSUSE that you use.
From here, click the 1-click installation button to bring up the OpenSUSE software installer. Follow the instructions on the screen, and soon the software will be installed!
ZFS on Linux is a project that aims to bring the Oracle file system to everyone’s favorite GNU platform. Due to legal issues, it is very dangerous to directly distribute the ZFS software in any Linux distributions, so none do it (except for Ubuntu, but they’re brave).
Since the software doesn’t comply with the greater Linux community’s licensing terms, anyone that wants to install and use this file system will need to do so with the source code alone because the project itself only supports a handful of Linux operating systems, and they can’t possibly generate binary packages for everyone.
If you’re looking to get ZFS on Linux to work in a zpool on your server, or maybe to boot from on your sleek hacker machine for bragging rights, you’ll need to download the source code and start from scratch. The code for everything, as well as the instructions on how to build it is here.