xref: /freebsd/sys/contrib/openzfs/man/man8/zstream.8 (revision 29fc4075e69fd27de0cded313ac6000165d99f8b)
1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or https://opensource.org/licenses/CDDL-1.0.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
21.\" Copyright (c) 2020 by Delphix. All rights reserved.
22.\"
23.Dd March 25, 2022
24.Dt ZSTREAM 8
25.Os
26.
27.Sh NAME
28.Nm zstream
29.Nd manipulate ZFS send streams
30.Sh SYNOPSIS
31.Nm
32.Cm dump
33.Op Fl Cvd
34.Op Ar file
35.Nm
36.Cm decompress
37.Op Fl v
38.Op Ar object Ns Sy \&, Ns Ar offset Ns Op Sy \&, Ns Ar type Ns ...
39.Nm
40.Cm redup
41.Op Fl v
42.Ar file
43.Nm
44.Cm token
45.Ar resume_token
46.
47.Sh DESCRIPTION
48The
49.Sy zstream
50utility manipulates ZFS send streams output by the
51.Sy zfs send
52command.
53.Bl -tag -width ""
54.It Xo
55.Nm
56.Cm dump
57.Op Fl Cvd
58.Op Ar file
59.Xc
60Print information about the specified send stream, including headers and
61record counts.
62The send stream may either be in the specified
63.Ar file ,
64or provided on standard input.
65.Bl -tag -width "-D"
66.It Fl C
67Suppress the validation of checksums.
68.It Fl v
69Verbose.
70Print metadata for each record.
71.It Fl d
72Dump data contained in each record.
73Implies verbose.
74.El
75.Pp
76The
77.Nm zstreamdump
78alias is provided for compatibility and is equivalent to running
79.Nm
80.Cm dump .
81.It Xo
82.Nm
83.Cm token
84.Ar resume_token
85.Xc
86Dumps zfs resume token information
87.It Xo
88.Nm
89.Cm decompress
90.Op Fl v
91.Op Ar object Ns Sy \&, Ns Ar offset Ns Op Sy \&, Ns Ar type Ns ...
92.Xc
93Decompress selected records in a ZFS send stream provided on standard input,
94when the compression type recorded in ZFS metadata may be incorrect.
95Specify the object number and byte offset of each record that you wish to
96decompress.
97Optionally specify the compression type.
98Valid compression types include
99.Sy gzip ,
100.Sy lz4 ,
101.Sy lzjb ,
102.Sy zstd ,
103and
104.Sy zle .
105The default is
106.Sy lz4 .
107Every record for that object beginning at that offset will be decompressed, if
108possible.
109It may not be possible, because the record may be corrupted in some but not
110all of the stream's snapshots.
111The repaired stream will be written to standard output.
112.Bl -tag -width "-v"
113.It Fl v
114Verbose.
115Print summary of decompressed records.
116.El
117.It Xo
118.Nm
119.Cm redup
120.Op Fl v
121.Ar file
122.Xc
123Deduplicated send streams can be generated by using the
124.Nm zfs Cm send Fl D
125command.
126The ability to send deduplicated send streams is deprecated.
127In the future, the ability to receive a deduplicated send stream with
128.Nm zfs Cm receive
129will be removed.
130However, deduplicated send streams can still be received by utilizing
131.Nm zstream Cm redup .
132.Pp
133The
134.Nm zstream Cm redup
135command is provided a
136.Ar file
137containing a deduplicated send stream, and outputs an equivalent
138non-deduplicated send stream on standard output.
139Therefore, a deduplicated send stream can be received by running:
140.Dl # Nm zstream Cm redup Pa DEDUP_STREAM_FILE | Nm zfs Cm receive No …
141.Bl -tag -width "-D"
142.It Fl v
143Verbose.
144Print summary of converted records.
145.El
146.El
147.
148.Sh EXAMPLES
149Heal a dataset that was corrupted due to OpenZFS bug #12762.
150First, determine which records are corrupt.
151That cannot be done automatically; it requires information beyond ZFS's
152metadata.
153If object
154.Sy 128
155is corrupted at offset
156.Sy 0
157and is compressed using
158.Sy lz4 ,
159then run this command:
160.Bd -literal
161.No # Nm zfs Ar send Fl c Ar … | Nm zstream decompress Ar 128,0,lz4 | \
162Nm zfs recv Ar …
163.Ed
164.Sh SEE ALSO
165.Xr zfs 8 ,
166.Xr zfs-receive 8 ,
167.Xr zfs-send 8 ,
168.Lk https://github.com/openzfs/zfs/issues/12762
169