OpenZFS
ZFS
ZFS is a combined file system and logical volume manager designed by Sun Microsystems. The features of ZFS include protection against data corruption, support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs, and can be very precisely configured. The two main implementations, by Oracle and by the OpenZFS project, are extremely similar, making ZFS widely available within Unix-like systems. (Wikipedia)
ZFS, OpenZFS and ZFS on Linux
ZFS was developed to be a next generation file system by Sun Microsystems. Oracle purchased Sun Microsystems and ZFS became closed source.
OpenZFS is a project started by many of the original ZFS developers to create an open source implementation of ZFS. It is strategically reducing existing platform related differences in order to ease sharing of source code by bringing together developers from the illumos, FreeBSD, Linux, macOS, NetBSD, and Windows platforms, and a wide range of companies that build products on top of OpenZFS.
ZFS on Linux (ZoL) is the implementation of OpenZFS designed to work in a Linux environment.
Hardware Considerations
Single Disk
ZFS can be used to format a single disk or partition to make use of ZFS's powerful snapshot and replication capabilities without benefeting of ZFS's data redundancy features. In this case ZFS requires little memory resources and runs with little overhead. It even runs fine on average laptops.
If you're going to use ZFS only on a single disk or partition in your openSUSE system to benefit of its snapshot and replication features you might want to consider using Btrfs instead since it's well integrated in openSUSE via Snapper, YaST Partitioner and YaST Filesystem Snapshots tools. More information can be found in the Snapper documentation.
RAID-Z
When using RAID-Z functionality for home and non critical use please note the following:
- It is recommended to use ECC memory if your hardware supports it.
- It is recommended to have at least 8 GB of memory in your system, preferably 1G of memory for every TB of data array capacity if the system will be under heavy use.
- The disks of the data array should be of equal size and preferably the same make,model & batch.
For critical and enterprise customers please read the ZFS documentation for more information and best practices advice.
ZFS on Root
ZFS is currently best suited for data arrays. Using ZFS on root in a Linux system is still experimental, only Ubuntu recently introduced experimental root partition support in version 19.10. openSUSE does not yet support ZFS on root. A growing number of users successfully use Btrfs on root and use ZFS on data storage disks or arrays for the best of both worlds.
Installation
The ZFS packages are not available from the standard repositories. The "Filesystem Tools" repository maintained in [openSUSE Build Service] (OBS) contains ZFS as well as a lot of updated file systems relates packages. You can set the repository and install ZFS via the GUI or the command line.
On more recent systems (those with secure boot and lockdown enabled), the kernel will refuse to load kernel modules that are not signed by a key that is trusted by secure boot. Because OpenZFS is not included in the official repositories, the zfs module is signed using the filesystem project's package signing key and thus by default the kernel will refuse to load the zfs module (as that key is not trusted by your system).
In order to enroll the signing key, install the zfs-ueficert package and reboot. The zfs-ueficert package includes the signing key for the OpenZFS kernel module and will automatically enroll the key into the MOK list, but you must approve the enrollment by rebooting and answering the bootloader prompts. For more information about UEFI and MOK, see openSUSE:UEFI. Note that when the project's signing keys are rotated (which happens once every 2-3 years), you will need to go through the enrollment process on boot again (but the process of requesting the enrollment for the new key will be done automatically by zfs-ueficert).
Installation
Visit the ZFS download page on the openSUSE software portal and select your version of openSUSE. You will presented with the option to graphically install ZFS and it's repository or the option of manual installation.
The ZFS packages are maintained by the filesystem project and are not part of the official openSUSE project.
External Links
- ZFS on the openSUSE Software portal
- openSUSE File Systems repository root
- OBS Filesystem tools and FUSE-related packages
External Introductions and overviews
- Article: Ars walk through: Using the ZFS next-gen filesystem on Linux by Jim Salter for Ars Technica published February 23, 2014
- Article: Digging into the new features in OpenZFS post-Linux migration by Jim Salter for Ars Technica published June 6, 2019
- Video: OpenZFS Basics by Matt Ahrens and George Wilson 1h:28m video from the OpenZFS channel on YouTube published May 14, 2018.
- Video: Becoming a ZFS Ninja Part 1 by Ben Rockwood speaks at CommunityOne, June 2009.
- Video: Becoming a ZFS Ninja Part 2 by Ben Rockwood speaks at CommunityOne, June 2009.
External Tutorials
- Video: Open-ZFS Bootcamp 1h:42m video by Linda Kateley on YouTube published Oct 14, 2014.
- Tutorial: Install ZFS on Debian GNU/Linux A multipart in depth tutorial by Aaron Toponce published in 2012-2013.
ZFS Best Practices and Tuning
- Wiki: ZFS Tuning Guide - freeBSD wiki, last edited 2018-01-19.
- Documentation: ZFS Best Practices Guide (PDF) Published 2010-08-25.
- Documentation: Oracle Solaris ZFS Administration Guide Last edited June 2013.
Common Issues
modprobe: Key rejected by service
Symptom
# modprobe zfs modprobe: ERROR: could not insert 'zfs': Key was rejected by service
Reason
The zfs kernel module's signature is not trusted by your machine, and you are using secure boot with kernel lockdown enabled.
Solution
You need to enroll the signing key of the filesystems project as a trusted key by secure boot so the kernel will trust the key. The simplest way is to install the zfs-ueficert package, which will automatically enroll the key with mokutil. However, you need to reboot your machine before using the module because the key enrollment needs to be manually approved at boot time by the bootloader. See openSUSE:UEFI for more details about mokutil and secure boot keys.
You can also manually enroll the key by downloading the filesystem project's SSL certificate and using mokutil directly, but the benefit of using the zfs-ueficert package is that when the project key is rotated (which happens once every 2-3 years) the key will be automatically enrolled, while the manual process could lead to you missing the rotation and after rebooting the ZFS module will fail to load again.
An alternative option is to disable secure boot, but this can have security implications.