How to install ZFS on Qubes OS

published Feb 28, 2023, last modified Mar 22, 2023

A guide for advanced Qubes OS users and developers who want to use OpenZFS on their systems.

How to install ZFS on Qubes OS

Qubes OS is one of the most secure desktop operating systems out there.  ZFS is one of the safest file systems out there.

This guide will help you marry the both.


So why would you want to use ZFS with Qubes OS?  Here are a few reasons:

  1. ZFS checksums all your data, so undetectable corruption is impossible.
    1. If you use mirroring to store your data, data corruption is automatically healed too.
  2. ZFS also compresses your data, so your disks go a much longer way — and compression makes disk accesses faster too.
    1. You can choose between light compression all the way to the heaviest gzip compression.
  3. You can use tools like zfs snapshot and zfs send / recv to safeguard your qubes and experiment with them safely. 
    1. Do you want to keep extra snapshots of a qube?  No problem!
    2. Do you want automatic snapshots?  zfs-auto-snapshot to the rescue!
    3. Do you want to release snapshot space for a specific qube?  You can do that as well.
  4. It is the most tested file system of them all, so your data is extremely safe with it.
  5. Managing a ZFS pool — adding storage, checking consistency, snapshotting and reverting — is much, much easier than managing LVM volumes.
    1. Do you want to pivot to a larger hard disk or SSD while the system runs?  That's easy with ZFS' zpool attach and zpool detach.
  6. Disk space management in ZFS is superb.
    1. In Qubes OS, all qubes backed by ZFS support TRIM, which means qubes automatically release all freed data back to the operating system.
    2. ZFS itself supports TRIM, automatic (with autotrim pool property) or manual (through zpool trim), to keep your SSDs running at their top speed.


Install to dom0 the packages listed in this linked section and this other linked section using qubes-dom0-update.

Install to dom0 the kernel-devel package corresponding to the kernel you are running right now (uname -r).

Clone this repository to a trustworthy AppVM of your choice, then transfer the contents of the repository to a folder in your Qubes OS dom0.

Change into the folder containing the transferred repository, and run sudo ./deploy-zfs.  You might experience packages missing on your system, and the script will alert you of that with an error.  Simply revise the list linked at the top of this document to see if you must check again and install packages your system still lacks.

After a few minutes, you'll have a from-source deployment of ZFS and ZFS-DKMS on your system, such that every new kernel automatically builds and installs its corresponding ZFS module.  The sources can be found in /usr/src.

Try ZFS by running sudo zfs.

That is all.  You are ready to migrate your qubes to your ZFS pool.  Enjoy!