zstreamdump.8
| ZSTREAM(8) | System Manager's Manual | ZSTREAM(8) |
NAME
zstream —
manipulate ZFS send streams
SYNOPSIS
zstream |
decompress [-v]
[object,offset[,compress_type]…]
[file] |
zstream |
drop_records [-v]
[object,offset…]
[file] |
zstream |
dump [-Cvd]
[file] |
zstream |
raw [-v]
[-b max_buffers]
[-g fromguid]
image|device
[file] |
zstream |
recompress [-t
num_threads] compress_type
[file] |
zstream |
redup [-v]
file |
zstream |
token resume_token |
DESCRIPTION
zstream performs various operations on
send streams created by the zfs
send command. Aside from the
token subcommand, which takes a resume token rather
than a stream, every subcommand reads a send stream either from the
file named as its last argument or, when no
file is given, from standard input. The
redup subcommand requires a
file; it rereads earlier parts of the stream to
resolve deduplicated records, so it cannot accept input from a pipe.
zstreamdecompress[-v] [object,offset[,compress_type]…] [file]- Decompresses specified records within a send stream. This subcommand can
be used to recover data when the compression type recorded in the ZFS
metadata is incorrect. Specify the object number and byte offset of each
record to be decompressed. Optionally, specify the (true)
compress_type. The
compress_type can be any value accepted by the
compression property except on, such
as off,
gzip,
lz4,
lzjb,
zstd, or
zle. A
compression level (e.g., gzip-3
or zstd-5) is accepted but
ignored; only the algorithm matters when decompressing. If no
compress_type is given, the compression type
recorded in the record's own metadata is used.
Every record for that object beginning at that offset is decompressed, if possible. It may not be possible, because a record can be corrupt in some of the stream's snapshots but not in others.
Specifying a compression type of off changes the stream's metadata accordingly, without attempting decompression. This can be useful if the record is already uncompressed but the metadata insists otherwise.
The repaired stream is written to standard output.
-v- Verbose. Prints a summary of decompressed records.
zstreamdrop_records[-v] [object,offset…] [file]- Removes selected records, specified by object number and byte offset, from
a send stream read from the specified file or from
standard input. Currently, only WRITE and WRITE_EMBEDDED records can be
dropped. The repaired stream is written to standard output.
-v- Verbose. Prints a summary of dropped records.
zstreamdump[-Cvd] [file]- Prints information about the specified send stream, including headers and
record counts. The stream is read from either the specified
file or standard input.
-C- Suppresses the validation of checksums.
-v- Verbose. Prints metadata for each record. This option can be repeated to also print record checksums.
-d- Dumps the data contained in each record as well as checksums. Implies verbose.
The
zstreamdumpalias is provided for compatibility and is equivalent to runningzstreamdump. zstreamraw[-v] [-bmax_buffers] [-gfromguid] image|device [file]- Applies a zvol send stream, read from the specified
file or from standard input, to a raw image or block
device. By default, at most 32
SPA_MAXBLOCKSIZEbuffers can be written at a time. With max_buffers set to some value between 1 andIOV_MAX, contiguous write records are combined into one write operation using up to this many buffers, at the cost of additional memory use. When a fromguid is provided, the initial fromguid of the stream is checked to ensure that it matches the given value. The final toguid of the stream is printed to standard output on completion. With the-voption, details of the records in the stream are printed in similar fashion tozstreamdump. zstreamrecompress[-tnum_threads] compress_type [file]- Recompresses a send stream, read from the specified
file or from standard input, using the specified
compress_type, and writes the modified stream to
standard output. All WRITE records in the send stream are compressed
unless compression fails to reduce their size compared to leaving them
uncompressed. The compress_type can be any value
accepted by the compression property except
on, including those that name a compression level, such
as gzip-3 or zstd-5. A
compress_type of off decompresses
every record and leaves the stream uncompressed. Note that encrypted send
streams cannot be recompressed.
-tnum_threads- Specifies the number of compression worker threads. By default,
zstreamrecompresscreates a thread for every CPU core. It is generally unproductive to raise num_threads above this default. On some architectures, contention for resources such as memory caches can reduce efficiency when many threads are active. On those systems, it may be helpful to run with fewer threads, particularly when automating operations on shared servers. -llevel- This option is deprecated. It formerly specified a numeric compression level for zstd. Use a standard compression specifier such as zstd-5 instead.
zstreamredup[-v] file- It was formerly possible to create deduplicated send streams with the
zfssend-Doption. However, support for stream-level deduplication has been deprecated and removed from bothzfssendandzfsreceive.zstreamredupreads a deduplicated stream from the specified file and outputs an equivalent, non-deduplicated send stream on standard output. Therefore, a deduplicated stream can be received by running:#zstreamredupfile |zfsreceive…A real file is required here because resolving deduplicated records involves rereading earlier parts of the stream.
-v- Verbose. Prints a summary of reduplicated records.
zstreamtokenresume_token- Dumps ZFS resume token information.
EXAMPLES
Recovering from OpenZFS bug #12762
First, determine which records are corrupt. That cannot be done automatically; it requires information beyond ZFS's metadata. If object 128 is corrupted at offset 0 and is compressed using lz4, then run this command:
#zfssend-c… |zstreamdecompress128,0,lz4 |zfsrecv…
Recovering from OpenZFS bug #18239
The bogus records typically have an absurdly large offset that can
be discovered by running zdb
-ddddd dataset object or
zstream dump
-v. To recover, send the dataset and use
zstream to drop the bogus record, then receive it
into a new dataset.
#zfssend… |zstreamdrop_records3545761,18446744073709486080 |zfsrecv…
Migrating from a zvol to a physical disk
Given an adequately sized physical disk /dev/sdd and a zvol tank/vol with snapshots @1, @2, and @3:
#zfssend-Lectank/vol@1 |zstreamraw/dev/sdd 16731506615198184313 #zfssend-Lec-I@1 tank/vol@3 |zstreamraw-g16731506615198184313 /dev/sdd 10690368765373298656
SEE ALSO
zdb(8), zfs(8), zfs-receive(8), zfs-send(8), https://github.com/openzfs/zfs/issues/12762, https://github.com/openzfs/zfs/issues/18239
| September 3, 2026 | Debian |