ZFS on Root guide

This guide assumes you have already created your partition layout needed for your system. We will also assume your partition layout is:

  /dev/sda1 /boot (formatted with vfat)
  /dev/sda2 /
Install ZFS module

First we need to install the ZFS binaries we need and also the kernel module. We can either install manually with makepkg, or use my recommended method: yay.

 pacman -S git go
 git clone https://aur.archlinux.org/yay
 cd yay
 makepkg -i

After installing yay, install zfs-dkms-git from AUR

 yay zfs-dkms-git

Load the module

 modprobe zfs
Create the ZFS pool

Next we create the ZFS pool, named zroot.
This is to create a standard single pool, no mirror or RAID

 zpool create -o ashift=12 zroot /dev/sda2
Create the ZFS datasets

Next, decide how you want your ZFS datasets(can be looked as partitions) to be laid out.
Create your layout how you want now, or it is near impossible to redo besides doing another install

The following is how I do my basic layout

 zfs create -o compression=lz4 -o mountpoint=none zroot/ROOT
 zfs create -o compression=lz4 -o mountpoint=/ zroot/ROOT/default
 zfs create -o compression=lz4 -o mountpoint=none zroot/HOME
 zfs create -o compression=lz4 -o mountpoint=/home/{USERNAME} zroot/HOME/{USERNAME}
Set ZFS pool to import

Tell the bootloader which pool to import/use

 zpool set bootfs=zroot/ROOT/default

Set ZFS' cachefile

 zpool set cachefile=/etc/zfs/zpool.cache zroot
Artix install preparation

Now we need to export the pool

 zpool export zroot

Now we import the pool, prior to installation. This mounts the pool to the location we need to install Artix Linux in.

 zpool import -d /dev/sda2 -R /mnt zroot

Create the boot directory and mount

 mkdir /mnt/boot
 mount /dev/sda1 /mnt/boot

Now you can follow Installation



 Currently the 5.x kernels have issues with ZFS, 
 so linux-lts and linux-lts-headers packages needs to be used.

General ZFS information

 The more memory you have the better ZFS will do, as ZFS itself uses memory for it's L2ARC for cache
 which is one thing that generally makes ZFS feel faster. I personally run ZFS on a 8GB RAM system fine.

Boot Manager

 I recommend using rEFInd boot manager with ZFS, as it makes it easier, but you can choose to use GRUB and follow guides
on how to configure it.

After installing rEFInd and following the install guide
Create a linux_refind.conf in /boot with the following

 "Boot Artix Linux" "root=ZFS=bootfs rw"

Swap partition

You can create a swap partition inside the ZFS pool:

 zfs create -V {SIZE} zroot/swap
 mkswap /dev/zvol/zroot/swap
 swapon /dev/zvol/zroot/swap

Dataset does not auto mount


Create a zfs init script in /etc/init.d with the following:


command="zfs mount -a" Make the init script execuatable:

 chmod +x /etc/init.d/zfs

Add zfs to default runlevel

 rc-update add zfs default

mkinitcpio hook

We also need to add a ZFS hook to the mkinitcpio.conf
Edit /etc/mkinitcpio.conf and change the hook to look like this:

 HOOKS=(base udev autodetect modconf block keyboard zfs filesystems)

Also add zfs in



 Following the normal installation guide, only add your /boot information, as ZFS does not need to be in it.
 If you created a swap partition add it also to the fstab.


 Currently kmod-27-1 has issue with linux-lts-5.4.20. Downgrade to kmod-26-3

Multiple ZFS partitions

 Only one ZFS partition should be on a single disk, as ZFS auto imports datasets and would cause file conflicts.
 For example, one pool has /usr/bin and another pool's /usr/bin gets imported as well.