1 .\" Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd "control utility for mirrored devices"
99 utility is used for mirror (RAID1) configurations.
100 After a mirror's creation, all components are detected and configured
102 All operations like failure detection, stale component detection, rebuild
103 of stale components, etc.\& are also done automatically.
106 utility uses on-disk metadata (stored in the provider's last sector) to store all needed
108 Since the last sector is used for this purpose, it is possible to place a root
109 file system on a mirror.
111 The first argument to
113 indicates an action to be performed:
114 .Bl -tag -width ".Cm deactivate"
117 The order of components is important, because a component's priority is based on its position
119 The component with the biggest priority is used by the
122 and is also used as a master component when resynchronization is needed,
123 e.g.\& after a power failure when the device was open for writing.
125 Additional options include:
126 .Bl -tag -width ".Fl b Ar balance"
128 Specifies balance algorithm to use, one of:
129 .Bl -tag -width ".Cm round-robin"
131 Read from the component with the lowest load.
133 Read from the component with the biggest priority.
135 Use round-robin algorithm when choosing component to read.
137 Split read requests, which are bigger than or equal to slice size on N pieces,
138 where N is the number of active components.
139 This is the default balance algorithm.
142 Do not synchronize after a power failure or system crash.
143 Assumes device is in consistent state.
145 Hardcode providers' names in metadata.
147 Turn off autosynchronization of stale components.
151 balance algorithm and an I/O READ request is bigger than or equal to this value,
152 the I/O request will be split into N pieces, where N is the number of active
154 Defaults to 4096 bytes.
157 Clear metadata on the given providers.
159 Configure the given device.
161 Additional options include:
162 .Bl -tag -width ".Fl b Ar balance"
164 Turn on autosynchronization of stale components.
166 Specifies balance algorithm to use.
168 Do not hardcode providers' names in metadata.
170 Synchronize device after a power failure or system crash.
172 Do not synchronize after a power failure or system crash.
173 Assumes device is in consistent state.
175 Hardcode providers' names in metadata.
177 Turn off autosynchronization of stale components.
179 Specifies slice size for
184 Rebuild the given mirror components forcibly.
185 If autosynchronization was not turned off for the given device, this command
186 should be unnecessary.
188 Add the given component(s) to the existing mirror.
190 Additional options include:
191 .Bl -tag -width ".Fl p Ar priority"
193 Hardcode providers' names in metadata.
195 Mark component(s) as inactive immediately after insertion.
197 Specifies priority of the given component(s).
200 Remove the given component(s) from the mirror and clear metadata on it.
202 Activate the given component(s), which were marked as inactive before.
204 Mark the given component(s) as inactive, so it will not be automatically
205 connected to the mirror.
207 Forget about components which are not connected.
208 This command is useful when a disk has failed and cannot be reconnected, preventing the
210 command from being used to remove it.
212 Stop the given mirror.
214 Additional options include:
215 .Bl -tag -width ".Fl f"
217 Stop the given mirror even if it is opened.
220 Dump metadata stored on the given providers.
235 Additional options include:
236 .Bl -tag -width ".Fl v"
241 Exit status is 0 on success, and 1 if the command fails.
243 Use 3 disks to setup a mirror.
244 Choose split balance algorithm, split only
245 requests which are bigger than or equal to 2kB.
247 mount it, then unmount it and stop device:
248 .Bd -literal -offset indent
249 gmirror label -v -b split -s 2048 data da0 da1 da2
250 newfs /dev/mirror/data
251 mount /dev/mirror/data /mnt
258 Create a mirror on disk with valid data (note that the last sector of the disk
259 will be overwritten).
260 Add another disk to this mirror,
261 so it will be synchronized with existing disk:
262 .Bd -literal -offset indent
263 gmirror label -v -b round-robin data da0
264 gmirror insert data da1
267 Create a mirror, but do not use automatic synchronization feature.
268 Add another disk and rebuild it:
269 .Bd -literal -offset indent
270 gmirror label -v -n -b load data da0 da1
271 gmirror insert data da2
272 gmirror rebuild data da2
276 Replace it with a brand new one:
277 .Bd -literal -offset indent
279 gmirror insert data da1
282 Create a mirror, deactivate one component, do the backup and connect it again.
283 It will not be resynchronized, if there is no need to do so (there were no writes in
285 .Bd -literal -offset indent
286 gmirror label data da0 da1
287 gmirror deactivate data da1
288 dd if=/dev/da1 of=/backup/data.img bs=1m
289 gmirror activate data da1
292 Doing kernel dumps to
296 This is possible, but some conditions have to be met.
297 First of all, a kernel dump will go only to one component and
299 always chooses the component with the highest priority.
300 Reading a dump from the mirror on boot will only work if the
302 balance algorithm is used (that way
304 will read only from the component with the highest priority).
305 If you use a different balance algorithm, you should add:
306 .Bd -literal -offset indent
307 gmirror configure -b prefer data
313 .Bd -literal -offset indent
314 gmirror configure -b round-robin data
320 The decision which component to choose for dumping is made when
323 If on the next boot a component with a higher priority will be available,
324 the prefer algorithm will choose to read from it and
327 If on the next boot a component with the highest priority will be synchronized,
328 the prefer balance algorithm will read from the next one, thus will find nothing
345 .An Pawel Jakub Dawidek Aq pjd@FreeBSD.org
347 There should be a way to change a component's priority inside a running mirror.
349 There should be a section with an implementation description.
351 Documentation for sysctls
352 .Va kern.geom.mirror.*