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