Install/Update ZFS
How to install ZFSonLinux (DKMS) on Arch. Using the Dynamic Kernel Module Support version means the ZFS modules will be rebuilt automatically after every kernel upgrade. See the steps in the Upgrading section if this automatic build fails.
Build environment
Much like the Build Arch Packages guide, we'll need the base-devel group to build the packages required for ZFS.
pacman -S base-devel git
Install
DO NOT PERFORM THESE STEPS AS ROOT. Building packages as root could lead to unforseen consequences.
ZFS utilities package
Start by downloading and building the current version of ZFS utilities.
cd ~/build/ git clone https://aur.archlinux.org/zfs-utils.git cd zfs-utils makepkg -si
This will build and install the latest version of the zfs-utils package.
ZFS packages
Once the ZFS utilities are in place the last bit to install is ZFS itself. Grab the DKMS version.
cd ~/build/ git clone https://aur.archlinux.org/zfs-dkms.git cd zfs-dkms makepkg -si
This will build and install the latest version of the zfs-dkms package. The kernel module will be generated upon install and each time the kernel is updated. Make sure to check for kernel incompatibilities with the zfs-dkms package before updating between major versions of the Linux kernel. If ZFS is incompatible with the latest Arch kernel release, consider installing linux-lts which should be supported.
Upgrading
Minor kernel updates shouldn't require a rebuild of ZFS dkms packages. Pacman will rebuild the module when you upgrade a kernel. In cases where it is required, uninstall the packages first.
sudo pacman -R zfs-utils zfs-dkms
Then upgrade the system
sudo pacman -Syu
Then go through the Install steps listed above before rebooting. ZFS volumes will continue to function properly while the packages are uninstalled until you reboot because the module remains running in memory. Failure to reinstall ZFS before rebooting will render any ZFS volumes inoperable (which could make your system unbootable if your root is ZFS).