xref: /freebsd-src/lib/geom/mirror/gmirror.8 (revision 27bd6c32bbb49a592a0dfbec5f211a7c2fed31d6)
1e4b0a90eSBrooks Davis.\" Copyright (c) 2004-2009 Pawel Jakub Dawidek <pjd@FreeBSD.org>
2e4b0a90eSBrooks Davis.\" All rights reserved.
3e4b0a90eSBrooks Davis.\"
4e4b0a90eSBrooks Davis.\" Redistribution and use in source and binary forms, with or without
5e4b0a90eSBrooks Davis.\" modification, are permitted provided that the following conditions
6e4b0a90eSBrooks Davis.\" are met:
7e4b0a90eSBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
8e4b0a90eSBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
9e4b0a90eSBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
10e4b0a90eSBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
11e4b0a90eSBrooks Davis.\"    documentation and/or other materials provided with the distribution.
12e4b0a90eSBrooks Davis.\"
13e4b0a90eSBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14e4b0a90eSBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15e4b0a90eSBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16e4b0a90eSBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17e4b0a90eSBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18e4b0a90eSBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19e4b0a90eSBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20e4b0a90eSBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21e4b0a90eSBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22e4b0a90eSBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23e4b0a90eSBrooks Davis.\" SUCH DAMAGE.
24e4b0a90eSBrooks Davis.\"
25*27bd6c32SJohn Baldwin.Dd January 23, 2025
26e4b0a90eSBrooks Davis.Dt GMIRROR 8
27e4b0a90eSBrooks Davis.Os
28e4b0a90eSBrooks Davis.Sh NAME
29e4b0a90eSBrooks Davis.Nm gmirror
30e4b0a90eSBrooks Davis.Nd "control utility for mirrored devices"
31e4b0a90eSBrooks Davis.Sh SYNOPSIS
32d63104d2SBenedict ReuschlingTo compile GEOM_MIRROR into your kernel, add the following lines to your
33d63104d2SBenedict Reuschlingkernel configuration file:
34d63104d2SBenedict Reuschling.Bd -ragged -offset indent
35d63104d2SBenedict Reuschling.Cd "options GEOM_MIRROR"
36d63104d2SBenedict Reuschling.Ed
37d63104d2SBenedict Reuschling.Pp
38d63104d2SBenedict ReuschlingAlternatively, to load the GEOM_MIRROR module at boot time, add the following
39d63104d2SBenedict Reuschlingline to your
40d63104d2SBenedict Reuschling.Xr loader.conf 5 :
41d63104d2SBenedict Reuschling.Bd -literal -offset indent
42d63104d2SBenedict Reuschlinggeom_mirror_load="YES"
43d63104d2SBenedict Reuschling.Ed
44d63104d2SBenedict Reuschling.Pp
45d63104d2SBenedict Reuschling.No Usage of the Nm
46d63104d2SBenedict Reuschlingutility:
47d63104d2SBenedict Reuschling.Pp
48e4b0a90eSBrooks Davis.Nm
49e4b0a90eSBrooks Davis.Cm label
50e4b0a90eSBrooks Davis.Op Fl Fhnv
51e4b0a90eSBrooks Davis.Op Fl b Ar balance
52e4b0a90eSBrooks Davis.Op Fl s Ar slice
53e4b0a90eSBrooks Davis.Ar name
54e4b0a90eSBrooks Davis.Ar prov ...
55e4b0a90eSBrooks Davis.Nm
56e4b0a90eSBrooks Davis.Cm clear
57e4b0a90eSBrooks Davis.Op Fl v
58e4b0a90eSBrooks Davis.Ar prov ...
59e4b0a90eSBrooks Davis.Nm
60e4b0a90eSBrooks Davis.Cm create
61e4b0a90eSBrooks Davis.Op Fl Fnv
62e4b0a90eSBrooks Davis.Op Fl b Ar balance
63e4b0a90eSBrooks Davis.Op Fl s Ar slice
64e4b0a90eSBrooks Davis.Ar name
65e4b0a90eSBrooks Davis.Ar prov ...
66e4b0a90eSBrooks Davis.Nm
67e4b0a90eSBrooks Davis.Cm configure
68e4b0a90eSBrooks Davis.Op Fl adfFhnv
69e4b0a90eSBrooks Davis.Op Fl b Ar balance
70e4b0a90eSBrooks Davis.Op Fl s Ar slice
71e4b0a90eSBrooks Davis.Ar name
72e4b0a90eSBrooks Davis.Nm
73e4b0a90eSBrooks Davis.Cm configure
74e4b0a90eSBrooks Davis.Op Fl v
75e4b0a90eSBrooks Davis.Fl p Ar priority
76e4b0a90eSBrooks Davis.Ar name
77e4b0a90eSBrooks Davis.Ar prov
78e4b0a90eSBrooks Davis.Nm
79e4b0a90eSBrooks Davis.Cm rebuild
80e4b0a90eSBrooks Davis.Op Fl v
81e4b0a90eSBrooks Davis.Ar name
82e4b0a90eSBrooks Davis.Ar prov ...
83e4b0a90eSBrooks Davis.Nm
84e4b0a90eSBrooks Davis.Cm resize
85e4b0a90eSBrooks Davis.Op Fl v
86e4b0a90eSBrooks Davis.Op Fl s Ar size
87e4b0a90eSBrooks Davis.Ar name
88e4b0a90eSBrooks Davis.Nm
89e4b0a90eSBrooks Davis.Cm insert
90e4b0a90eSBrooks Davis.Op Fl hiv
91e4b0a90eSBrooks Davis.Op Fl p Ar priority
92e4b0a90eSBrooks Davis.Ar name
93e4b0a90eSBrooks Davis.Ar prov ...
94e4b0a90eSBrooks Davis.Nm
95e4b0a90eSBrooks Davis.Cm remove
96e4b0a90eSBrooks Davis.Op Fl v
97e4b0a90eSBrooks Davis.Ar name
98e4b0a90eSBrooks Davis.Ar prov ...
99e4b0a90eSBrooks Davis.Nm
100e4b0a90eSBrooks Davis.Cm activate
101e4b0a90eSBrooks Davis.Op Fl v
102e4b0a90eSBrooks Davis.Ar name
103e4b0a90eSBrooks Davis.Ar prov ...
104e4b0a90eSBrooks Davis.Nm
105e4b0a90eSBrooks Davis.Cm deactivate
106e4b0a90eSBrooks Davis.Op Fl v
107e4b0a90eSBrooks Davis.Ar name
108e4b0a90eSBrooks Davis.Ar prov ...
109e4b0a90eSBrooks Davis.Nm
110e4b0a90eSBrooks Davis.Cm destroy
111e4b0a90eSBrooks Davis.Op Fl fv
112e4b0a90eSBrooks Davis.Ar name ...
113e4b0a90eSBrooks Davis.Nm
114e4b0a90eSBrooks Davis.Cm forget
115e4b0a90eSBrooks Davis.Op Fl v
116e4b0a90eSBrooks Davis.Ar name ...
117e4b0a90eSBrooks Davis.Nm
118e4b0a90eSBrooks Davis.Cm stop
119e4b0a90eSBrooks Davis.Op Fl fv
120e4b0a90eSBrooks Davis.Ar name ...
121e4b0a90eSBrooks Davis.Nm
122e4b0a90eSBrooks Davis.Cm dump
123e4b0a90eSBrooks Davis.Ar prov ...
124e4b0a90eSBrooks Davis.Nm
125e4b0a90eSBrooks Davis.Cm list
126e4b0a90eSBrooks Davis.Nm
127e4b0a90eSBrooks Davis.Cm status
128e4b0a90eSBrooks Davis.Nm
129e4b0a90eSBrooks Davis.Cm load
130e4b0a90eSBrooks Davis.Nm
131e4b0a90eSBrooks Davis.Cm unload
132e4b0a90eSBrooks Davis.Sh DESCRIPTION
133e4b0a90eSBrooks DavisThe
134e4b0a90eSBrooks Davis.Nm
135e4b0a90eSBrooks Davisutility is used for mirror (RAID1) configurations.
136e4b0a90eSBrooks DavisAfter a mirror's creation, all components are detected and configured
137e4b0a90eSBrooks Davisautomatically.
138e4b0a90eSBrooks DavisAll operations like failure detection, stale component detection, rebuild
139e4b0a90eSBrooks Davisof stale components, etc.\& are also done automatically.
140e4b0a90eSBrooks DavisThe
141e4b0a90eSBrooks Davis.Nm
142e4b0a90eSBrooks Davisutility uses on-disk metadata (stored in the provider's last sector) to store all needed
143e4b0a90eSBrooks Davisinformation.
144e4b0a90eSBrooks DavisSince the last sector is used for this purpose, it is possible to place a root
145e4b0a90eSBrooks Davisfile system on a mirror.
146e4b0a90eSBrooks Davis.Pp
147e4b0a90eSBrooks DavisThe first argument to
148e4b0a90eSBrooks Davis.Nm
149e4b0a90eSBrooks Davisindicates an action to be performed:
150e4b0a90eSBrooks Davis.Bl -tag -width ".Cm deactivate"
151e4b0a90eSBrooks Davis.It Cm label
152e4b0a90eSBrooks DavisCreate a mirror.
153e4b0a90eSBrooks DavisThe order of components is important, because a component's priority is based on its position
154e4b0a90eSBrooks Davis(starting from 0 to 255).
155e4b0a90eSBrooks DavisThe component with the biggest priority is used by the
156e4b0a90eSBrooks Davis.Cm prefer
157e4b0a90eSBrooks Davisbalance algorithm
158e4b0a90eSBrooks Davisand is also used as a master component when resynchronization is needed,
159e4b0a90eSBrooks Davise.g.\& after a power failure when the device was open for writing.
160e4b0a90eSBrooks Davis.Pp
161e4b0a90eSBrooks DavisAdditional options include:
162e4b0a90eSBrooks Davis.Bl -tag -width ".Fl b Ar balance"
163e4b0a90eSBrooks Davis.It Fl b Ar balance
164e4b0a90eSBrooks DavisSpecifies balance algorithm to use, one of:
165e4b0a90eSBrooks Davis.Bl -tag -width ".Cm round-robin"
166e4b0a90eSBrooks Davis.It Cm load
167e4b0a90eSBrooks DavisRead from the component with the lowest load.
168e4b0a90eSBrooks DavisThis is the default balance algorithm.
169e4b0a90eSBrooks Davis.It Cm prefer
170e4b0a90eSBrooks DavisRead from the component with the biggest priority.
171e4b0a90eSBrooks Davis.It Cm round-robin
172e4b0a90eSBrooks DavisUse round-robin algorithm when choosing component to read.
173e4b0a90eSBrooks Davis.It Cm split
174e4b0a90eSBrooks DavisSplit read requests, which are bigger than or equal to slice size on N pieces,
175e4b0a90eSBrooks Daviswhere N is the number of active components.
176e4b0a90eSBrooks Davis.El
177e4b0a90eSBrooks Davis.It Fl F
178e4b0a90eSBrooks DavisDo not synchronize after a power failure or system crash.
179e4b0a90eSBrooks DavisAssumes device is in consistent state.
180e4b0a90eSBrooks Davis.It Fl h
181e4b0a90eSBrooks DavisHardcode providers' names in metadata.
182e4b0a90eSBrooks Davis.It Fl n
183e4b0a90eSBrooks DavisTurn off autosynchronization of stale components.
184e4b0a90eSBrooks Davis.It Fl s Ar slice
185e4b0a90eSBrooks DavisWhen using the
186e4b0a90eSBrooks Davis.Cm split
187e4b0a90eSBrooks Davisbalance algorithm and an I/O READ request is bigger than or equal to this value,
188e4b0a90eSBrooks Davisthe I/O request will be split into N pieces, where N is the number of active
189e4b0a90eSBrooks Daviscomponents.
190e4b0a90eSBrooks DavisDefaults to 4096 bytes.
191e4b0a90eSBrooks Davis.El
192e4b0a90eSBrooks Davis.It Cm clear
193e4b0a90eSBrooks DavisClear metadata on the given providers.
194e4b0a90eSBrooks Davis.It Cm create
195e4b0a90eSBrooks DavisSimilar to
196e4b0a90eSBrooks Davis.Cm label ,
197e4b0a90eSBrooks Davisbut creates mirror without storing on-disk metadata in last sector.
198e4b0a90eSBrooks DavisThis special "manual" operation mode assumes some external control to manage
199e4b0a90eSBrooks Davismirror detection after reboot, device hot-plug and other external events.
200e4b0a90eSBrooks Davis.It Cm configure
201e4b0a90eSBrooks DavisConfigure the given device.
202e4b0a90eSBrooks Davis.Pp
203e4b0a90eSBrooks DavisAdditional options include:
204e4b0a90eSBrooks Davis.Bl -tag -width ".Fl p Ar priority"
205e4b0a90eSBrooks Davis.It Fl a
206e4b0a90eSBrooks DavisTurn on autosynchronization of stale components.
207e4b0a90eSBrooks Davis.It Fl b Ar balance
208e4b0a90eSBrooks DavisSpecifies balance algorithm to use.
209e4b0a90eSBrooks Davis.It Fl d
210e4b0a90eSBrooks DavisDo not hardcode providers' names in metadata.
211e4b0a90eSBrooks Davis.It Fl f
212e4b0a90eSBrooks DavisSynchronize device after a power failure or system crash.
213e4b0a90eSBrooks Davis.It Fl F
214e4b0a90eSBrooks DavisDo not synchronize after a power failure or system crash.
215e4b0a90eSBrooks DavisAssumes device is in consistent state.
216e4b0a90eSBrooks Davis.It Fl h
217e4b0a90eSBrooks DavisHardcode providers' names in metadata.
218e4b0a90eSBrooks Davis.It Fl n
219e4b0a90eSBrooks DavisTurn off autosynchronization of stale components.
220e4b0a90eSBrooks Davis.It Fl p Ar priority
221e4b0a90eSBrooks DavisSpecifies priority for the given component
222e4b0a90eSBrooks Davis.Ar prov .
223e4b0a90eSBrooks Davis.It Fl s Ar slice
224e4b0a90eSBrooks DavisSpecifies slice size for
225e4b0a90eSBrooks Davis.Cm split
226e4b0a90eSBrooks Davisbalance algorithm.
227e4b0a90eSBrooks Davis.El
228e4b0a90eSBrooks Davis.It Cm rebuild
229e4b0a90eSBrooks DavisRebuild the given mirror components forcibly.
230e4b0a90eSBrooks DavisIf autosynchronization was not turned off for the given device, this command
231e4b0a90eSBrooks Davisshould be unnecessary.
232e4b0a90eSBrooks Davis.It Cm resize
233e4b0a90eSBrooks DavisChange the size of the given mirror.
234e4b0a90eSBrooks Davis.Pp
235e4b0a90eSBrooks DavisAdditional options include:
236e4b0a90eSBrooks Davis.Bl -tag -width ".Fl s Ar size"
237e4b0a90eSBrooks Davis.It Fl s Ar size
238e4b0a90eSBrooks DavisNew size of the mirror is expressed in logical block numbers.
239e4b0a90eSBrooks DavisThis option can be omitted, then it will be automatically calculated to
240e4b0a90eSBrooks Davismaximum available size.
241e4b0a90eSBrooks Davis.El
242e4b0a90eSBrooks Davis.It Cm insert
243e4b0a90eSBrooks DavisAdd the given component(s) to the existing mirror.
244e4b0a90eSBrooks Davis.Pp
245e4b0a90eSBrooks DavisAdditional options include:
246e4b0a90eSBrooks Davis.Bl -tag -width ".Fl p Ar priority"
247e4b0a90eSBrooks Davis.It Fl h
248e4b0a90eSBrooks DavisHardcode providers' names in metadata.
249e4b0a90eSBrooks Davis.It Fl i
250e4b0a90eSBrooks DavisMark component(s) as inactive immediately after insertion.
251e4b0a90eSBrooks Davis.It Fl p Ar priority
252e4b0a90eSBrooks DavisSpecifies priority of the given component(s).
253e4b0a90eSBrooks Davis.El
254e4b0a90eSBrooks Davis.It Cm remove
255e4b0a90eSBrooks DavisRemove the given component(s) from the mirror and clear metadata on it.
256e4b0a90eSBrooks Davis.It Cm activate
257e4b0a90eSBrooks DavisActivate the given component(s), which were marked as inactive before.
258e4b0a90eSBrooks Davis.It Cm deactivate
259e4b0a90eSBrooks DavisMark the given component(s) as inactive, so it will not be automatically
260e4b0a90eSBrooks Davisconnected to the mirror.
261e4b0a90eSBrooks Davis.It Cm destroy
262e4b0a90eSBrooks DavisStop the given mirror and clear metadata on all its components.
263e4b0a90eSBrooks Davis.Pp
264e4b0a90eSBrooks DavisAdditional options include:
265e4b0a90eSBrooks Davis.Bl -tag -width ".Fl f"
266e4b0a90eSBrooks Davis.It Fl f
267e4b0a90eSBrooks DavisStop the given mirror even if it is opened.
268e4b0a90eSBrooks Davis.El
269e4b0a90eSBrooks Davis.It Cm forget
270e4b0a90eSBrooks DavisForget about components which are not connected.
271e4b0a90eSBrooks DavisThis command is useful when a disk has failed and cannot be reconnected, preventing the
272e4b0a90eSBrooks Davis.Cm remove
273e4b0a90eSBrooks Daviscommand from being used to remove it.
274e4b0a90eSBrooks Davis.It Cm stop
275e4b0a90eSBrooks DavisStop the given mirror.
276e4b0a90eSBrooks Davis.Pp
277e4b0a90eSBrooks DavisAdditional options include:
278e4b0a90eSBrooks Davis.Bl -tag -width ".Fl f"
279e4b0a90eSBrooks Davis.It Fl f
280e4b0a90eSBrooks DavisStop the given mirror even if it is opened.
281e4b0a90eSBrooks Davis.El
282e4b0a90eSBrooks Davis.It Cm dump
283e4b0a90eSBrooks DavisDump metadata stored on the given providers.
284e4b0a90eSBrooks Davis.It Cm list
285e4b0a90eSBrooks DavisSee
286e4b0a90eSBrooks Davis.Xr geom 8 .
287e4b0a90eSBrooks Davis.It Cm status
288e4b0a90eSBrooks DavisSee
289e4b0a90eSBrooks Davis.Xr geom 8 .
290e4b0a90eSBrooks Davis.It Cm load
291e4b0a90eSBrooks DavisSee
292e4b0a90eSBrooks Davis.Xr geom 8 .
293e4b0a90eSBrooks Davis.It Cm unload
294e4b0a90eSBrooks DavisSee
295e4b0a90eSBrooks Davis.Xr geom 8 .
296e4b0a90eSBrooks Davis.El
297e4b0a90eSBrooks Davis.Pp
298e4b0a90eSBrooks DavisAdditional options include:
299e4b0a90eSBrooks Davis.Bl -tag -width ".Fl v"
300e4b0a90eSBrooks Davis.It Fl v
301e4b0a90eSBrooks DavisBe more verbose.
302e4b0a90eSBrooks Davis.El
303e4b0a90eSBrooks Davis.Sh EXIT STATUS
304e4b0a90eSBrooks DavisExit status is 0 on success, and 1 if the command fails.
305e4b0a90eSBrooks Davis.Sh EXAMPLES
306e4b0a90eSBrooks DavisUse 3 disks to setup a mirror.
307e4b0a90eSBrooks DavisChoose split balance algorithm, split only
308e4b0a90eSBrooks Davisrequests which are bigger than or equal to 2kB.
309e4b0a90eSBrooks DavisCreate file system,
310e4b0a90eSBrooks Davismount it, then unmount it and stop device:
311e4b0a90eSBrooks Davis.Bd -literal -offset indent
312e4b0a90eSBrooks Davisgmirror label -v -b split -s 2048 data da0 da1 da2
313e4b0a90eSBrooks Davisnewfs /dev/mirror/data
314e4b0a90eSBrooks Davismount /dev/mirror/data /mnt
315e4b0a90eSBrooks Davis\&...
316e4b0a90eSBrooks Davisumount /mnt
317e4b0a90eSBrooks Davisgmirror stop data
318e4b0a90eSBrooks Davisgmirror unload
319e4b0a90eSBrooks Davis.Ed
320e4b0a90eSBrooks Davis.Pp
321e4b0a90eSBrooks DavisCreate a mirror on disk with valid data (note that the last sector of the disk
322e4b0a90eSBrooks Daviswill be overwritten).
323e4b0a90eSBrooks DavisAdd another disk to this mirror,
324e4b0a90eSBrooks Davisso it will be synchronized with existing disk:
325e4b0a90eSBrooks Davis.Bd -literal -offset indent
326e4b0a90eSBrooks Davisgmirror label -v -b round-robin data da0
327e4b0a90eSBrooks Davisgmirror insert data da1
328e4b0a90eSBrooks Davis.Ed
329e4b0a90eSBrooks Davis.Pp
330e4b0a90eSBrooks DavisCreate a mirror, but do not use automatic synchronization feature.
331e4b0a90eSBrooks DavisAdd another disk and rebuild it:
332e4b0a90eSBrooks Davis.Bd -literal -offset indent
333e4b0a90eSBrooks Davisgmirror label -v -n -b load data da0 da1
334e4b0a90eSBrooks Davisgmirror insert data da2
335e4b0a90eSBrooks Davisgmirror rebuild data da2
336e4b0a90eSBrooks Davis.Ed
337e4b0a90eSBrooks Davis.Pp
338e4b0a90eSBrooks DavisOne disk failed.
339e4b0a90eSBrooks DavisReplace it with a brand new one:
340e4b0a90eSBrooks Davis.Bd -literal -offset indent
341e4b0a90eSBrooks Davisgmirror forget data
342e4b0a90eSBrooks Davisgmirror insert data da1
343e4b0a90eSBrooks Davis.Ed
344e4b0a90eSBrooks Davis.Pp
345e4b0a90eSBrooks DavisCreate a mirror, deactivate one component, do the backup and connect it again.
346e4b0a90eSBrooks DavisIt will not be resynchronized, if there is no need to do so (there were no writes in
347e4b0a90eSBrooks Davisthe meantime):
348e4b0a90eSBrooks Davis.Bd -literal -offset indent
349e4b0a90eSBrooks Davisgmirror label data da0 da1
350e4b0a90eSBrooks Davisgmirror deactivate data da1
351e4b0a90eSBrooks Davisdd if=/dev/da1 of=/backup/data.img bs=1m
352e4b0a90eSBrooks Davisgmirror activate data da1
353e4b0a90eSBrooks Davis.Ed
354e4b0a90eSBrooks Davis.Sh SYSCTL VARIABLES
355e4b0a90eSBrooks DavisThe following
356e4b0a90eSBrooks Davis.Xr sysctl 8
357e4b0a90eSBrooks Davisvariables can be used to configure behavior for all mirrors.
358e4b0a90eSBrooks Davis.Bl -tag -width indent
359e4b0a90eSBrooks Davis.It Va kern.geom.mirror.debug
360e4b0a90eSBrooks DavisControl the verbosity of kernel logging related to mirrors.
361e4b0a90eSBrooks DavisA value larger than 0 will enable debug logging.
362e4b0a90eSBrooks Davis.It Va kern.geom.mirror.timeout
363e4b0a90eSBrooks DavisThe amount of time, in seconds, to wait for all copies of a mirror to
364e4b0a90eSBrooks Davisappear before starting the mirror.
365e4b0a90eSBrooks DavisDisks that appear after the mirror has been started are not automatically
366e4b0a90eSBrooks Davisadded to the mirror.
367e4b0a90eSBrooks Davis.It Va kern.geom.mirror.idletime
368e4b0a90eSBrooks DavisThe amount of time, in seconds, which must elapse after the last write to
369e4b0a90eSBrooks Davisa mirror before that mirror is marked clean.
370e4b0a90eSBrooks DavisClean mirrors do not need to be synchronized after a power failure or
371e4b0a90eSBrooks Davissystem crash.
372e4b0a90eSBrooks DavisA small value may result in frequent overwrites of the disks' metadata
373e4b0a90eSBrooks Davissectors, and thus may reduce the longevity of the disks.
374e4b0a90eSBrooks Davis.It Va kern.geom.mirror.disconnect_on_failure
375e4b0a90eSBrooks DavisDetermine whether a disk is automatically removed from its mirror when an
376e4b0a90eSBrooks DavisI/O request to that disk fails.
377e4b0a90eSBrooks Davis.It Va kern.geom.mirror.sync_requests
378e4b0a90eSBrooks DavisThe number of parallel I/O requests used while synchronizing a mirror.
379e4b0a90eSBrooks DavisThis parameter may only be configured as a
380e4b0a90eSBrooks Davis.Xr loader.conf 5
381e4b0a90eSBrooks Davistunable.
382e4b0a90eSBrooks Davis.It Va kern.geom.mirror.sync_update_period
383e4b0a90eSBrooks DavisThe period, in seconds, at which a synchronizing mirror's metadata is
384e4b0a90eSBrooks Davisupdated.
385e4b0a90eSBrooks DavisPeriodic updates are used to record a synchronization's progress so that
386e4b0a90eSBrooks Davisan interrupted synchronization may be resumed starting at the recorded
387e4b0a90eSBrooks Davisoffset, rather than at the beginning.
388e4b0a90eSBrooks DavisA smaller value results in more accurate progress tracking, but also
389e4b0a90eSBrooks Davisincreases the number of non-sequential writes to the disk being synchronized.
390e4b0a90eSBrooks DavisIf the sysctl value is 0, no updates are performed until the synchronization
391e4b0a90eSBrooks Davisis complete.
392e4b0a90eSBrooks Davis.El
393e4b0a90eSBrooks Davis.Sh NOTES
394e4b0a90eSBrooks DavisDoing kernel dumps to
395e4b0a90eSBrooks Davis.Nm
396e4b0a90eSBrooks Davisproviders is possible, but some conditions have to be met.
397e4b0a90eSBrooks DavisFirst of all, a kernel dump will go only to one component and
398e4b0a90eSBrooks Davis.Nm
399e4b0a90eSBrooks Davisalways chooses the component with the highest priority.
400e4b0a90eSBrooks DavisReading a dump from the mirror on boot will only work if the
401e4b0a90eSBrooks Davis.Cm prefer
402e4b0a90eSBrooks Davisbalance algorithm is used (that way
403e4b0a90eSBrooks Davis.Nm
404e4b0a90eSBrooks Daviswill read only from the component with the highest priority).
405a848315fSMateusz PiotrowskiIf you use a different balance algorithm, you should create an
406a848315fSMateusz Piotrowski.Xr rc 8
407a848315fSMateusz Piotrowskiscript that sets the balance algorithm to
408a848315fSMateusz Piotrowski.Cm prefer ,
409a848315fSMateusz Piotrowskifor example with the following command:
410e4b0a90eSBrooks Davis.Bd -literal -offset indent
411e4b0a90eSBrooks Davisgmirror configure -b prefer data
412e4b0a90eSBrooks Davis.Ed
413e4b0a90eSBrooks Davis.Pp
414a848315fSMateusz PiotrowskiMake sure that
415a848315fSMateusz Piotrowski.Xr rcorder 8
416a848315fSMateusz Piotrowskischedules the new script before
417a848315fSMateusz Piotrowski.Xr savecore 8 .
418a848315fSMateusz PiotrowskiThe desired balance algorithm can be restored later on
419a848315fSMateusz Piotrowskiby placing the following command in
420a848315fSMateusz Piotrowski.Xr rc.local 8 :
421e4b0a90eSBrooks Davis.Bd -literal -offset indent
422e4b0a90eSBrooks Davisgmirror configure -b round-robin data
423e4b0a90eSBrooks Davis.Ed
424e4b0a90eSBrooks Davis.Pp
425e4b0a90eSBrooks DavisThe decision which component to choose for dumping is made when
426e4b0a90eSBrooks Davis.Xr dumpon 8
427e4b0a90eSBrooks Davisis called.
428e4b0a90eSBrooks DavisIf on the next boot a component with a higher priority will be available,
429e4b0a90eSBrooks Davisthe prefer algorithm will choose to read from it and
430e4b0a90eSBrooks Davis.Xr savecore 8
431e4b0a90eSBrooks Daviswill find nothing.
432e4b0a90eSBrooks DavisIf on the next boot a component with the highest priority will be synchronized,
433e4b0a90eSBrooks Davisthe prefer balance algorithm will read from the next one, thus will find nothing
434e4b0a90eSBrooks Davisthere.
435e4b0a90eSBrooks Davis.Sh SEE ALSO
436e4b0a90eSBrooks Davis.Xr geom 4 ,
437e4b0a90eSBrooks Davis.Xr dumpon 8 ,
438e4b0a90eSBrooks Davis.Xr geom 8 ,
439e4b0a90eSBrooks Davis.Xr mount 8 ,
440e4b0a90eSBrooks Davis.Xr newfs 8 ,
441e4b0a90eSBrooks Davis.Xr savecore 8 ,
442e4b0a90eSBrooks Davis.Xr sysctl 8 ,
443e4b0a90eSBrooks Davis.Xr umount 8
444e4b0a90eSBrooks Davis.Sh HISTORY
445e4b0a90eSBrooks DavisThe
446e4b0a90eSBrooks Davis.Nm
447e4b0a90eSBrooks Davisutility appeared in
448e4b0a90eSBrooks Davis.Fx 5.3 .
449e4b0a90eSBrooks Davis.Sh AUTHORS
450e4b0a90eSBrooks Davis.An Pawel Jakub Dawidek Aq Mt pjd@FreeBSD.org
451e4b0a90eSBrooks Davis.Sh BUGS
452e4b0a90eSBrooks DavisThere should be a way to change a component's priority inside a running mirror.
453e4b0a90eSBrooks Davis.Pp
454e4b0a90eSBrooks DavisThere should be a section with an implementation description.
455