1.\" SPDX-License-Identifier: CDDL-1.0 2.\" 3.\" CDDL HEADER START 4.\" 5.\" The contents of this file are subject to the terms of the 6.\" Common Development and Distribution License (the "License"). 7.\" You may not use this file except in compliance with the License. 8.\" 9.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10.\" or https://opensource.org/licenses/CDDL-1.0. 11.\" See the License for the specific language governing permissions 12.\" and limitations under the License. 13.\" 14.\" When distributing Covered Code, include this CDDL HEADER in each 15.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16.\" If applicable, add the following below this CDDL HEADER, with the 17.\" fields enclosed by brackets "[]" replaced with your own identifying 18.\" information: Portions Copyright [yyyy] [name of copyright owner] 19.\" 20.\" CDDL HEADER END 21.\" 22.\" Copyright 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved. 23.\" 24.\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS 25.\" 26.Dd May 3, 2023 27.Dt ZHACK 1 28.Os 29. 30.Sh NAME 31.Nm zhack 32.Nd libzpool debugging tool 33.Sh DESCRIPTION 34This utility pokes configuration changes directly into a ZFS pool, 35which is dangerous and can cause data corruption. 36.Sh SYNOPSIS 37.Bl -tag -width Ds 38.It Xo 39.Nm zhack 40.Cm feature stat 41.Ar pool 42.Xc 43List feature flags. 44. 45.It Xo 46.Nm zhack 47.Cm feature enable 48.Op Fl d Ar description 49.Op Fl r 50.Ar pool 51.Ar guid 52.Xc 53Add a new feature to 54.Ar pool 55that is uniquely identified by 56.Ar guid , 57which is specified in the same form as a 58.Xr zfs 8 59user property. 60.Pp 61The 62.Ar description 63is a short human readable explanation of the new feature. 64.Pp 65The 66.Fl r 67flag indicates that 68.Ar pool 69can be safely opened in read-only mode by a system that does not understand the 70.Ar guid 71feature. 72. 73.It Xo 74.Nm zhack 75.Cm feature ref 76.Op Fl d Ns | Ns Fl m 77.Ar pool 78.Ar guid 79.Xc 80Increment the reference count of the 81.Ar guid 82feature in 83.Ar pool . 84.Pp 85The 86.Fl d 87flag decrements the reference count of the 88.Ar guid 89feature in 90.Ar pool 91instead. 92.Pp 93The 94.Fl m 95flag indicates that the 96.Ar guid 97feature is now required to read the pool MOS. 98. 99.It Xo 100.Nm zhack 101.Cm label repair 102.Op Fl cu 103.Ar device 104.Xc 105Repair labels of a specified 106.Ar device 107according to options. 108.Pp 109Flags may be combined to do their functions simultaneously. 110. 111.Pp 112The 113.Fl c 114flag repairs corrupted label checksums 115. 116.Pp 117The 118.Fl u 119flag restores the label on a detached device 120.Pp 121Example: 122.Nm zhack Cm label repair Fl cu Ar device 123 Fix checksums and undetach a device 124. 125.It Xo 126.Nm zhack 127.Cm metaslab leak 128.Op Fl f 129.Ar pool 130.Xc 131Apply a fragmentation profile generated by 132.Sy zdb 133to the specified 134.Ar pool Ns 135\&. 136.Pp 137The 138.Fl f 139flag forces the profile to apply even if the vdevs in the 140.Ar pool 141don't have the same number of metaslabs as the fragmentation profile. 142. 143.El 144. 145.Sh GLOBAL OPTIONS 146The following can be passed to all 147.Nm 148invocations before any subcommand: 149.Bl -tag -width "-d dir" 150.It Fl c Ar cachefile 151Read 152.Ar pool 153configuration from the 154.Ar cachefile , 155which is 156.Pa /etc/zfs/zpool.cache 157by default. 158.It Fl d Ar dir 159Search for 160.Ar pool 161members in 162.Ar dir . 163Can be specified more than once. 164.It Fl o Ar var Ns = Ns Ar value 165Set the given tunable to the provided value. 166.El 167. 168.Sh EXAMPLES 169.Bd -literal 170.No # Nm zhack Cm feature stat Ar tank 171for_read_obj: 172 org.illumos:lz4_compress = 0 173for_write_obj: 174 com.delphix:async_destroy = 0 175 com.delphix:empty_bpobj = 0 176descriptions_obj: 177 com.delphix:async_destroy = Destroy filesystems asynchronously. 178 com.delphix:empty_bpobj = Snapshots use less space. 179 org.illumos:lz4_compress = LZ4 compression algorithm support. 180 181.No # Nm zhack Cm feature enable Fl d No 'Predict future disk failures.' Ar tank com.example:clairvoyance 182.No # Nm zhack Cm feature ref Ar tank com.example:clairvoyance 183.Ed 184. 185.Sh SEE ALSO 186.Xr ztest 1 , 187.Xr zpool-features 7 , 188.Xr zfs 8 189