xref: /freebsd-src/sys/contrib/openzfs/man/man8/zstream.8 (revision dbd5678dca91abcefe8d046aa2f9b66497a95ffb)
1eda14cbcSMatt Macy.\"
2eda14cbcSMatt Macy.\" CDDL HEADER START
3eda14cbcSMatt Macy.\"
4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy.\"
8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11eda14cbcSMatt Macy.\" and limitations under the License.
12eda14cbcSMatt Macy.\"
13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy.\"
19eda14cbcSMatt Macy.\" CDDL HEADER END
20eda14cbcSMatt Macy.\"
21eda14cbcSMatt Macy.\" Copyright (c) 2020 by Delphix. All rights reserved.
2216038816SMartin Matuska.\"
23*dbd5678dSMartin Matuska.Dd October 4, 2022
24eda14cbcSMatt Macy.Dt ZSTREAM 8
25eda14cbcSMatt Macy.Os
2616038816SMartin Matuska.
27eda14cbcSMatt Macy.Sh NAME
28eda14cbcSMatt Macy.Nm zstream
2916038816SMartin Matuska.Nd manipulate ZFS send streams
30eda14cbcSMatt Macy.Sh SYNOPSIS
31eda14cbcSMatt Macy.Nm
32eda14cbcSMatt Macy.Cm dump
33eda14cbcSMatt Macy.Op Fl Cvd
34eda14cbcSMatt Macy.Op Ar file
35eda14cbcSMatt Macy.Nm
36a0b956f5SMartin Matuska.Cm decompress
37a0b956f5SMartin Matuska.Op Fl v
38a0b956f5SMartin Matuska.Op Ar object Ns Sy \&, Ns Ar offset Ns Op Sy \&, Ns Ar type Ns ...
39a0b956f5SMartin Matuska.Nm
40eda14cbcSMatt Macy.Cm redup
41eda14cbcSMatt Macy.Op Fl v
42eda14cbcSMatt Macy.Ar file
43eda14cbcSMatt Macy.Nm
44eda14cbcSMatt Macy.Cm token
45eda14cbcSMatt Macy.Ar resume_token
46*dbd5678dSMartin Matuska.Nm
47*dbd5678dSMartin Matuska.Cm recompress
48*dbd5678dSMartin Matuska.Op Fl l Ar level
49*dbd5678dSMartin Matuska.Ar algorithm
5016038816SMartin Matuska.
51eda14cbcSMatt Macy.Sh DESCRIPTION
52eda14cbcSMatt MacyThe
53eda14cbcSMatt Macy.Sy zstream
5416038816SMartin Matuskautility manipulates ZFS send streams output by the
55eda14cbcSMatt Macy.Sy zfs send
56eda14cbcSMatt Macycommand.
57eda14cbcSMatt Macy.Bl -tag -width ""
58eda14cbcSMatt Macy.It Xo
59eda14cbcSMatt Macy.Nm
60eda14cbcSMatt Macy.Cm dump
61eda14cbcSMatt Macy.Op Fl Cvd
62eda14cbcSMatt Macy.Op Ar file
63eda14cbcSMatt Macy.Xc
64eda14cbcSMatt MacyPrint information about the specified send stream, including headers and
65eda14cbcSMatt Macyrecord counts.
66eda14cbcSMatt MacyThe send stream may either be in the specified
67eda14cbcSMatt Macy.Ar file ,
68eda14cbcSMatt Macyor provided on standard input.
69eda14cbcSMatt Macy.Bl -tag -width "-D"
70eda14cbcSMatt Macy.It Fl C
71eda14cbcSMatt MacySuppress the validation of checksums.
72eda14cbcSMatt Macy.It Fl v
73eda14cbcSMatt MacyVerbose.
74eda14cbcSMatt MacyPrint metadata for each record.
75eda14cbcSMatt Macy.It Fl d
76eda14cbcSMatt MacyDump data contained in each record.
77eda14cbcSMatt MacyImplies verbose.
78eda14cbcSMatt Macy.El
7916038816SMartin Matuska.Pp
8016038816SMartin MatuskaThe
8116038816SMartin Matuska.Nm zstreamdump
8216038816SMartin Matuskaalias is provided for compatibility and is equivalent to running
8316038816SMartin Matuska.Nm
8416038816SMartin Matuska.Cm dump .
85eda14cbcSMatt Macy.It Xo
86eda14cbcSMatt Macy.Nm
87eda14cbcSMatt Macy.Cm token
88eda14cbcSMatt Macy.Ar resume_token
89eda14cbcSMatt Macy.Xc
90eda14cbcSMatt MacyDumps zfs resume token information
91eda14cbcSMatt Macy.It Xo
92eda14cbcSMatt Macy.Nm
93a0b956f5SMartin Matuska.Cm decompress
94a0b956f5SMartin Matuska.Op Fl v
95a0b956f5SMartin Matuska.Op Ar object Ns Sy \&, Ns Ar offset Ns Op Sy \&, Ns Ar type Ns ...
96a0b956f5SMartin Matuska.Xc
97a0b956f5SMartin MatuskaDecompress selected records in a ZFS send stream provided on standard input,
98a0b956f5SMartin Matuskawhen the compression type recorded in ZFS metadata may be incorrect.
99a0b956f5SMartin MatuskaSpecify the object number and byte offset of each record that you wish to
100a0b956f5SMartin Matuskadecompress.
101a0b956f5SMartin MatuskaOptionally specify the compression type.
102a0b956f5SMartin MatuskaValid compression types include
103*dbd5678dSMartin Matuska.Sy off ,
104a0b956f5SMartin Matuska.Sy gzip ,
105a0b956f5SMartin Matuska.Sy lz4 ,
106a0b956f5SMartin Matuska.Sy lzjb ,
107a0b956f5SMartin Matuska.Sy zstd ,
108a0b956f5SMartin Matuskaand
109a0b956f5SMartin Matuska.Sy zle .
110a0b956f5SMartin MatuskaThe default is
111a0b956f5SMartin Matuska.Sy lz4 .
112a0b956f5SMartin MatuskaEvery record for that object beginning at that offset will be decompressed, if
113a0b956f5SMartin Matuskapossible.
114a0b956f5SMartin MatuskaIt may not be possible, because the record may be corrupted in some but not
115a0b956f5SMartin Matuskaall of the stream's snapshots.
116*dbd5678dSMartin MatuskaSpecifying a compression type of
117*dbd5678dSMartin Matuska.Sy off
118*dbd5678dSMartin Matuskawill change the stream's metadata accordingly, without attempting decompression.
119*dbd5678dSMartin MatuskaThis can be useful if the record is already uncompressed but the metadata
120*dbd5678dSMartin Matuskainsists otherwise.
121a0b956f5SMartin MatuskaThe repaired stream will be written to standard output.
122a0b956f5SMartin Matuska.Bl -tag -width "-v"
123a0b956f5SMartin Matuska.It Fl v
124a0b956f5SMartin MatuskaVerbose.
125a0b956f5SMartin MatuskaPrint summary of decompressed records.
126a0b956f5SMartin Matuska.El
127a0b956f5SMartin Matuska.It Xo
128a0b956f5SMartin Matuska.Nm
129eda14cbcSMatt Macy.Cm redup
130eda14cbcSMatt Macy.Op Fl v
131eda14cbcSMatt Macy.Ar file
132eda14cbcSMatt Macy.Xc
133eda14cbcSMatt MacyDeduplicated send streams can be generated by using the
134eda14cbcSMatt Macy.Nm zfs Cm send Fl D
135eda14cbcSMatt Macycommand.
136eda14cbcSMatt MacyThe ability to send deduplicated send streams is deprecated.
137eda14cbcSMatt MacyIn the future, the ability to receive a deduplicated send stream with
138eda14cbcSMatt Macy.Nm zfs Cm receive
139eda14cbcSMatt Macywill be removed.
140eda14cbcSMatt MacyHowever, deduplicated send streams can still be received by utilizing
141eda14cbcSMatt Macy.Nm zstream Cm redup .
142eda14cbcSMatt Macy.Pp
143eda14cbcSMatt MacyThe
144eda14cbcSMatt Macy.Nm zstream Cm redup
145eda14cbcSMatt Macycommand is provided a
146eda14cbcSMatt Macy.Ar file
147eda14cbcSMatt Macycontaining a deduplicated send stream, and outputs an equivalent
148eda14cbcSMatt Macynon-deduplicated send stream on standard output.
149eda14cbcSMatt MacyTherefore, a deduplicated send stream can be received by running:
15016038816SMartin Matuska.Dl # Nm zstream Cm redup Pa DEDUP_STREAM_FILE | Nm zfs Cm receive No …
151eda14cbcSMatt Macy.Bl -tag -width "-D"
152eda14cbcSMatt Macy.It Fl v
153eda14cbcSMatt MacyVerbose.
154eda14cbcSMatt MacyPrint summary of converted records.
15516038816SMartin Matuska.El
156*dbd5678dSMartin Matuska.It Xo
157*dbd5678dSMartin Matuska.Nm
158*dbd5678dSMartin Matuska.Cm recompress
159*dbd5678dSMartin Matuska.Op Fl l Ar level
160*dbd5678dSMartin Matuska.Ar algorithm
161*dbd5678dSMartin Matuska.Xc
162*dbd5678dSMartin MatuskaRecompresses a send stream, provided on standard input, using the provided
163*dbd5678dSMartin Matuskaalgorithm and optional level, and writes the modified stream to standard output.
164*dbd5678dSMartin MatuskaAll WRITE records in the send stream will be recompressed, unless they fail
165*dbd5678dSMartin Matuskato result in size reduction compared to being left uncompressed.
166*dbd5678dSMartin MatuskaThe provided algorithm can be any valid value to the
167*dbd5678dSMartin Matuska.Nm compress
168*dbd5678dSMartin Matuskaproperty.
169*dbd5678dSMartin MatuskaNote that encrypted send streams cannot be recompressed.
170*dbd5678dSMartin Matuska.Bl -tag -width "-l"
171*dbd5678dSMartin Matuska.It Fl l Ar level
172*dbd5678dSMartin MatuskaSpecifies compression level.
173*dbd5678dSMartin MatuskaOnly needed for algorithms where the level is not implied as part of the name
174*dbd5678dSMartin Matuskaof the algorithm (e.g. gzip-3 does not require it, while zstd does, if a
175*dbd5678dSMartin Matuskanon-default level is desired).
176*dbd5678dSMartin Matuska.El
17716038816SMartin Matuska.El
17816038816SMartin Matuska.
179a0b956f5SMartin Matuska.Sh EXAMPLES
180a0b956f5SMartin MatuskaHeal a dataset that was corrupted due to OpenZFS bug #12762.
181a0b956f5SMartin MatuskaFirst, determine which records are corrupt.
182a0b956f5SMartin MatuskaThat cannot be done automatically; it requires information beyond ZFS's
183a0b956f5SMartin Matuskametadata.
184a0b956f5SMartin MatuskaIf object
185a0b956f5SMartin Matuska.Sy 128
186a0b956f5SMartin Matuskais corrupted at offset
187a0b956f5SMartin Matuska.Sy 0
188a0b956f5SMartin Matuskaand is compressed using
189a0b956f5SMartin Matuska.Sy lz4 ,
190a0b956f5SMartin Matuskathen run this command:
191a0b956f5SMartin Matuska.Bd -literal
192a0b956f5SMartin Matuska.No # Nm zfs Ar send Fl c Ar … | Nm zstream decompress Ar 128,0,lz4 | \
193a0b956f5SMartin MatuskaNm zfs recv Ar …
194a0b956f5SMartin Matuska.Ed
195eda14cbcSMatt Macy.Sh SEE ALSO
196eda14cbcSMatt Macy.Xr zfs 8 ,
19716038816SMartin Matuska.Xr zfs-receive 8 ,
198a0b956f5SMartin Matuska.Xr zfs-send 8 ,
199a0b956f5SMartin Matuska.Lk https://github.com/openzfs/zfs/issues/12762
200