Learn FreeBSD - ZFS Fundamentals (Pool, Dataset & Snapshot)
Episode 8 of 23

Learn FreeBSD - ZFS Fundamentals (Pool, Dataset & Snapshot)

Mastering the foundations of ZFS on FreeBSD: the pool and vdev concepts, creating a pool with zpool create, and datasets and properties such as compression, dedup, and checksum. You will also learn about snapshots, rollback, clones, zfs send/receive for replication, and boot environments with bectl.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

In the previous episode 7, you understood FreeBSD filesystems and how to mount them. Now we get to one of the biggest reasons people choose FreeBSD: ZFS. Combining a volume manager and a filesystem into a single layer, ZFS changes the way you think about data.

ZFS is not just a filesystem — it's a data management system with end-to-end checksums, instant snapshots, built-in compression, and multi-disk pooling. This episode builds the foundation: pools, vdevs, datasets, properties, then snapshots, clones, replication, and boot environments.

ZFS Core Concepts

Pool: The Storage Container

A pool is a collection of storage space from one or more disks managed by ZFS. You create a pool with zpool create:

Membuat pool ZFS bernama tank
zpool create tank /dev/ada1
zpool status

The pool named tank above is the classic example. Pool names are free-form, but choose something descriptive and short.

Vdev: The Storage Unit

Inside a pool, storage is organized into vdevs (virtual devices). The vdev type determines how data is distributed:

  • Stripe — one disk or several without redundancy.
  • Mirror — two or more disks that duplicate each other.
  • RAID-Z — distributed parity (RAID-Z1, RAID-Z2, RAID-Z3).
Membuat pool mirror dengan dua disk
zpool create tank mirror /dev/ada1 /dev/ada2

A mirror is a great starting point for both learning and small-scale production. RAID-Z2 suits large capacities with tolerance for two failed disks.

Warning

The vdev structure can't be changed after the pool is created — vdevs can only be added, never removed or converted to another type. Decide carefully from the start, because adding a vdev to an existing pool does not increase the pool's overall redundancy.

Dataset: The Logical Unit

A dataset is a logical unit inside a pool that can be mounted, given properties, and snapshotted. Datasets are created with zfs create:

Membuat dataset
zfs create tank/data
zfs create tank/data/www
zfs list

Datasets form a hierarchy like directories — tank/data/www is a child of tank/data. Each dataset can have its own properties and snapshots.

ZFS Properties

Properties are parameters that control the behavior of a dataset or pool.

Compression

ZFS compression saves space with minimal overhead:

Mengaktifkan compression
zfs set compression=lz4 tank/data
zfs get compression tank/data

lz4 is the modern choice: fast and efficient. For highly compressible data, zstd (episode 9) offers a better ratio.

Checksum and Dedup

ZFS checksums are on by default and need no activation — every data block is verified on read. Dedup is different: this feature stores a single copy of identical blocks, very space-efficient but memory-hungry:

Melihat checksum dan dedup
zfs get checksum tank
zfs get dedup tank

Info

ZFS dedup works per block, not per file, so the savings are real. However, dedup requires large amounts of memory (DRAM or SSD L2ARC) — for most systems, lz4 compression already delivers nearly the same results with far less risk.

Other Important Properties

Some properties you'll adjust often:

Melihat property umum
zfs get mountpoint,atime,recordsize tank/data

atime=off reduces writes on read access, recordsize controls the block size (covered in episode 18), and mountpoint determines where the dataset is mounted.

Snapshots and Clones

Creating and Viewing Snapshots

A snapshot is an instant image of a dataset at a point in time, without copying data:

Membuat snapshot
zfs snapshot tank/data@before-upgrade
zfs list -t snapshot

Snapshots are the cheapest way to create recovery points. They're created instantly and take almost no space until data changes.

Rollback

To return to a snapshot state:

Mengembalikan dataset ke snapshot
zfs rollback tank/data@before-upgrade

zfs rollback discards all changes made after the snapshot. Snapshots newer than the target are deleted, so use it with care.

Clone

A clone is a new dataset starting from a snapshot, sharing data blocks with its source:

Membuat clone dari snapshot
zfs clone tank/data@before-upgrade tank/dev
zfs list

Clones are very useful for development environments — creating an instant copy without duplicating data.

Replication with zfs send and zfs receive

Snapshots can be sent to another machine for backup or replication:

Mengirim snapshot ke mesin lain
zfs send tank/data@before-upgrade | ssh backup-host zfs receive backup/data

Incremental replication is done by sending only the difference between two snapshots (details in episode 9). This is the foundation of reliable disaster recovery.

Boot Environments with bectl

Boot environments are a feature that makes FreeBSD + ZFS extremely powerful for updates. Every boot environment is a snapshot of the root system that can be booted. If an update fails, you simply boot into the old environment.

Mengelola boot environments
bectl list
bectl create sebelum-update
bectl activate sebelum-update

Success

Before running freebsd-update or a major upgrade, create a boot environment first with bectl create. If something goes wrong, reboot and select the old environment from the boot menu — your system returns to normal without drama.

ZFS Best Practices

A few habits that keep your pool healthy:

  • Enable lz4 compression on all datasets.
  • Create scheduled snapshots for important datasets.
  • Run zpool scrub periodically (episode 9).
  • Monitor pool health with zpool status regularly.
Rutinitas pemantauan ZFS
zpool status
zfs list
bectl list

Closing

In this episode 8, you mastered the foundations of ZFS: pools as containers, vdevs for storage organization, datasets as logical units, properties like compression, checksum, and dedup, plus snapshots, rollback, clones, send/receive replication, and boot environments with bectl.

Key takeaways:

  • Pools are created with zpool create; the vdev structure can't be changed afterward.
  • Datasets are logical units that can be snapshotted and given properties.
  • Enable lz4 compression; avoid dedup unless you understand its memory cost.
  • Snapshots are instant checkpoints; clones share data blocks with their source.
  • zfs send/receive enables replication; bectl manages boot environments.

In the next episode, episode 9, we'll cover ZFS advanced — dataset encryption with AES-256-GCM, pool maintenance with scrub and clear, monitoring, plus incremental replication and tools like sanoid and syncoid for automated backups.