Goal

This article aims to let the reader know how to install ZOL (OpenZFS on Linux) on Ubuntu Linux

Prerequisite

  1. A running Ubuntu Linux server (22.04 or higher is recommended.)
  2. Except for the system disk, at least three empty disks are needed.

Tutorial

  1. Install required packages

    sudo apt update
    sudo apt install zfsutils-linux
    
  2. Check the target disks, we will use disk sdb, sdc and sdd for the zfs pool.

    lsblk
    .....
    /dev/sdb   8:0    0 10G  1 disk
    /dev/sdc   8:0    0 10G  1 disk
    /dev/sdd   8:0    0 10G  1 disk
    .....
    
  3. Create zfs pool

    sudo zpool create $zfs_pool_name sdb
    

    Use raidz if you need to create a mirrored RAID-Z pool. (Need at least two disks to create such pool.)

    sudo zpool create $zfs_pool_name raidz sdb sdc
    

    Use raidz2 if you need to create a double-parity RAID-Z pool. (Need at least four disks to create such pool.)

    sudo zpool create $zfs_pool_name raidz2 sdb sdc sdd sde
    
  4. Check zpool status

    zpool status
    
  5. Create ZFS dataset

    sudo zfs create $zfs_pool_name/$dataset_name
    
  6. Check zfs dataset status

    zfs list
    # For more details
    zfs list -r $zfs_pool_name/$dataset_name
    zfs get all $zfs_pool_name/$dataset_name
    
  7. Set up nfs server for k8s storage class to use

    sudo apt-get install -y nfs-kernel-server
    sudo systemctl enable --now nfs-kernel-server.service
    
  8. Done! You have setup the zfs server successfully on Ubuntu Linux! Refer to [Appendix] Set up democratic-csi for TrueNAS or ZOL storage for how to setup k8s storage class for your k8s cluster.

Reference

https://zfsonlinux.org/

https://openzfs.github.io/openzfs-docs/Getting Started/Ubuntu/index.html

https://docs.oracle.com/cd/E19253-01/819-5461/gaynr/index.html

https://docs.oracle.com/cd/E19120-01/open.solaris/817-2271/gcvjg/index.html

https://serverfault.com/a/562568