A snapshot of a ZFS file system or volume is converted into a snapshot stream by using the zfs send command. Then, you can use the snapshot stream to re-create a ZFS file system or volume by using the zfs receive command.
Depending on the zfs send options that were used to create the snapshot stream, different types of stream formats are generated.
Full stream – Consists of all dataset content from the time that the dataset was created up to the specified snapshot.
The default stream generated by the zfs send command is a full stream. It contains one file system or volume, up to and including the specified snapshot. The stream does not contain snapshots other than the snapshot specified on the command line.
Incremental stream – Consists of the differences between one snapshot and another snapshot.
A stream package is a stream type that contains one or more full or incremental streams. Three types of stream packages exist:
Replication stream package – Consists of the specified dataset and its descendents. It includes all intermediate snapshots. If the origin of a cloned dataset is not a descendent of the snapshot specified on the command line, that origin dataset is not included in the stream package. To receive the stream, the origin dataset must exist in the destination storage pool.
Consider the following list of datasets and their origins. Assume that they were created in the order that they appear below.
NAME ORIGIN pool/a - pool/a/1 - pool/a/1@clone - pool/b - pool/b/1 pool/a/1@clone pool/b/1@clone2 - pool/b/2 pool/b/1@clone2 pool/b@pre-send - pool/b/1@pre-send - pool/b/2@pre-send - pool/b@send - pool/b/1@send - pool/b/2@send -
A replication stream package that is created with the following syntax:
# zfs send -R pool/b@send ....
Consists of the following full and incremental streams:
TYPE SNAPSHOT INCREMENTAL FROM full pool/b@pre-send - incr pool/b@send pool/b@pre-send incr pool/b/1@clone2 pool/a/1@clone incr pool/b/1@pre-send pool/b/1@clone2 incr pool/b/1@send pool/b/1@send incr pool/b/2@pre-send pool/b/1@clone2 incr pool/b/2@send pool/b/2@pre-send
In the preceding output, the pool/a/1@clone snapshot is not included in the replication stream package. As such, this replication stream package can only be received in a pool that already has pool/a/1@clone snapshot.
Recursive stream package – Consists of the specified dataset and its descendents. Unlike replication stream packages, intermediate snapshots are not included unless they are the origin of a cloned dataset that is included in the stream. By default, if the origin of a dataset is not a descendent of the snapshot specified on the command line, the behavior is the similar to replication streams. However, a self-contained recursive stream, discussed below, are created in such a way that there are no external dependencies.
A recursive stream package that is created with the following syntax:
# zfs send -r pool/b@send ...
Consists of the following full and incremental streams:
TYPE SNAPSHOT INCREMENTAL FROM full pool/b@send - incr pool/b/1@clone2 pool/a/1@clone incr pool/b/1@send pool/b/1@clone2 incr pool/b/2@send pool/b/1@clone2
In the preceding output, the pool/a/1@clone snapshot is not included in the recursive stream package. As such, this recursive stream package can only be received in a pool that already has pool/a/1@clone snapshot. This behavior is similar to the replication stream package scenario described above.
Self-contained recursive stream package - Is not dependent on any datasets that are not included in the stream package. This recursive stream package is created with the following syntax:
# zfs send -rc pool/b@send ...
Consists of the following full and incremental streams:
TYPE SNAPSHOT INCREMENTAL FROM full pool/b@send - full pool/b/1@clone2 incr pool/b/1@send pool/b/1@clone2 incr pool/b/2@send pool/b/1@clone2
Notice that the self-contained recursive stream has a full stream of the pool/b/1@clone2 snapshot, making it possible receive the pool/b/1 snapshot with no external dependencies.