ZFS Dataset Structure

After a lot of experimenting, as of August 2nd 2017 I was using the following filesystem heirarchy for my ZFS datasets during system setup when using Arch.

Dataset Structure

I'll use a few variables to represent different locations in the pool for datasets.

  • SYS_ROOT=vault/sys - The location of any systems on the pool.

  • DATA_ROOT=vault/data - System shared data.

Boot Environments

For boot environments I use the following configuration. SYSTEM_NAME can be anything, I use the hostname.

For example, my current boot environment which will be mounted to /:

In this configuration it makes it easy to dual boot multiple systems off of a single ZFS pool. To create a new system just add a new dataset under vault/sys, and set it up as normal. This should even work dual booting Linux and FreeBSD.


While only a dataset for / really needs creating, I create quite a few. This lets me backup and snapshot only datasets I find important.

Setup datasets. Set all besides / legacy, or use zfs management. I like using legacy for multi system setups using a shared pool, and zfs for single install systems.

Boot environment Dataset

The boot environment will be mounted to / and store everything that doesnt have it's own mounted dataset.

canmount=off Datasets

Set /var, /var/lib and /usr to canmount=off meaning they're not mounted and are only there to create the directory structure. This will put their data in the boot environment dataset.' Their properties will be inherited.

Regular Datasets

The other datasets will be independent from the boot environment and will not change between boot environments.

System Datasets

I keep some datasets like /var/cache's' dataset seperate to avoid having to snapshot and backup their data. I also keep /var/log 's' dataset seperate so the logs are always available as well as the datasets for my containers and VMs.

Turn on posixacls for systemd-journald's /var/log/journal dataset.

User Datasets

I create extensive user datasets, outside the boot environment.

As of zfsonlinux 0.7.0 ZFS delegation using zfs allow works on linux. I delegate all datasets under ${SYS_ROOT}/${SYSTEM_NAME}/home/john to my user 'john' giving the abiity to snapshot and create datasets.

Checking permissions shows john's permissions.

Available options:

Data Datasets

I'll be mounting these under ${HOME}. They exist outside the different systems and are shared between them.

Final Structure

So my system ends up as.

Install Preperation

Using this structure datasets must be mounted in the correct order.

ZFS Setup

Import zpool and mount root dataset:

After dataset creation, create cachefile.

Mount system datasets:

Mount home.

Mount data:

Boot Setup

Create esp, (EF00) for regular install.

I keep it at /mnt/efi instead, and bindmount kernel directory to /boot.


Create 32GiB partition and create swap.

fstab Configuration

Create fstab, adding all currently mounted filesystems.

Get swap UUID and add to fstab.

Now all partitions and datasets should be setup, check that the fstab looks correct.

Last updated