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