Skip to content

Lesson 4 of 9 · 28m

ZFS as an Operating Discipline

Treat datasets, snapshots, properties, and send/receive as operational controls rather than merely a filesystem with impressive features.

ZFS rewards operators who think in datasets and punishes those who treat it as a magic volume. Its power is not checksums alone; it is the ability to make storage intent explicit: which data compresses, which replicates, which survives deletion, which can be rolled back, and which must never share failure semantics. On FreeBSD, ZFS is not an add-on. It is part of how serious systems are built.

Datasets are policy boundaries

A pool is a storage resource; datasets are administrative boundaries. Create them where operational policy changes:

zpool create tank mirror da0 da1
zfs create -o compression=lz4 -o atime=off tank/app
zfs create -o compression=off -o recordsize=16K tank/postgres
zfs create -o quota=100G tank/customer-assets

Compression, recordsize, quotas, reservations, mountpoints, encryption, and snapshot retention are dataset decisions. One giant dataset forces unrelated workloads to share policy they should not share.

Snapshots are cheap, recovery is not automatic

Snapshots are point-in-time dataset references:

zfs snapshot tank/app@before-upgrade
zfs list -t snapshot
zfs rollback tank/app@before-upgrade

A snapshot protects against logical deletion and bad writes, not hardware loss, pool destruction, or administrative stupidity aimed at the wrong host. Replication is separate:

zfs send tank/app@before-upgrade | ssh backup.example.net   zfs receive backup/app

Use incremental send streams for routine replication, and test receive-side restoration. The fastest backup is the one that has actually been restored recently.

Know your vdev shape before capacity math

Mirrors, RAIDZ, striped vdevs, and special vdevs have different failure and expansion behavior. ZFS historically grows by adding vdevs, not casually reshaping existing ones. A pool made from mismatched devices can be technically valid and operationally regrettable. Check topology and health constantly:

zpool status -x
zpool iostat -v 5
zpool scrub tank

A scrub is not a backup and not a performance test. It verifies checksums and repairs redundancy where possible. Schedule scrubs, but do not confuse a clean scrub with proof that a controller, cable, or power supply is healthy.

ZFS interaction with databases and services

Databases already cache and write carefully. PostgreSQL, MySQL, and other write-ahead systems often benefit from tuned recordsize, appropriate compression, and intentional sync behavior. Never disable sync on production data because benchmarks look faster; you are trading corruption visibility for throughput. If a workload demands different semantics, isolate it in a dataset and document the trade.

ARC is memory, not a leak

The Adaptive Replacement Cache uses available memory aggressively. Seeing most RAM consumed by ARC is normal if it is released under pressure. Watch arc_summary or relevant sysctl values before concluding memory exhaustion. The failure mode is workload plus ARC pressure on undersized hosts, not the existence of cache itself.

Field notes

  • Set atime=off on most service datasets unless you genuinely use access-time metadata.
  • Snapshot names should encode operational meaning, not only timestamps, when tied to upgrades.
  • zfs destroy is fast and unforgiving; automate it only after input validation and host verification.
  • Replication without restore testing is a copy command, not a disaster recovery plan.

Was this lesson helpful?

Sign in to rate