xref: /freebsd/sys/contrib/openzfs/man/man1/zhack.1 (revision dd4f32ae62426a10a84b4322756d82c06c202c4e)
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 2013 Darik Horn <dajhorn@vanadac.com>. All rights reserved.
22.\"
23.\" lint-ok: WARNING: sections out of conventional order: Sh SYNOPSIS
24.\"
25.Dd May 26, 2021
26.Dt ZHACK 1
27.Os
28.
29.Sh NAME
30.Nm zhack
31.Nd libzpool debugging tool
32.Sh DESCRIPTION
33This utility pokes configuration changes directly into a ZFS pool,
34which is dangerous and can cause data corruption.
35.Sh SYNOPSIS
36.Bl -tag -width Ds
37.It Xo
38.Nm zhack
39.Cm feature stat
40.Ar pool
41.Xc
42List feature flags.
43.
44.It Xo
45.Nm zhack
46.Cm feature enable
47.Op Fl d Ar description
48.Op Fl r
49.Ar pool
50.Ar guid
51.Xc
52Add a new feature to
53.Ar pool
54that is uniquely identified by
55.Ar guid ,
56which is specified in the same form as a
57.Xr zfs 8
58user property.
59.Pp
60The
61.Ar description
62is a short human readable explanation of the new feature.
63.Pp
64The
65.Fl r
66flag indicates that
67.Ar pool
68can be safely opened in read-only mode by a system that does not understand the
69.Ar guid
70feature.
71.
72.It Xo
73.Nm zhack
74.Cm feature ref
75.Op Fl d Ns | Ns Fl m
76.Ar pool
77.Ar guid
78.Xc
79Increment the reference count of the
80.Ar guid
81feature in
82.Ar pool .
83.Pp
84The
85.Fl d
86flag decrements the reference count of the
87.Ar guid
88feature in
89.Ar pool
90instead.
91.Pp
92The
93.Fl m
94flag indicates that the
95.Ar guid
96feature is now required to read the pool MOS.
97.
98.It Xo
99.Nm zhack
100.Cm label repair
101.Op Fl cu
102.Ar device
103.Xc
104Repair labels of a specified
105.Ar device
106according to options.
107.Pp
108Flags may be combined to do their functions simultaneously.
109.
110.Pp
111The
112.Fl c
113flag repairs corrupted label checksums
114.
115.Pp
116The
117.Fl u
118flag restores the label on a detached device
119.Pp
120Example:
121.Nm zhack Cm label repair Fl cu Ar device
122  Fix checksums and undetach a device
123.
124.El
125.
126.Sh GLOBAL OPTIONS
127The following can be passed to all
128.Nm
129invocations before any subcommand:
130.Bl -tag -width "-d dir"
131.It Fl c Ar cachefile
132Read
133.Ar pool
134configuration from the
135.Ar cachefile ,
136which is
137.Pa /etc/zfs/zpool.cache
138by default.
139.It Fl d Ar dir
140Search for
141.Ar pool
142members in
143.Ar dir .
144Can be specified more than once.
145.El
146.
147.Sh EXAMPLES
148.Bd -literal
149.No # Nm zhack Cm feature stat Ar tank
150for_read_obj:
151	org.illumos:lz4_compress = 0
152for_write_obj:
153	com.delphix:async_destroy = 0
154	com.delphix:empty_bpobj = 0
155descriptions_obj:
156	com.delphix:async_destroy = Destroy filesystems asynchronously.
157	com.delphix:empty_bpobj = Snapshots use less space.
158	org.illumos:lz4_compress = LZ4 compression algorithm support.
159
160.No # Nm zhack Cm feature enable Fl d No 'Predict future disk failures.' Ar tank com.example:clairvoyance
161.No # Nm zhack Cm feature ref Ar tank com.example:clairvoyance
162.Ed
163.
164.Sh SEE ALSO
165.Xr ztest 1 ,
166.Xr zpool-features 7 ,
167.Xr zfs 8
168