]>
Commit | Line | Data |
---|---|---|
52826846 | 1 | .\" -*- nroff -*- |
e0d19036 | 2 | .TH MDADM 8 |
52826846 | 3 | .SH NAME |
9a9dab36 | 4 | mdadm \- manage MD devices |
cd29a5c8 NB |
5 | .I aka |
6 | Linux Software Raid. | |
7 | ||
52826846 NB |
8 | .SH SYNOPSIS |
9 | ||
e0d19036 | 10 | .BI mdadm " [mode] <raiddevice> [options] <component-devices>" |
52826846 NB |
11 | |
12 | .SH DESCRIPTION | |
13 | RAID devices are virtual devices created from two or more | |
cd29a5c8 NB |
14 | real block devices. This allows multiple devices (typically disk |
15 | drives or partitions there-of) to be combined into a single device to | |
16 | hold (for example) a single filesystem. | |
2d465520 | 17 | Some RAID levels include redundancy and so can survive some degree of |
cd29a5c8 NB |
18 | device failure. |
19 | ||
2d465520 NB |
20 | Linux Software RAID devices are implemented through the md (Multiple |
21 | Devices) device driver. | |
cd29a5c8 NB |
22 | |
23 | Currently, Linux supports | |
24 | .B LINEAR | |
25 | md devices, | |
26 | .B RAID0 | |
27 | (striping), | |
28 | .B RAID1 | |
29 | (mirroring), | |
30 | .B RAID4 | |
31 | and | |
32 | .B RAID5. | |
33 | ||
34 | Recent kernels (2002) also support a mode known as | |
35 | .BR MULTIPATH . | |
9a9dab36 | 36 | .B mdadm |
e0d19036 | 37 | only provides limited support for MULTIPATH as yet. |
52826846 | 38 | |
9a9dab36 | 39 | .B mdadm |
11a3e71d NB |
40 | is a program that can be used to create, manage, and monitor |
41 | MD devices. As | |
cd29a5c8 NB |
42 | such it provides a similar set of functionality to the |
43 | .B raidtools | |
44 | packages. | |
45 | The key differences between | |
9a9dab36 | 46 | .B mdadm |
cd29a5c8 NB |
47 | and |
48 | .B raidtools | |
49 | are: | |
50 | .IP \(bu 4 | |
9a9dab36 | 51 | .B mdadm |
cd29a5c8 NB |
52 | is a single program and not a collection of programs. |
53 | .IP \(bu 4 | |
9a9dab36 | 54 | .B mdadm |
cd29a5c8 | 55 | can perform (almost) all of its functions without having a |
5787fa49 | 56 | configuration file and does not use one by default. Also |
2d465520 NB |
57 | .B mdadm |
58 | helps with management of the configuration | |
cd29a5c8 NB |
59 | file. |
60 | .IP \(bu 4 | |
9a9dab36 | 61 | .B mdadm |
e0d19036 | 62 | can provide information about your arrays (through Query, Detail, and Examine) |
cd29a5c8 NB |
63 | that |
64 | .B raidtools | |
65 | cannot. | |
5787fa49 NB |
66 | .P |
67 | .I mdadm | |
68 | does not use | |
69 | .IR /etc/raidtab , | |
70 | the | |
71 | .B raidtools | |
72 | configuration file, at all. It has a different configuration file | |
73 | with a different format and an different purpose. | |
52826846 NB |
74 | |
75 | .SH MODES | |
e0d19036 | 76 | mdadm has 6 major modes of operation: |
cd29a5c8 NB |
77 | .TP |
78 | .B Assemble | |
79 | Assemble the parts of a previously created | |
52826846 NB |
80 | array into an active array. Components can be explicitly given |
81 | or can be searched for. | |
9a9dab36 | 82 | .B mdadm |
cd29a5c8 NB |
83 | checks that the components |
84 | do form a bona fide array, and can, on request, fiddle superblock | |
85 | information so as to assemble a faulty array. | |
86 | ||
87 | .TP | |
88 | .B Build | |
89 | Build a legacy array without per-device superblocks. | |
90 | ||
91 | .TP | |
92 | .B Create | |
93 | Create a new array with per-device superblocks. | |
94 | '''It can progress | |
95 | '''in several step create-add-add-run or it can all happen with one command. | |
96 | ||
97 | .TP | |
e0d19036 NB |
98 | .B Manage |
99 | This is for doing things to specific components of an array such as | |
100 | adding new spares and removing faulty devices. | |
cd29a5c8 NB |
101 | |
102 | .TP | |
e0d19036 NB |
103 | .B Misc |
104 | This mode allows operations on independent devices such as examine MD | |
105 | superblocks, erasing old superblocks and stopping active arrays. | |
cd29a5c8 NB |
106 | |
107 | .TP | |
108 | .B "Follow or Monitor" | |
5787fa49 NB |
109 | Monitor one or more md devices and act on any state changes. This is |
110 | only meaningful for raid1, raid5 or multipath arrays as only these have | |
111 | interesting state. raid0 or linear never have missing, spare, or | |
112 | failed drives, so there is nothing to monitor. | |
113 | ||
cd29a5c8 | 114 | |
52826846 NB |
115 | .SH OPTIONS |
116 | ||
117 | Available options are: | |
118 | ||
cd29a5c8 NB |
119 | .TP |
120 | .BR -A ", " --assemble | |
2d465520 | 121 | Assemble a pre-existing array. |
52826846 | 122 | |
cd29a5c8 NB |
123 | .TP |
124 | .BR -B ", " --build | |
125 | Build a legacy array without superblocks. | |
52826846 | 126 | |
cd29a5c8 NB |
127 | .TP |
128 | .BR -C ", " --create | |
129 | Create a new array. | |
52826846 | 130 | |
e0d19036 NB |
131 | .TP |
132 | .BR -Q ", " --query | |
133 | Examine a device to see | |
134 | (1) if it is an md device and (2) if it is a component of an md | |
135 | array. | |
136 | Information about what is discovered is presented. | |
137 | ||
cd29a5c8 NB |
138 | .TP |
139 | .BR -D ", " --detail | |
140 | Print detail of one or more md devices. | |
52826846 | 141 | |
cd29a5c8 NB |
142 | .TP |
143 | .BR -E ", " --examine | |
144 | Print content of md superblock on device(s). | |
52826846 | 145 | |
cd29a5c8 NB |
146 | .TP |
147 | .BR -F ", " --follow ", " --monitor | |
148 | Select | |
149 | .B Monitor | |
150 | mode. | |
52826846 | 151 | |
cd29a5c8 NB |
152 | .TP |
153 | .BR -h ", " --help | |
154 | Display help message or, after above option, mode specific help message. | |
52826846 | 155 | |
cd29a5c8 NB |
156 | .TP |
157 | .BR -V ", " --version | |
9a9dab36 | 158 | Print version information for mdadm. |
52826846 | 159 | |
cd29a5c8 NB |
160 | .TP |
161 | .BR -v ", " --verbose | |
162 | Be more verbose about what is happening. | |
52826846 | 163 | |
cd29a5c8 NB |
164 | .TP |
165 | .BR -b ", " --brief | |
166 | Be less verbose. This is used with | |
167 | .B --detail | |
168 | and | |
169 | .BR --examine . | |
52826846 | 170 | |
e0d19036 NB |
171 | .TP |
172 | .BR -f ", " --force | |
173 | Be more forceful about certain operations. See the various modes of | |
174 | the exact meaning of this option in different contexts. | |
175 | ||
176 | .TP | |
177 | .BR -c ", " --config= | |
178 | Specify the config file. Default is | |
179 | .BR /etc/mdadm.conf . | |
5787fa49 NB |
180 | If the config file given is |
181 | .B partitions | |
182 | then nothing will be read, but | |
183 | .I mdadm | |
184 | will act as though the config file contained exactly | |
185 | .B "DEVICE partitions" | |
186 | and will read | |
187 | .B /proc/partitions | |
188 | to find a list of devices to scan. | |
e0d19036 NB |
189 | |
190 | .TP | |
191 | .BR -s ", " --scan | |
192 | scan config file or | |
193 | .B /proc/mdstat | |
194 | for missing information. | |
195 | In general, this option gives | |
196 | .B mdadm | |
197 | permission to get any missing information, like component devices, | |
198 | array devices, array identities, and alert destination from the | |
199 | configuration file: | |
200 | .BR /etc/mdadm.conf . | |
201 | One exception is MISC mode when using | |
202 | .B --detail | |
203 | or | |
204 | .B --stop | |
205 | in which case | |
206 | .B --scan | |
207 | says to get a list of array devices from | |
208 | .BR /proc/mdstat . | |
209 | ||
cd29a5c8 | 210 | .SH For create or build: |
52826846 | 211 | |
cd29a5c8 NB |
212 | .TP |
213 | .BR -c ", " --chunk= | |
214 | Specify chunk size of kibibytes. The default is 64. | |
52826846 | 215 | |
cd29a5c8 NB |
216 | .TP |
217 | .BR --rounding= | |
218 | Specify rounding factor for linear array (==chunk size) | |
52826846 | 219 | |
cd29a5c8 NB |
220 | .TP |
221 | .BR -l ", " --level= | |
222 | Set raid level. Options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid5, 4, | |
c913b90e | 223 | raid5, 5, multipath, mp. Obviously some of these are synonymous. |
cd29a5c8 | 224 | Only the first 4 are valid when Building. |
52826846 | 225 | |
cd29a5c8 NB |
226 | .TP |
227 | .BR -p ", " --parity= | |
228 | Set raid5 parity algorithm. Options are: | |
2d465520 NB |
229 | left-asymmetric, |
230 | left-symmetric, | |
231 | right-asymmetric, | |
232 | right-symmetric, | |
233 | la, ra, ls, rs. The default is left-symmetric. | |
52826846 | 234 | |
cd29a5c8 NB |
235 | .TP |
236 | .BR --layout= | |
237 | same as --parity | |
52826846 | 238 | |
cd29a5c8 | 239 | .TP |
b83d95f3 | 240 | .BR -n ", " --raid-devices= |
5787fa49 NB |
241 | Specify the number of active devices in the array. This, plus the |
242 | number of spare devices (see below) must equal the number of | |
243 | .I component-devices | |
244 | (including | |
245 | .B missing | |
246 | devices) that are listed on the command line. | |
cd29a5c8 NB |
247 | |
248 | .TP | |
b83d95f3 | 249 | .BR -x ", " --spare-devices= |
5787fa49 NB |
250 | Specify the number of spare (eXtra) devices in the initial array. |
251 | Spares can also be added | |
252 | and removed later. The number of component devices listed | |
253 | on the command line must equal the number of raid devices plus the | |
254 | number of spare devices. | |
255 | ||
cd29a5c8 NB |
256 | |
257 | .TP | |
258 | .BR -z ", " --size= | |
259 | Amount (in Kibibytes) of space to use from each drive in RAID1/4/5. | |
260 | This must be a multiple of the chunk size, and must leave about 128Kb | |
261 | of space at the end of the drive for the RAID superblock. | |
262 | If this is not specified | |
263 | (as it normally is not) the smallest drive (or partition) sets the | |
264 | size, though if there is a variance among the drives of greater than 1%, a warning is | |
265 | issued. | |
52826846 NB |
266 | |
267 | .SH For assemble: | |
268 | ||
cd29a5c8 NB |
269 | .TP |
270 | .BR -u ", " --uuid= | |
271 | uuid of array to assemble. Devices which don't have this uuid are | |
272 | excluded | |
273 | ||
274 | .TP | |
275 | .BR -m ", " --super-minor= | |
276 | Minor number of device that array was created for. Devices which | |
277 | don't have this minor number are excluded. If you create an array as | |
2d465520 | 278 | /dev/md1, then all superblocks will contain the minor number 1, even if |
cd29a5c8 NB |
279 | the array is later assembled as /dev/md2. |
280 | ||
cd29a5c8 NB |
281 | .TP |
282 | .BR -f ", " --force | |
52826846 NB |
283 | Assemble the array even if some superblocks appear out-of-date |
284 | ||
cd29a5c8 NB |
285 | .TP |
286 | .BR -R ", " --run | |
287 | Attempt to start the array even if fewer drives were given than are | |
288 | needed for a full array. Normally if not all drives are found and | |
289 | .B --scan | |
290 | is not used, then the array will be assembled but not started. | |
291 | With | |
292 | .B --run | |
293 | an attempt will be made to start it anyway. | |
52826846 | 294 | |
5787fa49 NB |
295 | .TP |
296 | .BR -U ", " --update= | |
297 | Update the superblock on each device while assembling the array. The | |
298 | argument given to this flag can be either | |
299 | .B sparc2.2 | |
300 | or | |
301 | .BR super-minor . | |
302 | ||
303 | The | |
304 | .B sparc2.2 | |
305 | option will adjust the superblock of an array what was created on a Sparc | |
306 | machine running a patched 2.2 Linux kernel. This kernel got the | |
307 | alignment of part of the superblock wrong. You can use the | |
308 | .B "--examine --sparc2.2" | |
309 | option to | |
310 | .I mdadm | |
311 | to see what effect this would have. | |
312 | ||
313 | The | |
314 | .B super-minor | |
315 | option will update the | |
316 | .B "prefered minor" | |
317 | field on each superblock to match the minor number of the array being | |
318 | assembled. This is not need on 2.6 and later kernels as they make | |
319 | this adjustment automatically. | |
320 | ||
321 | ||
e0d19036 | 322 | .SH For Manage mode: |
52826846 | 323 | |
cd29a5c8 NB |
324 | .TP |
325 | .BR -a ", " --add | |
326 | '''add, or | |
327 | hotadd listed devices. | |
52826846 | 328 | |
cd29a5c8 NB |
329 | .TP |
330 | .BR -r ", " --remove | |
2d465520 | 331 | remove listed devices. They must not be active. i.e. they should |
cd29a5c8 | 332 | be failed or spare devices. |
52826846 | 333 | |
cd29a5c8 NB |
334 | .TP |
335 | .BR -f ", " --fail | |
336 | mark listed devices as faulty. | |
52826846 | 337 | |
cd29a5c8 NB |
338 | .TP |
339 | .BR --set-faulty | |
340 | same as --fail. | |
52826846 | 341 | |
5787fa49 NB |
342 | .SH For Examine mode: |
343 | ||
344 | .TP | |
345 | .B --sparc2.2 | |
346 | In an array was created on a 2.2 Linux kernel patched with RAID | |
347 | support, the superblock will have been created incorrectly, or at | |
348 | least incompatibly with 2.4 and later kernels. Using the | |
349 | .B --sparc2.2 | |
350 | flag with | |
351 | .B --examine | |
352 | will fix the superblock before displaying it. If this appears to do | |
353 | the right thing, then the array can be successfully assembled using | |
354 | .BR "--assemble --update=sparc2.2" . | |
355 | ||
e0d19036 NB |
356 | .SH For Misc mode: |
357 | ||
cd29a5c8 NB |
358 | .TP |
359 | .BR -R ", " --run | |
360 | start a partially built array. | |
52826846 | 361 | |
cd29a5c8 NB |
362 | .TP |
363 | .BR -S ", " --stop | |
364 | deactivate array, releasing all resources. | |
52826846 | 365 | |
cd29a5c8 NB |
366 | .TP |
367 | .BR -o ", " --readonly | |
368 | mark array as readonly. | |
52826846 | 369 | |
cd29a5c8 NB |
370 | .TP |
371 | .BR -w ", " --readwrite | |
372 | mark array as readwrite. | |
52826846 | 373 | |
e0d19036 NB |
374 | .TP |
375 | .B --zero-superblock | |
376 | If the device contains a valid md superblock, the block is | |
377 | over-written with zeros. With | |
378 | --force | |
379 | the block where the superblock would be is over-written even if it | |
380 | doesn't appear to be valid. | |
52826846 | 381 | |
e0d19036 NB |
382 | .SH For Monitor mode: |
383 | .TP | |
384 | .BR -m ", " --mail | |
385 | Give a mail address to send alerts to. | |
386 | ||
387 | .TP | |
388 | .BR -p ", " --program ", " --alert | |
389 | Give a program to be run whenever an event is detected. | |
390 | ||
391 | .TP | |
392 | .BR -d ", " --delay | |
393 | Give a delay in seconds. | |
394 | .B mdadm | |
395 | polls the md arrays and then waits this many seconds before polling | |
396 | again. The default is 60 seconds. | |
397 | ||
398 | .SH ASSEMBLE MODE | |
52826846 | 399 | |
cd29a5c8 NB |
400 | .HP 12 |
401 | Usage: | |
9a9dab36 | 402 | .B mdadm --assemble |
5787fa49 NB |
403 | .I md-device options-and-component-devices... |
404 | .HP 12 | |
405 | Usage: | |
406 | .B mdadm --assemble --scan | |
407 | .I md-devices-and-options... | |
cd29a5c8 NB |
408 | .HP 12 |
409 | Usage: | |
9a9dab36 | 410 | .B mdadm --assemble --scan |
cd29a5c8 | 411 | .I options... |
52826846 | 412 | |
cd29a5c8 | 413 | .PP |
52826846 | 414 | This usage assembles one or more raid arrays from pre-existing components. |
9a9dab36 | 415 | For each array, mdadm needs to know the md device, the identity of the |
e0d19036 | 416 | array, and a number of component-devices. These can be found in a number of ways. |
52826846 | 417 | |
5787fa49 NB |
418 | In the first usage example (without the |
419 | .BR --scan ) | |
420 | the first device given is the md device. | |
421 | In the second usage example, all devices listed are treated as md | |
422 | devices and assembly is attempted. | |
423 | In the third (where no devices are listed) all md devices that are | |
424 | listed in the configuration file are assembled. | |
52826846 | 425 | |
cd29a5c8 | 426 | The identity can be given with the |
52826846 | 427 | .B --uuid |
cd29a5c8 NB |
428 | option, with the |
429 | .B --super-minor | |
5787fa49 | 430 | option, can be found in the config file, or will be taken from the |
e0d19036 | 431 | super block on the first component-device listed on the command line. |
52826846 NB |
432 | |
433 | Devices can be given on the | |
434 | .B --assemble | |
5787fa49 NB |
435 | command line or in the config file. Only devices which have an md |
436 | superblock which contains the right identity will be considered for | |
437 | any array. | |
52826846 NB |
438 | |
439 | The config file is only used if explicitly named with | |
440 | .B --config | |
441 | or requested with | |
442 | .B --scan. | |
443 | In the later case, | |
9a9dab36 | 444 | .B /etc/mdadm.conf |
52826846 NB |
445 | is used. |
446 | ||
447 | If | |
448 | .B --scan | |
cd29a5c8 NB |
449 | is not given, then the config file will only be used to find the |
450 | identity of md arrays. | |
52826846 | 451 | |
2d465520 | 452 | Normally the array will be started after it is assembled. However if |
cd29a5c8 | 453 | .B --scan |
2d465520 | 454 | is not given and insufficient drives were listed to start a complete |
cd29a5c8 NB |
455 | (non-degraded) array, then the array is not started (to guard against |
456 | usage errors). To insist that the array be started in this case (as | |
457 | may work for RAID1 or RAID5), give the | |
458 | .B --run | |
459 | flag. | |
52826846 | 460 | |
52826846 | 461 | |
cd29a5c8 | 462 | .SH BUILD MODE |
52826846 | 463 | |
cd29a5c8 NB |
464 | .HP 12 |
465 | Usage: | |
9a9dab36 | 466 | .B mdadm --build |
cd29a5c8 NB |
467 | .I device |
468 | .BI --chunk= X | |
469 | .BI --level= Y | |
b83d95f3 | 470 | .BI --raid-devices= Z |
cd29a5c8 NB |
471 | .I devices |
472 | ||
473 | .PP | |
52826846 | 474 | This usage is similar to |
cd29a5c8 | 475 | .BR --create . |
52826846 | 476 | The difference is that it creates a legacy array without a superblock. With |
cd29a5c8 | 477 | these arrays there is no difference between initially creating the array and |
52826846 NB |
478 | subsequently assembling the array, except that hopefully there is useful |
479 | data there in the second case. | |
480 | ||
cd29a5c8 NB |
481 | The level may only be 0, raid0, or linear. All devices must be listed |
482 | and the array will be started once complete. | |
483 | ||
484 | .SH CREATE MODE | |
485 | ||
486 | .HP 12 | |
487 | Usage: | |
9a9dab36 | 488 | .B mdadm --create |
cd29a5c8 NB |
489 | .I device |
490 | .BI --chunk= X | |
491 | .BI --level= Y | |
492 | .br | |
b83d95f3 | 493 | .BI --raid-devices= Z |
cd29a5c8 NB |
494 | .I devices |
495 | ||
496 | .PP | |
497 | This usage will initialise a new md array, associate some devices with | |
498 | it, and activate the array. | |
499 | ||
500 | As devices are added, they are checked to see if they contain raid | |
2d465520 | 501 | superblocks or filesystems. They are also checked to see if the variance in |
cd29a5c8 NB |
502 | device size exceeds 1%. |
503 | ||
504 | If any discrepancy is found, the array will not automatically be run, though | |
505 | the presence of a | |
506 | .B --run | |
507 | can override this caution. | |
508 | ||
2d465520 NB |
509 | To create a "degraded" array in which some devices are missing, simply |
510 | give the word | |
511 | .B missing | |
512 | in place of a device name. This will cause | |
513 | .B mdadm | |
514 | to leave the corresponding slot in the array empty. | |
515 | For a RAID4 or RAID5 array at most one slot can be | |
516 | .BR missing . | |
517 | For a RAID1 array, only one real device needs to be given. All of the | |
518 | others can be | |
519 | .BR missing . | |
520 | ||
cd29a5c8 NB |
521 | '''If the |
522 | '''.B --size | |
e0d19036 | 523 | '''option is given, it is not necessary to list any component-devices in this command. |
cd29a5c8 NB |
524 | '''They can be added later, before a |
525 | '''.B --run. | |
526 | '''If no | |
527 | '''.B --size | |
528 | '''is given, the apparent size of the smallest drive given is used. | |
529 | ||
530 | The General Management options that are valid with --create are: | |
531 | .TP | |
532 | .B --run | |
533 | insist of running the array even if some devices look like they might | |
534 | be in use. | |
535 | ||
536 | .TP | |
537 | .B --readonly | |
538 | start the array readonly - not supported yet. | |
52826846 | 539 | |
e0d19036 | 540 | .SH MANAGE MODE |
cd29a5c8 NB |
541 | .HP 12 |
542 | Usage: | |
e0d19036 NB |
543 | .B mdadm |
544 | .I device | |
545 | .I options... devices... | |
cd29a5c8 NB |
546 | .PP |
547 | ||
e0d19036 NB |
548 | This usage will allow individual devices in an array to be failed, |
549 | removed or added. It is possible to perform multiple operations with | |
550 | on command. For example: | |
551 | .br | |
5787fa49 | 552 | .B " mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 -a /dev/hda1" |
e0d19036 NB |
553 | .br |
554 | will firstly mark | |
555 | .B /dev/hda1 | |
556 | as faulty in | |
557 | .B /dev/md0 | |
558 | and will then remove it from the array and finally add it back | |
2d465520 | 559 | in as a spare. However only one md array can be affected by a single |
e0d19036 NB |
560 | command. |
561 | ||
562 | .SH MISC MODE | |
563 | .HP 12 | |
564 | Usage: | |
9a9dab36 | 565 | .B mdadm |
e0d19036 NB |
566 | .I options ... |
567 | .I devices ... | |
568 | .PP | |
cd29a5c8 | 569 | |
e0d19036 NB |
570 | MISC mode includes a number if distinct operations that |
571 | operate on distinct devices. The operations are: | |
572 | .TP | |
573 | --query | |
574 | The device is examined to see if it is | |
575 | (1) an active md array, or | |
576 | (2) a component of an md array. | |
577 | The information discovered is reported. | |
578 | ||
579 | .TP | |
580 | --detail | |
2d465520 NB |
581 | The device should be an active md device. |
582 | .B mdadm | |
583 | will display a detailed description of the array. | |
cd29a5c8 | 584 | .B --brief |
2d465520 NB |
585 | or |
586 | .B --scan | |
587 | will cause the output to be less detailed and the format to be | |
e0d19036 | 588 | suitable for inclusion in |
9a9dab36 | 589 | .BR /etc/mdadm.conf . |
cd29a5c8 | 590 | |
e0d19036 NB |
591 | .TP |
592 | --examine | |
2d465520 NB |
593 | The device should be a component of an md array. |
594 | .B mdadm | |
595 | will read the md superblock of the device and display the contents. | |
e0d19036 NB |
596 | If |
597 | .B --brief | |
598 | is given, or | |
599 | .B --scan | |
600 | then multiple devices that are components of the one array | |
601 | are grouped together and reported in a single entry suitable | |
602 | for inclusion in | |
603 | .BR /etc/mdadm.conf . | |
604 | ||
2d465520 | 605 | Having |
e0d19036 NB |
606 | .B --scan |
607 | without listing any devices will cause all devices listed in the | |
608 | config file to be examined. | |
609 | ||
610 | .TP | |
611 | --stop | |
612 | This devices should active md arrays which will be deactivated, if | |
613 | they are not currently in use. | |
614 | ||
615 | .TP | |
616 | --run | |
617 | This will fully activate a partially assembled md array. | |
618 | ||
619 | .TP | |
620 | --readonly | |
621 | This will mark an active array as read-only, providing that it is | |
622 | not currently being used. | |
623 | ||
624 | .TP | |
625 | --readwrite | |
626 | This will change a | |
627 | .B readonly | |
628 | array back to being read/write. | |
629 | ||
2d465520 NB |
630 | .TP |
631 | --scan | |
632 | For all operations except | |
633 | .BR --examine , | |
634 | .B --scan | |
635 | will cause the operation to be applied to all arrays listed in | |
636 | .BR /proc/mdstat . | |
637 | For | |
638 | .BR --examine, | |
639 | .B --scan | |
640 | causes all devices listed in the config file to be examined. | |
641 | ||
642 | ||
e0d19036 NB |
643 | .SH MONITOR MODE |
644 | ||
cd29a5c8 NB |
645 | .HP 12 |
646 | Usage: | |
e0d19036 NB |
647 | .B mdadm --monitor |
648 | .I options... devices... | |
649 | ||
cd29a5c8 | 650 | .PP |
e0d19036 NB |
651 | This usage causes |
652 | .B mdadm | |
653 | to periodically poll a number of md arrays and to report on any events | |
654 | noticed. | |
655 | .B mdadm | |
656 | will never exit once it decides that there are arrays to be checked, | |
657 | so it should normally be run in the background. | |
658 | ||
2d465520 NB |
659 | As well as reporting events, |
660 | .B mdadm | |
661 | may move a spare drive from one array to another if they are in the | |
662 | same | |
663 | .B spare-group | |
664 | and if the destination array has a failed drive but not spares. | |
665 | ||
e0d19036 NB |
666 | If any devices are listed on the command line, |
667 | .B mdadm | |
668 | will only monitor those devices. Otherwise all arrays listed in the | |
669 | configuration file will be monitored. Further, if | |
670 | .B --scan | |
671 | is given, then any other md devices that appear in | |
672 | .B /proc/mdstat | |
673 | will also be monitored. | |
674 | ||
675 | The result of monitoring the arrays is the generation of events. | |
bd526cee | 676 | These events are passed to a separate program (if specified) and may |
2d465520 | 677 | be mailed to a given E-mail address. |
e0d19036 | 678 | |
bd526cee NB |
679 | When passing event to program, the program is run once for each event |
680 | and is given 2 or 3 command-line arguements. The first is the | |
681 | name of the event (see below). The second is the name of the | |
682 | md device which is affected, and the third is the name of a related | |
683 | device if relevant, such as a component device that has failed. | |
cd29a5c8 NB |
684 | |
685 | If | |
686 | .B --scan | |
e0d19036 NB |
687 | is given, then a program or an E-mail address must be specified on the |
688 | command line or in the config file. If neither are available, then | |
689 | .B mdadm | |
690 | will not monitor anything. | |
691 | Without | |
cd29a5c8 | 692 | .B --scan |
e0d19036 | 693 | .B mdadm |
2d465520 | 694 | will continue monitoring as long as something was found to monitor. If |
e0d19036 NB |
695 | no program or email is given, then each event is reported to |
696 | .BR stdout . | |
cd29a5c8 | 697 | |
e0d19036 NB |
698 | The different events are: |
699 | ||
700 | .RS 4 | |
701 | .TP | |
702 | .B DeviceDisappeared | |
2d465520 | 703 | An md array which previously was configured appears to no longer be |
e0d19036 NB |
704 | configured. |
705 | ||
706 | .TP | |
707 | .B RebuildStarted | |
708 | An md array started reconstruction. | |
709 | ||
710 | .TP | |
711 | .BI Rebuild NN | |
712 | Where | |
713 | .I NN | |
714 | is 20, 40, 60, or 80, this indicates that rebuild has passed that many | |
715 | percentage of the total. | |
716 | ||
717 | .TP | |
718 | .B Fail | |
719 | An active component device of an array has been marked as faulty. | |
720 | ||
721 | .TP | |
722 | .B FailSpare | |
723 | A spare component device which was being rebuilt to replace a faulty | |
724 | device has failed. | |
725 | ||
726 | .TP | |
727 | .B SpareActive | |
728 | A spare component device which was being rebuilt to replace a faulty | |
729 | device as been successfully rebuild and has been made active. | |
730 | ||
731 | .TP | |
732 | .B NewArray | |
733 | A new md array has been detected in the | |
734 | .B /proc/mdstat | |
735 | file. | |
736 | ||
737 | .TP | |
738 | .B MoveSpare | |
739 | A spare drive has been moved from one array in a | |
740 | .B spare-group | |
741 | to another to allow a failed drive to be replaced. | |
742 | ||
743 | .RE | |
744 | ||
745 | Only | |
746 | .B Fail | |
747 | and | |
748 | .B FailSpare | |
749 | cause Email to be sent. All events cause the program to be run. | |
750 | The program is run with two or three arguments, they being the event | |
751 | name, the array device and possibly a second device. | |
752 | ||
753 | Each event has an associated array device (e.g. | |
754 | .BR /dev/md1 ) | |
755 | and possibly a second device. For | |
756 | .BR Fail , | |
757 | .BR FailSpare , | |
758 | and | |
759 | .B SpareActive | |
760 | the second device is the relevant component device. | |
761 | For | |
762 | .B MoveSpare | |
763 | the second device is the array that the spare was moved from. | |
764 | ||
765 | For | |
766 | .B mdadm | |
767 | to move spares from one array to another, the different arrays need to | |
768 | be labelled with the same | |
769 | .B spare-group | |
770 | in the configuration file. The | |
771 | .B spare-group | |
772 | name can be any string. It is only necessary that different spare | |
2d465520 | 773 | groups use different names. |
e0d19036 NB |
774 | |
775 | When | |
9a9dab36 | 776 | .B mdadm |
e0d19036 NB |
777 | detects that an array which is in a spare group has fewer active |
778 | devices than necessary for the complete array, and has no spare | |
779 | devices, it will look for another array in the same spare group that | |
780 | has a full complement of working drive and a spare. It will then | |
781 | attempt to remove the spare from the second drive and add it to the | |
782 | first. | |
783 | If the removal succeeds but the adding fails, then it is added back to | |
784 | the original array. | |
785 | ||
2d465520 NB |
786 | .SH EXAMPLES |
787 | ||
5787fa49 | 788 | .B " mdadm --query /dev/name-of-device" |
2d465520 | 789 | .br |
5787fa49 NB |
790 | This will find out if a given device is a raid array, or is part of |
791 | one, and will provide brief information about the device. | |
2d465520 | 792 | |
5787fa49 | 793 | .B " mdadm --assemble --scan" |
2d465520 | 794 | .br |
5787fa49 NB |
795 | This will assemble and start all arrays listed in the standard confile |
796 | file. This command will typically go in a system startup file. | |
2d465520 | 797 | |
2d465520 | 798 | .B " mdadm --stop --scan" |
5787fa49 NB |
799 | .br |
800 | This will shut down all array that can be shut down (i.e. are not | |
801 | currently in used). This will typically going in a system shutdown script. | |
2d465520 | 802 | |
5787fa49 | 803 | .B " mdadm --follow --scan --delay=120" |
2d465520 | 804 | .br |
5787fa49 NB |
805 | If (and only if) there is an Email address or program given in the |
806 | standard config file, then | |
807 | monitor the status of all arrays listed in that file by | |
808 | polling them ever 2 minutes. | |
2d465520 | 809 | |
5787fa49 | 810 | .B " mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1" |
2d465520 | 811 | .br |
5787fa49 | 812 | Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1. |
2d465520 | 813 | |
2d465520 NB |
814 | .br |
815 | .B " echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > mdadm.conf" | |
816 | .br | |
817 | .B " mdadm --detail --scan >> mdadm.conf" | |
818 | .br | |
5787fa49 NB |
819 | This will create a prototype config file that describes currently |
820 | active arrays that are known to be made from partitions of IDE or SCSI drives. | |
2d465520 NB |
821 | This file should be reviewed before being used as it may |
822 | contain unwanted detail. | |
823 | ||
2d465520 NB |
824 | .B " echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' > mdadm.conf" |
825 | .br | |
5787fa49 NB |
826 | .B " mdadm --examine --scan --config=mdadm.conf >> mdadm.conf" |
827 | .ber | |
828 | This will find what arrays could be assembled from existign IDE and | |
829 | SCSI whole drives (not partitions) and store the information is the | |
830 | format of a config file. | |
2d465520 NB |
831 | This file is very likely to contain unwanted detail, particularly |
832 | the | |
833 | .B devices= | |
5787fa49 NB |
834 | entries. It should be reviewed and edited before being used as an |
835 | actual config file. | |
2d465520 | 836 | |
5787fa49 | 837 | .B " mdadm --examine --brief --scan --config=partitions" |
2d465520 | 838 | .br |
5787fa49 NB |
839 | .B " mdadm -Ebsc partitions" |
840 | .br | |
841 | Create a list of devices by reading | |
842 | .BR /proc/partitions , | |
843 | scan these for RAID superblocks, and printout a brief listing of all | |
844 | that was found. | |
2d465520 | 845 | |
5787fa49 | 846 | .B " mdadm -Ac partitions -m 0 /dev/md0" |
2d465520 | 847 | .br |
5787fa49 NB |
848 | Scan all partitions and devices listed in |
849 | .BR /proc/partitions | |
850 | and assemble | |
851 | .B /dev/md0 | |
852 | out of all such devices with a RAID superblock with a minor number of 0. | |
2d465520 | 853 | |
5787fa49 | 854 | .B " mdadm --create --help" |
2d465520 | 855 | .br |
5787fa49 | 856 | Providew help about the Create mode. |
2d465520 | 857 | |
5787fa49 NB |
858 | .B " mdadm --config --help" |
859 | .br | |
860 | Provide help about the format of the config file. | |
2d465520 | 861 | |
5787fa49 NB |
862 | .B " mdadm --help" |
863 | .br | |
864 | Provide general help. | |
cd29a5c8 | 865 | |
cd29a5c8 NB |
866 | |
867 | .SH FILES | |
868 | ||
869 | .SS /proc/mdstat | |
870 | ||
871 | If you're using the | |
872 | .B /proc | |
873 | filesystem, | |
874 | .B /proc/mdstat | |
2d465520 NB |
875 | lists all active md devices with information about them. |
876 | .B mdadm | |
877 | uses this to find arrays when | |
878 | .B --scan | |
879 | is given in Misc mode, and to monitor array reconstruction | |
880 | on Monitor mode. | |
881 | ||
cd29a5c8 | 882 | |
9a9dab36 | 883 | .SS /etc/mdadm.conf |
cd29a5c8 | 884 | |
11a3e71d NB |
885 | The config file lists which devices may be scanned to see if |
886 | they contain MD super block, and gives identifying information | |
887 | (e.g. UUID) about known MD arrays. See | |
888 | .BR mdadm.conf (5) | |
889 | for more details. | |
cd29a5c8 | 890 | |
52826846 | 891 | |
2d465520 NB |
892 | .SH NOTE |
893 | .B mdadm | |
894 | was previously known as | |
895 | .BR mdctl . | |
896 | ||
52826846 | 897 | .SH SEE ALSO |
cd29a5c8 NB |
898 | For information on the various levels of |
899 | RAID, check out: | |
900 | ||
901 | .IP | |
902 | .UR http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/ | |
903 | http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/ | |
904 | .UE | |
905 | .PP | |
906 | for new releases of the RAID driver check out: | |
907 | ||
908 | .IP | |
909 | .UR ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches | |
910 | ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches | |
911 | .UE | |
912 | .PP | |
913 | or | |
914 | .IP | |
915 | .UR http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/ | |
916 | http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/ | |
917 | .URk | |
918 | .PP | |
56eb10c0 NB |
919 | .BR mdadm.conf (5), |
920 | .BR md (4). | |
921 | .PP | |
52826846 NB |
922 | .IR raidtab (5), |
923 | .IR raid0run (8), | |
924 | .IR raidstop (8), | |
925 | .IR mkraid (8) |