ZFS - The Operator's Storage System

ZFS Send & Receive Overview

ops-tactics

You've already read a bit about ZFS and FreeBSD.
ZFS is an impressive topic that can be divided into multiple articles.

In this piece you will learn about send and receive.

You can stream snapshots to other disks, or over the network to other machines.
Then you can send only the differences of snapshots.

In the example you will use:

Local ZFS dataset: zroot/jails/machines/db
Local snapshot:    zroot/jails/machines/db@before-migrate
Remote machine:    10.10.0.9
Remote user:       root
SSH connection:    key-only

The objective is to migrate a PostgreSQL database jail to another machine.

Later in the article there is an alternative scenario where you incrementally replicate the primary server with ZFS.

Preparation

The action plan:

  1. Create an SQL dump with pg_dump.
  2. Validate the dump file.
  3. Stop the database.
  4. Create a ZFS snapshot of the database jail.
  5. Set up key-based authentication for the remote root user.
  6. Send the ZFS snapshot to the remote machine.

Plan Execution

Log in to the database jail.
Create a database dump of your data.
Validate the dump on a test database server.
Stop the PostgreSQL service.

Take a snapshot of the database server jail:

zfs snapshot -r zroot/jails/machines/db@before-migrate

Now send it over the network:

zfs send -R zroot/jails/machines/db@before-migrate |
    ssh root@10.10.0.9 \
    'zfs receive -u zroot/jails/machines/db-new'

The dataset will arrive on the new machine over the network.

Configure the received dataset and jail on the new machine before starting it.

Incremental Changes

This is a different scenario.

If you want to keep the second machine in sync with the main database server, send incremental changes.

Create a new snapshot on the primary database server:

zfs snapshot -r zroot/jails/machines/db@2026-10-26

Send only the difference:

zfs send -R -i \
    zroot/jails/machines/db@before-migrate \
    zroot/jails/machines/db@2026-10-26 |
    ssh root@10.10.0.9 \
    'zfs receive -u zroot/jails/machines/db-new'

Final Whisper

ZFS is mature.
It's stable.

Compression, snapshots and integrity checks are not the only features.
With streaming datasets you can improve data security.