How to Install and Setup ZFS on Debian 12

ZFS stands for the Zettabyte File System and was developed for file management in Solaris-based computers. It can be used for volume management and computer file management. 

To ensure data integrity, ZFS uses the checksum mechanism and its own storage pooling known as the zpool. The feature of the zpool is that it supports the combination of multiple physical drives into a single virtual drive. 

ZFS is so well known in the Linux community that its installers have been developed for different Linux distributions including CentOS and Ubuntu. This post will walk you through the installation process of the ZFS on Debian 12 so lets start with its restrictions.

What are the Restrictions of the ZFS on Debian 12?

Some of the key restrictions of the ZFS on Debian 12 are:

  • It supports the maximum size of the single drive to 264 bytes or 16 exbibytes (EB)
  • It limits the zpool size to 2128 bytes or 256 quadrillions zebibytes
  • It allows users to add maximum two storage devices for 264
  • It limits only two zpool creations on the same computer

What is the Installation Method of ZFS on Debian 12?

The installation package of the ZFS comes by default in the repository of Debian 12 and can be installed by following the below-mentioned steps.

Step 1: Update the Packages

Before installing packages on Debian 12, it is recommended to update all the packages to their recent releases. This can be done using the update option of the apt command as shown:

$ sudo apt update && sudo apt upgrade -y

Step 2: Install ZFS Packages on Debian 12

To ensure the smooth operation of the ZFS, first install the dependencies required for it:

$ sudo apt install linux-headers-$(uname -r) linux-image-amd64 kmod -y

Add the repository of the contrib:

$ sudo apt-add-repository contrib

Now install the packages of ZFS on Debian 12 with the execution of the below command:

$ sudo apt install zfsutils-linux -y

Step 3: Import ZFS Modules

After the installation of ZFS, enable its functionalities by loading its Kernel with the command:

$ sudo modprobe zfs

Step 4: Create a ZFS Storage Pool

The ZFS storage pools known as the zpool can be created on a particular drive. To list down the drives, run the command:

$ sudo lsblk

Now create a ZFS storage pool, and follow the below-mentioned general syntax. Write the storage name instead of the pool name where it is supposed to be created:

$ sudo zpool create poolname /dev/sdc

Step 5: Create a ZFS Datasets

To manage the datasets of ZFS, create a ZFS Filesystem using the “create” option of the zfs command. Replace the poolname and filesystem with the actual names while running the command:

$ sudo zfs create poolname/filesystem

Step 6: Change the Owner and the Group

To change the owner with the group of created ZFS Datasets to your username and default group, run the command:

$ sudo chown -Rfv $(whoami):$(whoami) /poolname/filesystem

Step 7: Enable the Data Compression

To manage the volume of the disks, enable the feature of the data compression:

$ sudo zfs set compression=on poolname/filesystem

Step 8: Create a Mirror Pool

If a user wants to create another zpool similar to the first, run the command:

$ sudo zpool create -m mirror poolname mirror /dev/sdX /dev/sdY

Step 9: Set the Size of Datasets

To assign the storage memory size to the ZFS dataset, execute the command:

$ sudo zfs set quota=size poolname/filesystem

Step 10: Integrate the ZFS with Debian 12

To load the ZFS modules at the start of the computer, use the command:

$ sudo echo 'zfs' >> /etc/modules

To confirm the execution of the above command:

$ ls /dev/zfs

How to Remove the ZFS Dataset and Zpool on Debian 12?

To remove the ZFS Datasets on Debian 12, run the command:

$ sudo zfs destroy poolname/filesystem

If users want to remove the entire zpool, then execute the command:

$ sudo zpool destroy pool1

These are the easiest steps for installing and setting up the ZFS on Debian 12. 


To install the ZFS on Debian 12, launch the terminal and execute the command “sudo apt install zfsutils-linux -y”. To set up, follow the explained steps in this post. This post has demonstrated the commands to install and set up the ZFS on the recent release of the Debian known by the name Bookworm.