Science and technology

Set up ZFS on Linux with yum

I’m a Fedora Linux consumer who runs yum improve day by day. While this behavior permits me to run all the newest software program (considered one of Fedora’s four foundations is “first,” and it lives as much as that), it additionally highlights any incompatibilities between the ZFS storage platform and a brand new kernel.

As a developer, typically I want new options from the newest ZFS department. For instance, ZFS 2.Zero.Zero accommodates an thrilling new function significantly improving ZVOL sync performance, which is crucial to me as a KVM consumer. But which means if I wish to use the two.Zero.Zero department, I’ve to construct ZFS myself.

At first, I simply compiled ZFS manually from its Git repo after each kernel replace. If I forgot, ZFS would fail to be acknowledged on the following boot. Luckily, I rapidly discovered how you can arrange dynamic kernel module assist (DKMS) for ZFS. However, this resolution is not excellent. For one factor, it would not make the most of the highly effective yum system, which may also help with resolving dependencies and upgrading. In addition, switching between your individual package deal and an upstream package deal is fairly straightforward with yum.

In this text, I’ll show how you can arrange a yum repo for packaging ZFS. The resolution has two steps:

  1. Create RPM packages from the ZFS Git repository
  2. Set up a yum repo to host the packages

Create RPM packages

To create RPM packages, it’s worthwhile to set up the RPM toolchain. Yum offers teams to bundle putting in the instruments:

sudo dnf group set up 'C Development Tools and Libraries' 'RPM Development Tools'

After these have been put in, you should set up all of the packages essential to construct ZFS from the ZFS Git repo. The packages belong to 3 teams:

  1. Autotools to generate construct recordsdata from platform configurations
  2. Libraries for constructing ZFS kernel and userland instruments
  3. Libraries for constructing RPM packages

sudo dnf set up libtool autoconf automake gettext createrepo
    libuuid-devel libblkid-devel openssl-devel libtirpc-devel
    lz4-devel libzstd-devel zlib-devel
    kernel-devel elfutils-libelf-devel
    libaio-devel libattr-devel libudev-devel
    python3-devel libffi-devel

Now you might be able to create your individual packages.

Build OpenZFS

OpenZFS offers wonderful infrastructure. To construct it:

  1. Clone the repository with git and swap to the department/tag that you simply hope to make use of.
  2. Run Autotools to generate a makefile.
  3. Run make rpm and, if every little thing works, RPM recordsdata shall be positioned within the construct folder.

$ git clone --branch=zfs-2.Zero.Zero-rc3 https://github.com/openzfs/zfs.git zfs
$ cd zfs
$ ./autogen.sh
$ ./configure
$ make rpm

Set up a yum repo

In yum, a repo is a server or native path that features metadata and RPM recordsdata. A shopper units up an INI configuration file, and the yum command routinely resolves the metadata and downloads the corresponding packages.

Fedora offers the createrepo software to arrange a yum repo. First, create the repo and duplicate all RPM recordsdata from the ZFS folder to the repo. Then run createrepo --update to incorporate all packages within the metadata:

$ sudo mkdir -p /var/lib/zfs.repo
$ sudo createrepo /var/lib/zfs.repo
$ sudo cp *.rpm /var/lib/zfs.repo/
$ sudo createrepo --update /var/lib/zfs.repo

Create a brand new configuration file in /and so forth/yum.repos.d to incorporate the repo path:

$ echo
"[zfs-local]ntitle=ZFS Localnbaseurl=file:///var/lib/zfs.reponenabled=1ngpgcheck=Zero" |
sudo tee /and so forth/yum.repos.d/zfs-local.repo

$ sudo dnf --repo=zfs-local listing out there --refresh

Finally, you might have reached the top of the journey! You have a working yum repo and ZFS packages. Now you simply want to put in them:

$ sudo dnf set up zfs
$ sudo /sbin/modprobe zfs

Run sudo zfs model to see the model of your userland and kernel instruments. Congratulations! You have ZFS for Fedora.

Most Popular

To Top