Install Ubuntu 20.04 with ZFS

ZFS is a file system focused on storage and redundancy. It’s designed with file servers in mind, where high availability and data integrity are absolutely paramount. That’s one reason it’s interesting, but very exciting, to see it natively available on a desktop operating system like Ubuntu. Note that ZFS on Ubuntu is a new feature and therefore still flagged as “experimental.”

The newest iteration of Ubuntu, Ubuntu 20.04 Focal Fossa, offers a new option during installation that hasn’t been present in previous LTS releases. We now have the ability to format drives with the Z File System (ZFS) inside the Ubuntu installation process. Ubuntu itself still uses the ext4 file system, but the rest of your partitions or hard drives can be formatted with ZFS.

In this tutorial, we’ll guide you through installing Ubuntu 20.04 with ZFS as our file system on a few drives. If you already have Ubuntu installed and aren’t yet using ZFS, there’s no need to do a fresh install. We’ll show you how to install ZFS on an already established Ubuntu 20.04 install as well.

In this tutorial you will learn:

  • How to install Ubuntu 20.04 with ZFS (fresh install)
  • How to install ZFS on Ubuntu 20.04

Formatting drives with ZFS on Ubuntu 20.04

Formatting drives with ZFS on Ubuntu 20.04

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed or upgraded Ubuntu 20.04 Focal Fossa
Software ZFS Utilities
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Ubuntu 20.04 Installation

In the following steps, we’ll be doing a fresh install of Ubuntu 20.04. Be sure to download Ubuntu 20.04 if you don’t already have it ready to go.

Our system has four hard drives – a modest configuration compared to most ZFS rigs, actually. We’ll use one hard drive for Ubuntu itself, which must be formatted as ext4. The other three will be formatted with ZFS and can be setup as a storage array when we’re done installing Ubuntu.

Without further ado, let’s get to the installation process:

  1. When the installation environment loads, start things off by clicking “Install Ubuntu.” Of course, you feel free to click on “Try Ubuntu” if you’d like, but you won’t be able to test out ZFS by doing that.
    Click on Install Ubuntu

    Click on Install Ubuntu



  2. Select your keyboard layout and click Continue.
    Select keyboard layout

    Select keyboard layout

  3. For the “Updates and other software” menu, the choices here are up to you. If you’re installing ZFS, I’m guessing you’re creating a storage server and not trying to configure this computer to run desktop applications. If that’s the case, a minimal installation will suit you better. Click Continue once you’ve made your selections.
    Minimal installation is the recommendation for ZFS storage servers

    Minimal installation is the recommendation for ZFS storage servers

  4. On the Installation Type menu, the ZFS option is tucked behind the Advanced Features button. Click on it.
    Click Advanced Features to find the ZFS option

    Click Advanced Features to find the ZFS option

  5. Next, select “Erase disk and use ZFS” and press OK.
    Select ZFS

    Select ZFS

  6. You should see the words “ZFS selected” on the Installation Type menu. Click continue.
    You should see that ZFS has been selected

    You should see that ZFS has been selected

  7. Choose what partition you’d like to install Ubuntu on, then click “Install now.” It’s ideal for the operating system to have its own disk, seperate from the ZFS drives. Notice that the disk will be formatted as ext4 for Ubuntu, while the rest of the drives will be ZFS.
    Ubuntu will be formatted as ext4 but our other drives will be ZFS

    Ubuntu will be formatted as ext4 but our other drives will be ZFS



  8. Confirm writing changes to disk by clicking Continue.
    Confirm the changes for disk formatting

    Confirm the changes for disk formatting

  9. The next couple of menus should be self-explanatory. Select your timezone, hostname, username, etc. as prompted.
  10. Ubuntu will begin installing.
    Ubuntu 20.04 installing

    Ubuntu 20.04 installing

  11. Once Ubuntu finishes installing, you’ll need to reboot your system.
    Reboot your system when Ubuntu has finished installing

    Reboot your system when Ubuntu has finished installing

You can see your ZFS partitions and/or drives available with the fdisk command.

$ sudo fdisk -l
fdisk command shows our hard drives

fdisk command shows our hard drives

There’s a lot of configuration you can do with ZFS. To just scrape the surface and make our drives accessible, we can put them in a zpool with this command:

$ sudo zpool create mypool /dev/sdb /dev/sdc /dev/sdd

Our drives are then mounted automatically and available under the /mypool directory.

Our ZFS pool is mounted and accessible

Our ZFS pool is mounted and accessible



Install ZFS on Ubuntu 20.04

If you installed or upgraded to Ubuntu 20.04 without configuring ZFS during the install, you can still use ZFS. You just need to open a terminal and install the zfsutils-linux package.

$ sudo apt update
$ sudo apt install zfsutils-linux

You can verify that ZFS has been installed with this command:

$ zfs --version
ZFS version

ZFS version

Conclusion

In this guide, we saw how to install ZFS on Ubuntu 20.04, both at time of OS installation and on an already established system. ZFS has been available for some time on Ubuntu, but never natively. Ubuntu 20.04 has made it very easy to get started with ZFS on Linux.