Where and How ZFS Mount Points and Settings Are Stored in FreeBSD


2 views

Unlike traditional Unix filesystems that rely on /etc/fstab, ZFS manages its mount points and properties internally through its own database. In FreeBSD 10.0 and later versions, this information is stored within the ZFS pool itself, making it persistent across reboots.

All ZFS configuration is stored as properties of datasets. You can inspect these properties using:

zfs get all zpool0/ROOT/default

Key properties related to mounting include:

zfs get mountpoint,canmount,atime,devices,exec,readonly zpool0/ROOT/default

The mount information you see with zfs mount comes from these stored properties. For example:

zfs get -H -o value mountpoint zpool0/home
# Returns: /home

The actual configuration is stored in:

  • The ZFS pool's internal metadata (MOS - Meta Object Set)
  • Disk labels (for pool identification)
  • ZFS transaction groups (for recent changes)

When you modify mount points:

zfs set mountpoint=/new/location zpool0/data

The change is:

  1. Written to the ZFS intent log (ZIL)
  2. Committed to disk in the next transaction group
  3. Stored permanently in the pool's metadata

FreeBSD's /etc/rc.d/zfs script handles mounting during boot by:

# Relevant excerpt from FreeBSD's zfs rc script
zfs mount -a -O

The -a flag mounts all mountable datasets, while -O allows mounting of legacy mount points.

Feature ZFS Traditional (UFS/ext4)
Mount info storage Pool metadata /etc/fstab
Live modification Immediate Requires remount
Persistent across boots Yes Yes

For advanced users, you can examine raw ZFS data structures (CAUTION: read-only recommended):

# View pool metadata location
zdb -C zpool0 | grep -A10 "MOS Configuration"

# Dump specific object
zdb -dddd zpool0 0

If mountpoint information becomes corrupted, you can:

# Reset to default mountpoint
zfs inherit mountpoint zpool0/home

# Or specify manually
zfs set mountpoint=/home zpool0/home

Control boot-time mounting with:

# Disable automatic mounting
zfs set canmount=noauto zpool0/backup

# Mount manually later
zfs mount zpool0/backup

In FreeBSD 10.0 and later versions, ZFS manages its mount points and configurations differently from traditional UNIX filesystems. Unlike ext4 or UFS that rely on /etc/fstab, ZFS maintains this information within its own internal database.

All ZFS configuration is stored as properties of datasets (filesystems, volumes, or snapshots). The key properties controlling mount behavior are:

# View all properties for a dataset
zfs get all zpool0/usr/local

# Specifically check mount-related properties
zfs get mountpoint,canmount,atime,devices zpool0/var/log

The configuration is maintained in:

  • The ZFS pool's internal metadata (on disk)
  • In-memory copy maintained by the ZFS kernel module

You can export the current configuration to a file for backup:

zfs list -o name,mountpoint,canmount,atime > /root/zfs_mount_config.txt

ZFS automatically persists these settings. During system boot:

  1. The ZFS driver reads pool metadata
  2. Mounts filesystems according to their properties
  3. No traditional init scripts or fstab entries needed

To change mount points permanently:

# Set a new mountpoint
zfs set mountpoint=/new/location zpool0/usr/src

# Temporarily change mount (won't persist)
zfs mount -o remount,atime=off zpool0/var/db

Create a new dataset with specific mount properties:

zfs create -o mountpoint=/opt/custom \
           -o atime=off \
           -o compression=lz4 \
           zpool0/custom_app

To make a filesystem not automatically mount:

zfs set canmount=noauto zpool0/backup

If mounts aren't working as expected:

# Check kernel messages
dmesg | grep zfs

# Verbose mount information
zfs mount -v

# List all properties affecting mounts
zfs get all | grep -E 'mountpoint|canmount'