How to Install ZFS on Ubuntu Linux 17.04

ZFS install ubuntu 17-04The ZFS file system was officially supported in Ubuntu 16.04 and earlier we have shown how to install on centos 7. Though it's not installed and enabled by default it's available in Ubuntu's repositories.

ZFZ is an advanced file system and logical volume manager originally created by Sun Microsystems for Solaris. The file system is designed for larger servers and to provide protection against data loss. Every file is checksummed to ensure that it's not been corrupted. It can also manage zettabytes of data - hence the name "Z". ZFS also allows you to pool multiple drives into a single pool to create a software RAID with no special hardware. Additional features include compression, volume management, snapshots, cache and much more.

In this article, we'll install ZFS on Ubuntu 17.04 and learn how to use its features.

Installing ZFS

To install ZFS on Ubuntu 17.04, enter the following command.

# apt install zfsutils

ZFS Terminology

ZFS Virtual Device (VDEV): A virtual device is a collection of physical disks, partitions, images, or ZFS software rain devices.

ZFS Pool: A Zpool is a storage made of a collection of VDEVs. You can combine multiple disks, images to create a pool.


Below are the steps in creating a pool and making configurations using ZFS. In these examples, pool-1 represents the name of the pool you want to use or modify.

Creating or Modifying ZFS Pools

RAID-0 Configuration

In this example, a pool named pool-1 is created from tw0 physical drives.

# zpool create pool-1 /dev/sda5 /dev/sda3

or you can create a mirror pool using the following command.

# zpool create pool-1 mirror /dev/sd5 /dev/sd3

RAID-1 Configuration

# zpool create pool-1 /dev/sda /dev/sdb

Adding another disk to pool

# zpool add pool-1 /dev/sda5 /dev/sda2

add the mirror option to add VDEVs in a mirror.

# zpool add pool-1 mirror /dev/sda5 /dev/sda2

You can create various types of RAIDS like raidz, raidz2, raidz3 and nested raids by adding the corresponding names before specifying the volumes.

Single File-based pool

You can have file as a vdev and make it into a pool.

# zpool create pool-test /home/user/pool-1.img

Checking Pool Status

# zpool status

If you created a pool named pool-1, you can access it at /pool-1/

Destroying Pool

# zpool destroy pool-1

Checking Pool Size and usage

# zpool list

# df

Taking ZFS Snapshots

A ZFS snapshot is a read-only copy of the ZFS file system which saves the current state of the file system and one can be rolled back to at a later time.

# zfs snapshot [email protected]

You can see your snapshots by typing:

# zfs list -t snapshot

To roll back to a specific snapshot:

# zfs rollback mypool/[email protected]

You can delete a snapshot by entering the command

# zfs destroy mypool/[email protected]

If you try to list the snapshots, you'll get the message "no datasets available".

ZFS Clones

Clones are writable copies of ZFS snapshots. A clone can only be created from a snapshot and the snapshot cannot be deleted until all the clones are delivered. To clone a pool, first take a snapshot and then clone it. In this example, we'll clone [email protected] and clone it to pool-1/clone.

# zfs snapshot -r [email protected]
# zfs clone [email protected] pool-1/clone

Pool Scrubbing

You can initiate a data integrity check on a pool using the scrub option. For example, to scrub 'pool-1':

# zpool scrub pool-1

View I/O Stats for Pools

# zpool iostat

ZFS looks definitely fun to work with and lets you play around with multiple file systems using RAID. You can read more from the documentation from Ubuntu's Reference Page.

About Eyram Amedzor

Kwaku Eyram has been a working with computers and software for more than 10 years. He's an all-round geek and very fluid with Linux, Android and Windows operating systems. Asides being a tech enthusiast, Kwaku doubles as a tech support personnel and a tech writer. He currently has interest in IoT, web development and information security.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.