ZFS Basics on FreeBSD
ZFS is a combined file system and logical volume manager designed for data integrity, high storage capacity, and excellent performance.
Key Concepts
Pools
A pool is a collection of storage devices. ZFS manages pools rather than individual disks.
# Create a simple pool
zpool create mypool /dev/da0
# Create a mirrored pool
zpool create mypool mirror /dev/da0 /dev/da1
# Check pool status
zpool status mypool
Datasets
Datasets are the ZFS equivalent of directories or partitions, but with their own properties.
# Create a dataset
zfs create mypool/data
# Set properties
zfs set compression=lz4 mypool/data
zfs set quota=50G mypool/data
Snapshots
Snapshots capture a dataset's state at a point in time - instantly and without duplicating data.
# Create a snapshot
zfs snapshot mypool/data@backup-2026-01-02
# List snapshots
zfs list -t snapshot
# Rollback to snapshot
zfs rollback mypool/data@backup-2026-01-02
Best Practices
- Always use mirrors or raidz for redundancy
- Enable compression - lz4 is fast with minimal CPU overhead
- Regular scrubs - schedule monthly integrity checks
- Snapshot before changes - easy recovery from mistakes