Creating a ZFS Pool on Ubuntu

Andrew Rodriguez
Andrew Rodriguez
  • Updated

Scope:

This document provides information on configuring and managing ZFS pools in Ubuntu. The first portion of the commend goes over creating a ZFS tool and making sure it's running. The second portion provides a set of commands to enable persistence for the created ZFS tool as well as a command to list the existing ZFS pools. 

Downloading the ZFS Package:

sudo apt install zfsutils-linux -y

 

Determine the Target Drives and Select the ZFS Pool Name:

In this instance we will be naming our ZFS pool 'zfspool'. 

export zfspool_name=zfspool

With the selected drives in mind, created the ZFS Tool:

sudo zpool create <pool> <vdev> ... -f

As an example:

sudo zpool create ${zfspool} raidz1 nvme0n1 nvme1n1 nvme2n1 nvme3n1

 

Checking the ZFS Pool's Status:

sudo zpool status ${zfspool_name}

 

Mounting the ZFS Pool:

sudo zfs set mountpoint=/data ${zfspool_name}

 

Enabling Persistence of the ZFS Pool:

sudo zpool set cachefile=/etc/zfs/zpool.cache ${zfspool_name}
sudo systemctl enable --now zfs-import-cache
sudo systemctl enable --now zfs.target
sudo systemctl enable --now zfs-import.target
sudo systemctl enable --now zfs-mount

 

View ZFS Pool Information:

zfs list

 

 

 

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.