How to use ZFS backend in libvirt?

Hello everyone,

I have a Rocky Linux 9 system that is supposed to provide a storage pool for libvirt. ZFS is setup and working so far. However trying to use the ZFS backend in libvirt simply yields the following error message.

Error creating pool: Could not define storage pool: internal error: missing backend for pool type 12 (zfs)

A quick search on the internet shows that that one is required to install the libvirt-daemon-driver-storage-zfs-package. Unfortunately this package seems not to be available in the Rocky Linux 9 repositories.

In case anyone knows how to make this work would be greatly appreciated. I can’t understand why this wonderful way to do things would not be supported.

@anon49749383, please test this:

Unfortunately, this part is missing due to a Fedora configuration in the SPEC file. But you can easily fix this by rebuilding the package. I have attached the modified SPEC file.

  1. Download the source.
  2. extract
  3. replace the spec file
  4. rebuild SRPM via rpmbuild --define “_topdir $(pwd)” -bs SPECS/libvirt.spec
  5. rebuild RPM packges by: mock -r rocky+epel-9-x86_64 libvirt-10.10.0-15.6.fc42.src.rpm

Now you have the missing module.

patch for the spec file:

--- libvirt.spec	2026-01-28 04:49:20.000000000 +0100
+++ SPECS/libvirt.spec	2026-01-31 22:33:32.203441944 +0100
@@ -79,7 +79,7 @@
 %if 0%{?fedora}
     %define with_storage_zfs      0%{!?_without_storage_zfs:1}
 %else
-    %define with_storage_zfs      0
+    %define with_storage_zfs 1
 %endif
 
 %define with_storage_iscsi_direct 0%{!?_without_storage_iscsi_direct:1}

Due to the crazy prices for ECC RAM, my ZFS project is on hold for the time being. Therefore, I am unable to test the package productively.

Today I have tested it under Rocky 10.1 For the rebuild you must call:



mock -D “%dist .el10_1” -r rocky+epel-10-x86_64 <PATH to the SPRM file>

This is needed, because dnf distro-sync can’t update the package without it.