Preparation

  1. Disable Secure Boot. ZFS modules can not be loaded if Secure Boot is enabled.

  2. Download a variant of Rocky Linux 8.4 Live ISO and boot from it.

  3. Set root password or /root/authorized_keys.

  4. Start SSH server:

    echo PermitRootLogin yes >> /etc/ssh/sshd_config
    systemctl restart sshd
    
  5. Connect from another computer:

    ssh root@192.168.1.19
    
  6. Temporarily set SELinux to permissive in live environment:

    setenforce 0
    

    SELinux will be enabled on the installed system.

  7. Optional: If mirror speed is slow, you can manually pick a fixed mirror from mirrorlist and apply it:

    sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/*
    sed -i 's|^#baseurl=|baseurl=|g' /etc/yum.repos.d/*
    sed -i 's|dl.rockylinux.org/$contentdir|mirrors.sjtug.sjtu.edu.cn/rocky|g' /etc/yum.repos.d/*
    
  8. Add ZFS repo:

    source /etc/os-release
    RHEL_ZFS_REPO=https://zfsonlinux.org/epel/zfs-release.el${VERSION_ID/./_}.noarch.rpm
    dnf install -y $RHEL_ZFS_REPO
    
  9. Install ZFS packages:

    dnf config-manager --disable zfs
    dnf config-manager --enable zfs-kmod
    dnf install -y epel-release
    dnf install -y zfs
    
  10. Load kernel modules:

    modprobe zfs
    
  11. Install helper script and partition tool:

    rpm -ivh --nodeps https://dl.fedoraproject.org/pub/fedora/linux/releases/34/Everything/x86_64/os/Packages/a/arch-install-scripts-23-3.fc34.noarch.rpm
    dnf install -y gdisk dosfstools
    
  12. Set RHEL version:

    INST_RHEL_VER=8
    
  13. Unique pool suffix. ZFS expects pool names to be unique, therefore it’s recommended to create pools with a unique suffix:

    INST_UUID=$(dd if=/dev/urandom bs=1 count=100 2>/dev/null | tr -dc 'a-z0-9' | cut -c-6)
    
  14. Identify this installation in ZFS filesystem path:

    INST_ID=rhel
    
  15. Target disk

    List available disks with:

    ls /dev/disk/by-id/*
    

    If using virtio as disk bus, use /dev/disk/by-path/*.

    Declare disk array:

    DISK='/dev/disk/by-id/ata-FOO /dev/disk/by-id/nvme-BAR'
    

    For single disk installation, use:

    DISK='/dev/disk/by-id/disk1'
    
  16. Choose a primary disk. This disk will be used for primary EFI partition, default to first disk in the array:

    INST_PRIMARY_DISK=$(echo $DISK | cut -f1 -d\ )
    
  17. Set vdev topology, possible values are:

    • (not set, single disk or striped; no redundancy)

    • mirror

    • raidz1

    • raidz2

    • raidz3

    INST_VDEV=
    

    This will create a single vdev with the topology of your choice. It is also possible to manually create a pool with multiple vdevs, such as:

    zpool create --options \
          poolName \
          mirror sda sdb \
          raidz2 sdc ... \
          raidz3 sde ... \
          spare  sdf ...
    

    Notice the cost of parity when using RAID-Z. See here and here.

    Refer to zpoolconcepts and zpool-create man pages for details.

  18. Set partition size:

    Set ESP size:

    INST_PARTSIZE_ESP=2 # in GB
    

    Set boot pool size. To avoid running out of space while using boot environments, the minimum is 4GB. Adjust the size if you intend to use multiple kernel/distros:

    INST_PARTSIZE_BPOOL=4
    

    Set swap size. It’s recommended to setup a swap partition. If you intend to use hibernation, the minimum should be no less than RAM size. Skip if swap is not needed:

    INST_PARTSIZE_SWAP=8
    

    Root pool size, use all remaining disk space if not set:

    INST_PARTSIZE_RPOOL=