]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sbin/geom/class/multipath/gmultipath.8
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sbin / geom / class / multipath / gmultipath.8
1 .\" Copyright (c) 2007 Matthew Jacob
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
12 .\"
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
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd April 18, 2012
28 .Dt GMULTIPATH 8
29 .Os
30 .Sh NAME
31 .Nm gmultipath
32 .Nd "disk multipath control utility"
33 .Sh SYNOPSIS
34 .Nm
35 .Cm create
36 .Op Fl ARv
37 .Ar name
38 .Ar prov ...
39 .Nm
40 .Cm label
41 .Op Fl ARv
42 .Ar name
43 .Ar prov ...
44 .Nm
45 .Cm configure
46 .Op Fl APRv
47 .Ar name
48 .Nm
49 .Cm add
50 .Op Fl v
51 .Ar name prov
52 .Nm
53 .Cm remove
54 .Op Fl v
55 .Ar name prov
56 .Nm
57 .Cm fail
58 .Op Fl v
59 .Ar name prov
60 .Nm
61 .Cm restore
62 .Op Fl v
63 .Ar name prov
64 .Nm
65 .Cm rotate
66 .Op Fl v
67 .Ar name
68 .Nm
69 .Cm prefer
70 .Op Fl v
71 .Ar name
72 .Ar prov
73 .Nm
74 .Cm getactive
75 .Op Fl v
76 .Ar name
77 .Nm
78 .Cm destroy
79 .Op Fl v
80 .Ar name
81 .Nm
82 .Cm stop
83 .Op Fl v
84 .Ar name
85 .Nm
86 .Cm clear
87 .Op Fl v
88 .Ar prov ...
89 .Nm
90 .Cm list
91 .Nm
92 .Cm status
93 .Nm
94 .Cm load
95 .Nm
96 .Cm unload
97 .Sh DESCRIPTION
98 The
99 .Nm
100 utility is used for device multipath configuration.
101 .Pp
102 The multipath device can be configured using two different methods:
103 .Dq manual
104 or
105 .Dq automatic .
106 When using the
107 .Dq manual
108 method, no metadata are stored on the devices, so the multipath
109 device has to be configured by hand every time it is needed.
110 Additional device paths also won't be detected automatically.
111 The
112 .Dq automatic
113 method uses on-disk metadata to detect device and all it's paths.
114 Metadata use the last sector of the underlying disk device and
115 include device name and UUID.
116 The UUID guarantees uniqueness in a shared storage environment
117 but is in general too cumbersome to use.
118 The name is what is exported via the device interface.
119 .Pp
120 The first argument to
121 .Nm
122 indicates an action to be performed:
123 .Bl -tag -width ".Cm destroy"
124 .It Cm create
125 Create multipath device with
126 .Dq manual
127 method without writing any on-disk metadata.
128 It is up to administrator, how to properly identify device paths.
129 Kernel will only check that all given providers have same media and
130 sector sizes.
131 .Pp
132 .Fl A
133 option enables Active/Active mode,
134 .Fl R
135 option enables Active/Read mode, otherwise Active/Passive mode is used
136 by default.
137 .It Cm label
138 Create multipath device with
139 .Dq automatic
140 method.
141 Label the first given provider with on-disk metadata using the specified
142 .Ar name .
143 The rest of given providers will be retasted to detect these metadata.
144 It reliably protects against specifying unrelated providers.
145 Providers with no matching metadata detected will not be added to the device.
146 .Pp
147 .Fl A
148 option enables Active/Active mode,
149 .Fl R
150 option enables Active/Read mode, otherwise Active/Passive mode is used
151 by default.
152 .It Cm configure
153 Configure the given multipath device.
154 .Pp
155 .Fl A
156 option enables Active/Active mode,
157 .Fl P
158 option enables Active/Passive mode,
159 .Fl R
160 option enables Active/Read mode.
161 .It Cm add
162 Add the given provider as a path to the given multipath device.
163 Should normally be used only for devices created with
164 .Dq manual
165 method, unless you know what you are doing (you are sure that it is another
166 device path, but tasting its metadata in regular
167 .Dq automatic
168 way is not possible).
169 .It Cm remove
170 Remove the given provider as a path from the given multipath device.
171 If the last path removed, the multipath device will be destroyed.
172 .It Cm fail
173 Mark specified provider as a path of the specified multipath device as failed.
174 If there are other paths present, new requests will be forwarded there.
175 .It Cm restore
176 Mark specified provider as a path of the specified multipath device as
177 operational, allowing it to handle requests.
178 .It Cm rotate
179 Change the active provider/path to the next available provider in Active/Passive mode.
180 .It Cm prefer
181 Change the active provider/path to the specified provider in Active/Passive mode.
182 .It Cm getactive
183 Get the currently active provider(s)/path(s).
184 .It Cm destroy
185 Destroy the given multipath device clearing metadata.
186 .It Cm stop
187 Stop the given multipath device without clearing metadata.
188 .It Cm clear
189 Clear metadata on the given provider.
190 .It Cm list
191 See
192 .Xr geom 8 .
193 .It Cm status
194 See
195 .Xr geom 8 .
196 .It Cm load
197 See
198 .Xr geom 8 .
199 .It Cm unload
200 See
201 .Xr geom 8 .
202 .El
203 .Pp
204 .Sh SYSCTL VARIABLES
205 The following
206 .Xr sysctl 8
207 variable can be used to control the behavior of the
208 .Nm MULTIPATH
209 GEOM class.
210 .Bl -tag -width indent
211 .It Va kern.geom.multipath.debug : No 0
212 Debug level of the
213 .Nm MULTIPATH
214 GEOM class.
215 This can be set to 0 (default) or 1 to disable or enable various
216 forms of chattiness.
217 .It Va kern.geom.multipath.exclusive : No 1
218 Open underlying providers exclusively, preventing individual paths access.
219 .El
220 .Sh EXIT STATUS
221 Exit status is 0 on success, and 1 if the command fails.
222 .Sh MULTIPATH ARCHITECTURE
223 .Pp
224 This is a multiple path architecture with no device knowledge or
225 presumptions other than size matching built in.
226 Therefore the user must exercise some care
227 in selecting providers that do indeed represent multiple paths to the
228 same underlying disk device.
229 The reason for this is that there are several
230 criteria across multiple underlying transport types that can
231 .Ar indicate
232 identity, but in all respects such identity can rarely be considered
233 .Ar definitive .
234 .Pp
235 For example, if you use the World Word Port Name of a Fibre Channel
236 disk object you might believe that two disks that have the same WWPN
237 on different paths (or even disjoint fabrics) might be considered
238 the same disk.
239 Nearly always this would be a safe assumption, until
240 you realize that a WWPN, like an Ethernet MAC address, is a soft
241 programmable entity, and that a misconfigured Director Class switch
242 could lead you to believe incorrectly that you have found multiple
243 paths to the same device.
244 This is an extreme and theoretical case, but
245 it is possible enough to indicate that the policy for deciding which
246 of multiple pathnames refer to the same device should be left to the
247 system operator who will use tools and knowledge of their own storage
248 subsystem to make the correct configuration selection.
249 .Pp
250 There are Active/Passive, Active/Read and Active/Active operation modes
251 supported.
252 In Active/Passive mode only one path has I/O moving on it
253 at any point in time.
254 This I/O continues until an I/O is returned with
255 a generic I/O error or a "Nonexistent Device" error.
256 When this occurs, that path is marked FAIL, the next path
257 in a list is selected as active and the failed I/O reissued.
258 In Active/Active mode all paths not marked FAIL may handle I/O same time.
259 Requests are distributed between paths to equalize load.
260 For capable devices it allows to utilize bandwidth of all paths.
261 In Active/Read mode all paths not marked FAIL may handle reads same time,
262 but unlike Active/Active only one path handles write requests at any
263 point in time.
264 It allows to closer follow original write request order if above layer
265 needs it for data consistency (not waiting for requisite write completion
266 before sending dependent write).
267 .Pp
268 When new devices are added to the system the
269 .Nm MULTIPATH
270 GEOM class is given an opportunity to taste these new devices.
271 If a new
272 device has a
273 .Nm MULTIPATH
274 on-disk metadata label, the device is used to either create a new
275 .Nm MULTIPATH
276 GEOM, or been added the list of paths for an existing
277 .Nm MULTIPATH
278 GEOM.
279 .Pp
280 It is this mechanism that works reasonably with
281 .Xr isp 4
282 and
283 .Xr mpt 4
284 based Fibre Channel disk devices.
285 For these devices, when a device disappears
286 (due e.g., to a cable pull or power failure to a switch), the device is
287 proactively marked as gone and I/O to it failed.
288 This causes the
289 .Nm MULTIPATH
290 failure event just described.
291 .Pp
292 When Fibre Channel events inform either
293 .Xr isp 4
294 or
295 .Xr mpt 4
296 host bus adapters that new devices may have arrived (e.g., the arrival
297 of an RSCN event from the Fabric Domain Controller), they can cause
298 a rescan to occur and cause the attachment and configuration of any
299 (now) new devices to occur, causing the taste event described above.
300 .Pp
301 This means that this multipath architecture is not a one-shot path
302 failover, but can be considered to be steady state as long as failed
303 paths are repaired (automatically or otherwise).
304 .Pp
305 Automatic rescanning is not a requirement.
306 Nor is Fibre Channel.
307 The
308 same failover mechanisms work equally well for traditional "Parallel"
309 SCSI but may require manual intervention with
310 .Xr camcontrol 8
311 to cause the reattachment of repaired device links.
312 .Sh EXAMPLES
313 The following example shows how to use
314 .Xr camcontrol 8
315 to find possible multiple path devices and to create a
316 .Nm MULTIPATH
317 GEOM class for them.
318 .Bd -literal -offset indent
319 mysys# camcontrol devlist
320 <ECNCTX @WESTVILLE >   at scbus0 target 0 lun 0 (da0,pass0)
321 <ECNCTX @WESTVILLE >   at scbus0 target 0 lun 1 (da1,pass1)
322 <ECNCTX @WESTVILLE >   at scbus1 target 0 lun 0 (da2,pass2)
323 <ECNCTX @WESTVILLE >   at scbus1 target 0 lun 1 (da3,pass3)
324 mysys# camcontrol inquiry da0 -S
325 ECNTX0LUN000000SER10ac0d01
326 mysys# camcontrol inquiry da2 -S
327 ECNTX0LUN000000SER10ac0d01
328 .Ed
329 .Pp
330 Now that you have used the Serial Number to compare two disk paths
331 it is not entirely unreasonable to conclude that these are multiple
332 paths to the same device.
333 However, only the user who is familiar
334 with their storage is qualified to make this judgement.
335 .Pp
336 You can then use the
337 .Nm
338 command to label and create a
339 .Nm MULTIPATH
340 GEOM provider named
341 .Ar FRED .
342 .Bd -literal -offset indent
343 gmultipath label -v FRED /dev/da0 /dev/da2
344 disklabel -Brw /dev/multipath/FRED auto
345 newfs /dev/multipath/FREDa
346 mount /dev/multipath/FREDa /mnt....
347 .Ed
348 .Pp
349 The resultant console output looks something like:
350 .Bd -literal -offset indent
351 GEOM_MULTIPATH: da0 added to FRED
352 GEOM_MULTIPATH: da0 is now active path in FRED
353 GEOM_MULTIPATH: da2 added to FRED
354 .Ed
355 .Sh SEE ALSO
356 .Xr geom 4 ,
357 .Xr isp 4 ,
358 .Xr mpt 4 ,
359 .Xr loader.conf 5 ,
360 .Xr camcontrol 8 ,
361 .Xr geom 8 ,
362 .Xr mount 8 ,
363 .Xr newfs 8 ,
364 .Xr sysctl 8
365 .Sh AUTHOR
366 .An Matthew Jacob Aq mjacob@FreeBSD.org
367 .An Alexander Motin Aq mav@FreeBSD.org