Install ZFS Filesystem on Ubuntu 22.04

ZFS is an advanced-level file system to create storage pools that can store and manage the data. The management of data indicates that ZFS is not a filesystem but a volume manager as well. ZFS(Zettabyte File System) was initially launched with Sun Microsystems, and later it was a part of the Linux distributions and the macOS. But now, it is only being used with some of the Linux distributions and some Unix operating systems.

In this blog, we will explain how to install the ZFS filesystem on Ubuntu 22.04. Before that, we want to shed some light on the distinctive features of the ZFS filesystem:

  • It is designed to store a huge amount of data without any loss.
  • It can store multiple copies of data and metadata, which will help recover the data.
  • Allows the automatic rollback of the data.
  • Most internal parameters can be customized according to the user’s ease.

Let’s start the installation method:

How to install the ZFS Filesystem on Ubuntu?

ZFS utilities are supported by the default repository of Ubuntu 22.04. To get it, we will be using the command line interface. Firstly, open the terminal using the shortcut key “CTRL+ALT+T” and use the below-mentioned command to get ZFS and all its supportive packages:

$ sudo apt install zfsutils-linux -y

When the installation is completed, verify it by checking the version as follows:

$ zfs --version

How to Create the ZFS storage Pools on Ubuntu?

To deal with the huge amount of data, it creates the storage pool in which data is stored and managed. Moreover, these pools are known as zpools and the ZFS storage pools. We will first display all the attached storage devices so that we can choose the drive to make a ZFS storage pool. To display the list of storage devices, use the command:

$ sudo fdisk –l

Note down the name of the drive to which you want to make a zpool. Before making them zpool, let’s look at the types of zpools:

  • Stripped: All the data is stored in the form of strips in a storage device.
  • Mirror: The copy of replicas of the stored data in the specified storage device.

If you want to create a stripped zpool then you have to follow the syntax:

$ sudo zpool create <pool_name> <drive1> <drive2>

Just replace the “<pool_name>” with any good name and type the name of the drive(s) which you want to make the zpool.

Similarly, use the following syntax to create a mirror zpool:

$ sudo zpool create <pool_name> mirror <drive1> <drive2>

Now, use the command mentioned below to find the location of the “itsfoss_device”:

$ df -h

To list down the zpool devices, we will use the command:

$ zpool list

Similarly, to find out the status of the zpools, run the command:

$ zfs status

How to delete the ZFS pools

If you want to delete the storage device of the zpool, use the command whose general syntax will be:

$ sudo zpool destroy pool_name

Replace the “pool_name” with the actual name of the zpool to delete that specific pool.

That’s all from this guide!

Conclusion

The ZFS Filesystem is used in the Linux and Unix-based operating systems and is used to combine a file system with a volume manager. The ZFS filesystem and all its utilities can be installed on Ubuntu 22.04 using the command “sudo apt install zfsutils-linux -y”. This post has demonstrated the method to install the ZFS filesystem on Ubuntu. Alongside this, you have learned to create or delete the ZFS pools.