Is it possible to use OpenZFS as a file system only in select qubes? How would one do this? Are there any caveats?
Yes, itās possible.
What exactly is your aim? Do you want the qubeās root partition on zfs? Just /home? Something else?
Thanks for your answer! Itās a vault/storage qube, I want to be able to store my files safely and avoid corruption and bitrot.
A zfs filesystem on /home then. I havenāt done something like that before but if you ask me, this is how Iād approach it.
- create a new template, and in it:
- install ZFS
- ensure you have a compatible kernel for your ZFS version (this is a common sticking-point for Debian guests-- install if needed)
- (add pvgrub2-pvh support if needed)
- create appvm based on the template
- create new partition table on appvmās private volume:
partition 1: ext4 of 50 MB or so
partition 2: unformatted, using the remainder of the disk - (in template still:) modify /etc/fstab: change /dev/xvdb to /dev/xvdb1, and remove /rw/home entry
- possibly need to alter qubes-mount-dirs.service so that it doesnāt try to create/mount filesystems we donāt want ?
- load up appvm and create a zpool on the unformatted partition
- create new zfs filesystem for /home, with the option -o copies=2
- set up bind-dirs for /etc/zfs/zpool.cache, so that it exists on xvdb1 (itās unique to the appvm)
- pray that bind-dirs happens before zfs-import-cache.service in the startup process, and if not then need to go delay zfs-import-cache.service in the template.
I think that about covers it?
If your only concern is durability of your data, you may want to also consider btrfs or xfs, since those are also checksumming filesystems but have the benefit of being more integrated with linux, and could therefore be easier to set up.
I do exactly this, use ZFS in vault qube for avoiding corruption and bit rot.
I take a different approach than what @likeafox laid out. I leave the appvm running whatever it normally uses and pass an HBA card through to the VM for hosting all my ZFS pools. In my case I am using Debian-13 with the OpenZFS packages installed from backports (ZFS 2.4).
In my application, I am hosting torrents on my ZFS array. After much testing and rebuilding, I settled on a 1MB record size, with a separate EXT4 drive for downloading to. The torrents get moved to the ZFS array after completion, avoiding fragmentation. I also use high endurance SATA SSDās as special drives to speed up metadata.
Previous to using the special drives, scanning a folder holding ~90TB of files over NFS took ~15 minutes before the directly listing would appear in the media client. After moving to the SSD special drives, the client can now populate the listing in about 15 seconds.
I also enabled the new fast de-dupe, which gives me block level de-duplication. This dove tailed nicely with the use of a download drive (moving torrents to or from breaks hard links and BRT references) and the de-duplication tables get stored on the special drive. So the de-duplication happens transparently with no slow down.
@KB3452 hello! It is very interesting! Maybe you could create a separate topic and write a guide? That would be great for beginners
My answer is about converting the qubeās filesystem to zfs, which seemed to be what OP wanted to do. If you can get away with only using zfs on external media though, thatād greatly simplify configuration for sure.
Also, hang on a minute, did you say youāre running torrents in your vault qube?
Yes, that was what I was trying to convey, all be it poorly, that your method was for the VMās filesystem.
Yes, I used the default vault AppVM as my torrent box. Well mainly the name. I have replaced most of the underlying bits with a template tailored for ZFS and Bittorrent.
If you are thinking, that is a bit ill advised, hehe, I am not your typical Qubes user. I mainly run Qubes to keep malware at bay and to have the entire box using a VPN, just incase anything leaks.
I also pass a few NICs into my vault, and have multiple VPN tunnels running directly on vault, with a separate BT client bound to each VPN tunnel.
So not a typical setup for a āvaultā qube. ![]()
Hey, if it works for you, then great. I just want to be clear, for the sake of everyone else who might read this, that the qube name āvaultā in your case, is a complete misnomer. There is nothing vault-like about your vault, haha