How to install ZFS on Qubes OS
A guide for advanced Qubes OS users and developers who want to use OpenZFS on their systems.
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.
Why?
So why would you want to use ZFS with Qubes OS? Here are a few reasons:
- Qubes OS has native support for storing the data of your qubes on ZFS volumes.
- ZFS checksums all your data, so undetectable corruption is impossible.
- If you use mirroring to store your data, data corruption is automatically healed too.
- ZFS also compresses your data, so your disks go a much longer way — and compression makes disk accesses faster too.
- You can choose between light compression all the way to the heaviest gzip compression.
- You can use tools like
zfs snapshot
andzfs send / recv
to safeguard your qubes and experiment with them safely.- Do you want to keep extra snapshots of a qube? No problem!
- Do you want automatic snapshots? zfs-auto-snapshot to the rescue!
- Do you want to release snapshot space for a specific qube? You can do that as well.
- It is the most tested file system of them all, so your data is extremely safe with it.
- Managing a ZFS pool — adding storage, checking consistency, snapshotting and reverting — is much, much easier than managing LVM volumes.
- Do you want to pivot to a larger hard disk or SSD while the system runs? That's easy with ZFS'
zpool attach
andzpool detach
.
- Do you want to pivot to a larger hard disk or SSD while the system runs? That's easy with ZFS'
- Disk space management in ZFS is superb.
- In Qubes OS, all qubes backed by ZFS support
TRIM
, which means qubes automatically release all freed data back to the operating system. - ZFS itself supports
TRIM
, automatic (withautotrim
pool property) or manual (throughzpool trim
), to keep your SSDs running at their top speed.
- In Qubes OS, all qubes backed by ZFS support
How?
The following instructions will only work on Qubes OS 4.2 and later.
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. Here is a summary of instructions:
In your disposable qube
cd ; git clone https://github.com/Rudd-O/zfs-fedora-installer
In dom0, after cloning
cd ; qvm-run -p <name of dispvm> tar c zfs-fedora-installer | tar xv
Be aware that you will be executing code made by me on your dom0.
Change into the folder containing the transferred repository (zfs-fedora-installer
), and run sudo ./deploy-zfs
.
The script will obtain the necessary source code and install the necessary dependencies on your Qubes OS system. After a few minutes, you'll have a from-source deployment of ZFS and ZFS-DKMS on your system, such that every kernel upgrade automatically builds and installs its corresponding ZFS module. The sources can be found in /usr/src
.
Now systemctl restart systemd-udevd
to pick up the new udev rules (the script will not do that for you).
Try ZFS by running sudo zfs
.
That is all. You are ready to migrate your qubes to your ZFS pool. Enjoy!