This article will show how to compile ZFS on Linux 0.8.2 on Ubuntu 18.04 on ARM64, specifically the FriendlyElec NanoPi M4 single board computer, which has a four-port SATA HAT available. It also works great on other single-board computers, and I’ve successfully compiled and used ZFS on the Raspberry Pi.

These instructions will likely work on other architectures supported by ZFS on Linux, such as x86_64.

Install ZFS build requirements

Use apt to install the packages needed to build ZFS 0.8.2 from source:

$ sudo apt install -y \
  alien \
  autoconf \
  automake \
  build-essential \
  dkms \
  fakeroot \
  gawk \
  gdebi-core \
  libacl1-dev \
  libaio-dev \
  libattr1-dev \
  libblkid-dev \
  libdevmapper-dev \
  libelf-dev \
  libselinux-dev \
  libssl-dev \
  libtool \
  libudev-dev \
  nfs-kernel-server \
  python3 \
  python3-dev \
  python3-cffi \
  python3-setuptools \
  uuid-dev \

Install Linux kernel headers

This step actually depends on what board and what distribution you are running. In this example, the package for the Linux kernel headers is called linux-headers-rk3399. The rk3399 references the CPU used by the FriendlyElec NanoPi M4 (Rockchip RK3399).

I’ll provide a generic command that should work on most boards and distributions, but please consult your board and distribution documentation for the specific package name.


$ sudo apt install -y linux-headers-$(uname -r)

FriendlyElec NanoPi M4:

$ sudo apt install -y linux-headers-rk3399

Get ZFS 0.8.2 source code

Go to the directory where you want to store the ZFS source code, download it from GitHub and unpack the source code archive:

$ cd ~ # for example
$ curl -O
$ tar xfvz zfs-0.8.2.tar.gz

Build ZFS 0.8.2 source code

Configure the source code and build the Debian (.deb) packages:

$ cd zfs-0.8.2
$ ./
$ ./configure
$ make
$ make deb-utils
$ make deb-dkms

Install ZFS 0.8.2 packages

Install all the packages built by the commands above:

$ for file in *.deb; do sudo gdebi -q --non-interactive $file; done

Enable and start ZFS 0.8.2 services

ZFS uses a bunch of services. Enable and start them as follows:

$ sudo systemctl enable --now zfs-import-cache.service
$ sudo systemctl enable --now zfs-import-scan.service
$ sudo systemctl enable --now
$ sudo systemctl enable --now zfs-mount.service
$ sudo systemctl enable --now zfs-share.service
$ sudo systemctl enable --now zfs-zed.service
$ sudo systemctl enable --now

Done! ZFS is built from source code and is running. Now you can either create a new zpool or import an existing one.

Create a new zpool with and without native encrypt

The following creates a zpool with encryption (aes-256-gcm algorithm with a passphrase), compression (lz4), and various recommended settings. The zpool (tank) will be configured in RAID-Z1 (allowing one disk to fail without data loss) and made up of three vdevs (in this case, three regular disks, sda, sdb and sdc):

$ sudo zpool create -o ashift=12 \
  -O acltype=posixacl \
  -O compression=lz4 \
  -O dnodesize=auto \
  -O normalization=formD \
  -O relatime=on \
  -O xattr=sa \
  -O encryption=aes-256-gcm \
  -O keylocation=prompt \
  -O keyformat=passphrase \
  tank raidz sda sdb sdc

Without encryption is similar, but without the encryption, keylocation, and keyformat options:

$ sudo zpool create -o ashift=12 \
  -O acltype=posixacl \
  -O compression=lz4 \
  -O dnodesize=auto \
  -O normalization=formD \
  -O relatime=on \
  -O xattr=sa \
  tank raidz sda sdb sdc

Import an existing zpool

Simply run (where tank is the zpool name):

$ sudo zpool import tank

Please let me know if you have any issues, and I’ll update the article! Good luck with ZFS on your ARM64 system.


2023-08-31 Revised language