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
|Category||Requirements, Conventions or Software Version Used|
|System||Installed or upgraded Ubuntu 20.04 Focal Fossa|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
Ubuntu 20.04 Installation
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:
- 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.
- Select your keyboard layout and click Continue.
- 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.
- On the Installation Type menu, the ZFS option is tucked behind the Advanced Features button. Click on it.
- Next, select "Erase disk and use ZFS" and press OK.
- You should see the words "ZFS selected" on the Installation Type menu. Click continue.
- 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.
- Confirm writing changes to disk by clicking Continue.
- The next couple of menus should be self-explanatory. Select your timezone, hostname, username, etc. as prompted.
- Ubuntu will begin installing.
- Once Ubuntu finishes installing, you'll need to reboot your system.
You can see your ZFS partitions and/or drives available with the
$ sudo fdisk -l
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
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
$ sudo apt update $ sudo apt install zfsutils-linux
You can verify that ZFS has been installed with this command:
$ zfs --version
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.