How to Install ZFS on Ubuntu 22.04?


Zettabyte File System (ZFS) manages the data or you can call it an organizer of your computing machine’s data. While using Ubuntu, you might have seen the word “.ext4”, it is the default filesystem of Ubuntu. Ext4 is stable and provides effective support for routine operations.

However, ZFS takes an edge when dealing with a large amount of data or combining multiple physical devices. ZFS also provides better protection/security for your data. Thus, if large data with data integrity, choose ZFS.

Let’s see how you can install ZFS on Ubuntu 22.04.

How to Install ZFS on Ubuntu 22.04?

Ubuntu 22.04 comes up with a complete package named “zfsutils-linux” that contains all the essential utilities to start using ZFS. To activate/install ZFS on your system, use the below steps:

Update the packages list:

sudo apt update

Install the zfsutils-linux as:

sudo apt install zfsutils-linux

Let’s verify:

zfs --version

Just installing the zfsutils package does not mean you have mapped the ZFS on your system. To make ZFS effective, you must deal with the ZFS storage pools. Let’s proceed with the ZFS Storage Pools:

How to Manage (Create, Deploy, Delete) ZFS Storage Pools on Ubuntu 22.04?

The Z File System basics revolve around its storage pools. ZFS Storage pool, which is just like a container where you have put your HDDs, SDDs, or any storage devices. ZFS storage pool combines all the storage mediums and represents them in ONE.

In Ubuntu or any other system using ZFS, two types of pools are used the most, that is:

  • Striped Pools (RAID 0): All the attached devices work parallelly to process the data. The data is distributed across all the drives. Thus, failure in one drive results in data loss.
  • Mirrored Pool (RAID 1): Complete data is stored on one drive. Thus, there is no chance of a data loss.

Note: We have considered the most used/effective ZFS pools. However, there are other pools as well, i.e., RAIDZ, RAIDZ2, and RAIDZ3.

Create ZFS Storage Pools

As discussed, there are a variety of Zpools that can be managed. Stripped (RAID 0) is the most used, which we will be doing here. Before that, let’s check the disk drives on our system to select the pool:

sudo fdisk l

The “/dev/sdb” and the “/dev/sdc” are the two devices to be used. Now, use the below command to create a ZPool of the specific devices:

sudo zpool create geniepool /dev/sdb /dev/sdc

Let’s Verify:

zpool status

Here’s the “geniepool” with the relevant data. You can also use the “zpool list” command as:

Mirrored Pool

Want to know how you can create the ZFS mirrored pool? Here’s the command’s syntax:

sudo zpool create <Pool-Name> mirror <dev1> <dev2>

Change/Set the Mount Point of the ZFS Pools

A mount point refers to the disk where it is located and accessible on the system. Initially, a default mount point is set in the root directory with the exact name of the pool. To check the mount point of all the storage locations, use the “df” command:

df

Here, the “geniepool” is mounted with the same name inside the root directory. Let’s change its mount point to “~/genie”. To do so, use the below “set mountpoint” command:

sudo zfs set mountpoint=<New-Mount-Address> <ZPool-Name>

The new mount point is set and verified as well.

Manage the Permissions of the ZFS Pools

By default, the Zpool is mounted inside the root directory. Thus, the root is the owner of that file and the user might not be able to properly manage the normal user may not be able to access and modify/manage it.

To counter that, you may change the ownership of the Zpool with the chown command:

sudo chown -R USER:GROUP <Mount-Point>

Remove/Deattach the ZFS Pools

If you are no longer using it and also do not want to keep it, then you can destroy the Zpool as follows:

sudo zpool destroy <ZFS-Pool-Name>

That’s how you can manage the ZFS/ZFS pools.

How to Uninstall/Remove ZFS From Ubuntu 22.04?

Zfsutils package is necessary to manage the storage pools. Thus, if you have the pools, you must keep them to manage them. However, removing zfsutils won’t remove the pools or affect them. The removal might be useful when you do not want anyone to manage/make changes in those pools from the back end.

To remove zfsutils, you can use the command:

sudo apt autoremove zfsutils-linux

.

Note: If you want to remove all the pools and management utilities as well, then destroy the pools first and then remove zfsutils-linux.

Bottom Line

ZFS is a filesystem developed for Solaris-inspired systems. However, you can get its support on Ubuntu 22.04. If you have to deal with large data with efficient speed and organized space, ZFS is the best choice above Ubuntu’s default filesystem. You can even join/combine multiple types of storage devices to make them one.

Today’s post has listed the method to get the ZFS utilities on Ubuntu 22.04 and the basics of managing the ZFS pools.

Print Friendly, PDF & Email
Categories