ZFS

Some notes on the ZFS file system and its usage. A more complete reference is available on the Ubuntu wiki.

Overview

ZFS, the "last word in file systems", is a file system with support for volume management, pooling, RAID support, and backup and snapshot capabilities.

Installation

The OpenZFS project is licensed under the CDDL, a GPL-incompatible license. This means that ZFS support cannot be included within the Linux kernel due to licensing issues. Some Linux distros, such as Ubuntu, have included it as part of their installations regardless. My distro of choice, Arch Linux, is not so lucky, going so far as to not offer the ZFS packages in their repositories. Note: I tried to ask as to why this is the case, as plenty of proprietary-licensed packages are included. I didn't get a good answer, but it seems the honest answer is no one wants to deal with keeping it up to date. There are two "simple" methods to install it. The first is to use the AUR packages, namely the zfs-dkms and zfs-utils packages, allowing us to avoid being pegged to specific kernel versions. This works well enough, but I like to keep my AUR packages support separate from my main repositories. There is a archzfs unofficial repository which carries nearly the same packages. I have elected to use that instead, for better support with pacman.

Common Commands

Creating a file system

The ZFS interface deals with "file systems" as its main unit, for example when creating snapshots, they are done at the file system level. These ZFS file systems correspond to actual directories on the device.

Snapshots

Snapshots of a file system can be used to save the state of that system at a point in time. They can be rolled back to if desired.

If you wish to access data contained in a snapshot, there is also a secret .zfs in the root of each ZFS file system. It does not show up when running ls -a, but it is possible to cd into, navigate around, and copy out some data manually if needed.

Scrub

To perform data integrity checks, you perform a "scrub". This is done on the entire ZFS pool, rather than on individual file systems.

Compression

Popular data compression algorithms are automatically handled by ZFS. These can be at the file system level or, perhaps more ideally, at the pool level.