Skip to content

Install ZFS

So you already installed the system on eMMC or SD? You might want to use ZFS on the hard disk(s)! We assume rootfs is already on eMMC (or microSD Card) and you want to store your data on HDDs in ZFS pool.

Note

This wiki does not cover root-on-zfs. (Although it should be also possible.)

Note

If this method fails you can try to build directly ZFS on your system with the following instructions.

Step 1 - Install ZFS

sudo armbian-config

Go to Software and install headers.

Kernel Headers

Once kernel headers installed, install ZFS with the following command:

sudo apt install zfs-dkms zfsutils-linux

Optional:

sudo apt install zfs-auto-snapshot

Reboot.

Step 2 - Prepare partitions

Use fdisk of gdisk to create necessary partitions on your hard drive. This is beyond scope of this wiki. When ready look for assigned uuids:

ls -l /dev/disk/by-partuuid/

Step 3 - Create ZFS pool

sudo zpool create -o ashift=12 -m /mypool mypool mirror /dev/disk/by-partuuid/abc123 /dev/disk/by-partuuid/xyz789
sudo zfs set atime=off mypool
sudo zfs set compression=on mypool

Of course you may use more disks and create raidz instead of mirror. Your choice. :-)

Note: Do not use /dev/sdXY names. Use uuids only. This way your system will still work when you remove a disk or change order of disks.

If your disks are SSDs, enable trim support:

sudo zpool set autotrim=on mypool

Step 4 - Reboot

After reboot make sure the pool was imported automatically:

zpool status

You should now have working system with root on eMMC and ZFS pool on HDD.


Page contributed by michabbs

Reference Armbian Forum Dicussion


Last update: February 26, 2021

Comments