Backup


Aug. 8, 2023

ZFS: working with send/recv

Usage

Basics

The following example aims at illustrating the core concept of zfs send/recv:

  1. Let’s create a dataset via zfs create storage/test-source;
  2. Next, we’ll take a snapshot, since only snapshots of a live filesystem can be sent, not the dataset itself: zfs snap storage/test-source@one;
  3. Now, let’s send this snapshot to a destination dataset: zfs send -v storage/test-source@one | zfs recv -v storage/test-destination; we now have a working independant copy of the dataset on the destination, ain’t this cool?
  4. Say we did some changes, and we wanna back it up! Let’s take a second snapshot: zfs snap storage/test-source@two;
  5. Now, let’s send the increment to the same target: zfs send -v -i storage/test-source@two | zfs recv -v storage/test-destination
  6. And… voilĂ  ! One can list snapshots via zfs list -t snap to check what’s up.

Note: To track the progress of zfs send | zfs recv, one can use a well-known tool, pv, as suggested in the Solaris documentation.