xref: /freebsd/sys/contrib/openzfs/man/man1/zhack.1 (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
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 26, 2021
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.El
126.
127.Sh GLOBAL OPTIONS
128The following can be passed to all
129.Nm
130invocations before any subcommand:
131.Bl -tag -width "-d dir"
132.It Fl c Ar cachefile
133Read
134.Ar pool
135configuration from the
136.Ar cachefile ,
137which is
138.Pa /etc/zfs/zpool.cache
139by default.
140.It Fl d Ar dir
141Search for
142.Ar pool
143members in
144.Ar dir .
145Can be specified more than once.
146.El
147.
148.Sh EXAMPLES
149.Bd -literal
150.No # Nm zhack Cm feature stat Ar tank
151for_read_obj:
152	org.illumos:lz4_compress = 0
153for_write_obj:
154	com.delphix:async_destroy = 0
155	com.delphix:empty_bpobj = 0
156descriptions_obj:
157	com.delphix:async_destroy = Destroy filesystems asynchronously.
158	com.delphix:empty_bpobj = Snapshots use less space.
159	org.illumos:lz4_compress = LZ4 compression algorithm support.
160
161.No # Nm zhack Cm feature enable Fl d No 'Predict future disk failures.' Ar tank com.example:clairvoyance
162.No # Nm zhack Cm feature ref Ar tank com.example:clairvoyance
163.Ed
164.
165.Sh SEE ALSO
166.Xr ztest 1 ,
167.Xr zpool-features 7 ,
168.Xr zfs 8
169