]>
Commit | Line | Data |
---|---|---|
52826846 | 1 | .\" -*- nroff -*- |
5e7519fa | 2 | .TH MDADM 8 "" v2.0-devel-3 |
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 , | |
98c6faba | 32 | .BR RAID6 , |
b5e64645 | 33 | .BR MULTIPATH , |
cd29a5c8 | 34 | and |
b5e64645 | 35 | .BR FAULTY . |
d013a55e NB |
36 | |
37 | .B MULTIPATH is not a Software RAID mechanism, but does involve | |
38 | multiple devices. For | |
39 | .B MULTIPATH | |
40 | each device is a path to one common physical storage device. | |
41 | ||
b5e64645 NB |
42 | .B FAULTY is also no true RAID, and it only involves one device. It |
43 | provides a layer over a true device that can be used to inject faults. | |
52826846 | 44 | |
9a9dab36 | 45 | .B mdadm |
11a3e71d NB |
46 | is a program that can be used to create, manage, and monitor |
47 | MD devices. As | |
cd29a5c8 NB |
48 | such it provides a similar set of functionality to the |
49 | .B raidtools | |
50 | packages. | |
51 | The key differences between | |
9a9dab36 | 52 | .B mdadm |
cd29a5c8 NB |
53 | and |
54 | .B raidtools | |
55 | are: | |
56 | .IP \(bu 4 | |
9a9dab36 | 57 | .B mdadm |
cd29a5c8 NB |
58 | is a single program and not a collection of programs. |
59 | .IP \(bu 4 | |
9a9dab36 | 60 | .B mdadm |
cd29a5c8 | 61 | can perform (almost) all of its functions without having a |
5787fa49 | 62 | configuration file and does not use one by default. Also |
2d465520 NB |
63 | .B mdadm |
64 | helps with management of the configuration | |
cd29a5c8 NB |
65 | file. |
66 | .IP \(bu 4 | |
9a9dab36 | 67 | .B mdadm |
e0d19036 | 68 | can provide information about your arrays (through Query, Detail, and Examine) |
cd29a5c8 NB |
69 | that |
70 | .B raidtools | |
71 | cannot. | |
5787fa49 NB |
72 | .P |
73 | .I mdadm | |
74 | does not use | |
75 | .IR /etc/raidtab , | |
76 | the | |
77 | .B raidtools | |
78 | configuration file, at all. It has a different configuration file | |
79 | with a different format and an different purpose. | |
52826846 NB |
80 | |
81 | .SH MODES | |
dd0781e5 | 82 | mdadm has 7 major modes of operation: |
cd29a5c8 NB |
83 | .TP |
84 | .B Assemble | |
85 | Assemble the parts of a previously created | |
52826846 NB |
86 | array into an active array. Components can be explicitly given |
87 | or can be searched for. | |
9a9dab36 | 88 | .B mdadm |
cd29a5c8 NB |
89 | checks that the components |
90 | do form a bona fide array, and can, on request, fiddle superblock | |
91 | information so as to assemble a faulty array. | |
92 | ||
93 | .TP | |
94 | .B Build | |
570c0542 | 95 | Build an array without per-device superblocks. |
cd29a5c8 NB |
96 | |
97 | .TP | |
98 | .B Create | |
99 | Create a new array with per-device superblocks. | |
100 | '''It can progress | |
101 | '''in several step create-add-add-run or it can all happen with one command. | |
102 | ||
103 | .TP | |
e0d19036 NB |
104 | .B Manage |
105 | This is for doing things to specific components of an array such as | |
106 | adding new spares and removing faulty devices. | |
cd29a5c8 NB |
107 | |
108 | .TP | |
e0d19036 NB |
109 | .B Misc |
110 | This mode allows operations on independent devices such as examine MD | |
111 | superblocks, erasing old superblocks and stopping active arrays. | |
cd29a5c8 NB |
112 | |
113 | .TP | |
114 | .B "Follow or Monitor" | |
5787fa49 | 115 | Monitor one or more md devices and act on any state changes. This is |
98c6faba NB |
116 | only meaningful for raid1, 4, 5, 6 or multipath arrays as |
117 | only these have interesting state. raid0 or linear never have | |
118 | missing, spare, or failed drives, so there is nothing to monitor. | |
5787fa49 | 119 | |
dd0781e5 NB |
120 | .TP |
121 | .B "Grow" | |
122 | Grow (or shrink) an array, or otherwise reshape it in some way. | |
123 | Currently supported growth options including changing the active size | |
124 | of componenet devices in RAID level 1/4/5/6 and changing the number of | |
125 | active devices in RAID1. | |
cd29a5c8 | 126 | |
52826846 NB |
127 | .SH OPTIONS |
128 | ||
129 | Available options are: | |
130 | ||
cd29a5c8 NB |
131 | .TP |
132 | .BR -A ", " --assemble | |
2d465520 | 133 | Assemble a pre-existing array. |
52826846 | 134 | |
cd29a5c8 NB |
135 | .TP |
136 | .BR -B ", " --build | |
137 | Build a legacy array without superblocks. | |
52826846 | 138 | |
cd29a5c8 NB |
139 | .TP |
140 | .BR -C ", " --create | |
141 | Create a new array. | |
52826846 | 142 | |
e0d19036 NB |
143 | .TP |
144 | .BR -Q ", " --query | |
145 | Examine a device to see | |
146 | (1) if it is an md device and (2) if it is a component of an md | |
147 | array. | |
148 | Information about what is discovered is presented. | |
149 | ||
cd29a5c8 NB |
150 | .TP |
151 | .BR -D ", " --detail | |
152 | Print detail of one or more md devices. | |
52826846 | 153 | |
cd29a5c8 NB |
154 | .TP |
155 | .BR -E ", " --examine | |
156 | Print content of md superblock on device(s). | |
52826846 | 157 | |
cd29a5c8 NB |
158 | .TP |
159 | .BR -F ", " --follow ", " --monitor | |
160 | Select | |
161 | .B Monitor | |
162 | mode. | |
52826846 | 163 | |
dd0781e5 NB |
164 | .TP |
165 | .BR -G ", " --grow | |
166 | Change the size or shape of an active array. | |
167 | ||
e793c2e5 NB |
168 | .TP |
169 | .BR -X ", " --examine-bitmap | |
170 | Report information about a bitmap file. | |
171 | ||
cd29a5c8 NB |
172 | .TP |
173 | .BR -h ", " --help | |
56eedc1a NB |
174 | Display help message or, after above option, mode specific help |
175 | message. | |
176 | ||
177 | .TP | |
178 | .B --help-options | |
179 | Display more detailed help about command line parsing and some commonly | |
180 | used options. | |
52826846 | 181 | |
cd29a5c8 NB |
182 | .TP |
183 | .BR -V ", " --version | |
9a9dab36 | 184 | Print version information for mdadm. |
52826846 | 185 | |
cd29a5c8 NB |
186 | .TP |
187 | .BR -v ", " --verbose | |
22892d56 NB |
188 | Be more verbose about what is happening. This can be used twice to be |
189 | extra-verbose. | |
190 | This currently only affects | |
191 | .B --detail --scan | |
192 | and | |
193 | .BR "--examine --scan" . | |
52826846 | 194 | |
cd29a5c8 NB |
195 | .TP |
196 | .BR -b ", " --brief | |
197 | Be less verbose. This is used with | |
198 | .B --detail | |
199 | and | |
200 | .BR --examine . | |
22892d56 NB |
201 | Using |
202 | .B --brief | |
203 | with | |
204 | .B --verbose | |
205 | gives an intermediate level of verbosity. | |
52826846 | 206 | |
dfd4d8ee NB |
207 | .TP |
208 | .BR -W ", " --write-mostly | |
209 | subsequent devices lists in a | |
210 | .BR --build , | |
211 | .BR --create , | |
212 | or | |
213 | .B --add | |
214 | command will be flagged as 'write-mostly'. This is valid for RAID1 | |
215 | only and means that the 'md' driver will avoid reading from these | |
216 | devices if at all possible. This can be useful if mirroring over a | |
217 | slow link. | |
218 | ||
e793c2e5 NB |
219 | .TP |
220 | .BR -b ", " --bitmap= | |
221 | Give the name of a bitmap file to use with this array. Can be used | |
222 | with --create (file should not exist) or --assemble (file should | |
223 | exist). | |
224 | ||
225 | .TP | |
226 | .BR --bitmap-chunk= | |
227 | Set the Chunksize of the bitmap. Each bit corresponds to that many | |
228 | Kilobytes of storage. Default is 4. | |
229 | ||
dfd4d8ee NB |
230 | .TP |
231 | .BR --write-behind= | |
232 | Specify that write-behind mode should be enabled (valid for RAID1 | |
233 | only). If an argument is specified, it will set the maximum number | |
234 | of outstanding writes allowed. The default value is 256. | |
235 | A write-intent bitmap is required in order to use write-behind | |
236 | mode, and write-behind is only attempted on drives marked as | |
237 | .IR write-mostly . | |
238 | ||
e793c2e5 | 239 | |
e0d19036 NB |
240 | .TP |
241 | .BR -f ", " --force | |
242 | Be more forceful about certain operations. See the various modes of | |
243 | the exact meaning of this option in different contexts. | |
244 | ||
245 | .TP | |
246 | .BR -c ", " --config= | |
247 | Specify the config file. Default is | |
248 | .BR /etc/mdadm.conf . | |
5787fa49 NB |
249 | If the config file given is |
250 | .B partitions | |
251 | then nothing will be read, but | |
252 | .I mdadm | |
253 | will act as though the config file contained exactly | |
254 | .B "DEVICE partitions" | |
255 | and will read | |
256 | .B /proc/partitions | |
257 | to find a list of devices to scan. | |
d013a55e NB |
258 | If the word |
259 | .B none | |
260 | is given for the config file, then | |
261 | .I mdadm | |
262 | will act as though the config file were empty. | |
e0d19036 NB |
263 | |
264 | .TP | |
265 | .BR -s ", " --scan | |
266 | scan config file or | |
267 | .B /proc/mdstat | |
268 | for missing information. | |
269 | In general, this option gives | |
270 | .B mdadm | |
271 | permission to get any missing information, like component devices, | |
272 | array devices, array identities, and alert destination from the | |
273 | configuration file: | |
274 | .BR /etc/mdadm.conf . | |
275 | One exception is MISC mode when using | |
276 | .B --detail | |
277 | or | |
278 | .B --stop | |
279 | in which case | |
280 | .B --scan | |
281 | says to get a list of array devices from | |
282 | .BR /proc/mdstat . | |
283 | ||
570c0542 NB |
284 | .TP |
285 | .B -e ", " --metadata= | |
286 | Declare the style of superblock (raid metadata) to be used. The | |
287 | default is 0.90 for --create, and to guess for other operations. | |
288 | ||
289 | Options are: | |
290 | .RS | |
291 | .IP "0, 0.90, default" | |
292 | Use the original 0.90 format superblock. This format limits arrays to | |
293 | 28 componenet devices and limits component devices of levels 1 and | |
294 | greater to 2 terabytes. | |
295 | .IP "1, 1.0, 1.1, 1.2" | |
296 | Use the new version-1 format superblock. This has few restrictions. | |
297 | The different subversion store the superblock at different locations | |
298 | on the device, either at the end (for 1.0), at the start (for 1.1) or | |
299 | 4K from the start (for 1.2). | |
300 | .RE | |
301 | ||
cd29a5c8 | 302 | .SH For create or build: |
52826846 | 303 | |
cd29a5c8 NB |
304 | .TP |
305 | .BR -c ", " --chunk= | |
306 | Specify chunk size of kibibytes. The default is 64. | |
52826846 | 307 | |
cd29a5c8 NB |
308 | .TP |
309 | .BR --rounding= | |
310 | Specify rounding factor for linear array (==chunk size) | |
52826846 | 311 | |
cd29a5c8 NB |
312 | .TP |
313 | .BR -l ", " --level= | |
aa88f531 NB |
314 | Set raid level. When used with |
315 | .IR --create , | |
98c6faba | 316 | options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4, |
b5e64645 | 317 | raid5, 5, raid6, 6, multipath, mp, fautly. Obviously some of these are synonymous. |
aa88f531 NB |
318 | |
319 | When used with | |
320 | .IR --build , | |
321 | only linear, raid0, 0, stripe are valid. | |
52826846 | 322 | |
cd29a5c8 NB |
323 | .TP |
324 | .BR -p ", " --parity= | |
325 | Set raid5 parity algorithm. Options are: | |
2d465520 NB |
326 | left-asymmetric, |
327 | left-symmetric, | |
328 | right-asymmetric, | |
329 | right-symmetric, | |
330 | la, ra, ls, rs. The default is left-symmetric. | |
52826846 | 331 | |
b5e64645 NB |
332 | This option is also used to set the failure mode for |
333 | .IR faulty . | |
334 | The options are: | |
335 | write-transient, | |
336 | wt, | |
337 | read-transient, | |
338 | rt, | |
339 | write-presistent, | |
340 | wp, | |
341 | read-persistent, | |
342 | rp, | |
343 | write-all, | |
344 | read-fixable, | |
345 | rf, | |
346 | clear, | |
347 | flush, | |
348 | none. | |
349 | ||
350 | Each mode can be followed by a number which is used as a period | |
351 | between fault generation. Without a number, the fault is generated | |
352 | once on the first relevant request. With a number, the fault will be | |
353 | generated after that many request, and will continue to be generated | |
354 | every time the period elapses. | |
355 | ||
356 | Multiple failure modes can be current simultaneously by using the | |
357 | "--grow" option to set subsequent failure modes. | |
358 | ||
359 | "clear" or "none" will remove any pending or periodic failure modes, | |
360 | and "flush" will clear any persistant faults. | |
361 | ||
362 | To set the parity with "--grow", the level of the array ("faulty") | |
363 | must be specified before the fault mode is specified. | |
364 | ||
cd29a5c8 NB |
365 | .TP |
366 | .BR --layout= | |
367 | same as --parity | |
52826846 | 368 | |
e793c2e5 NB |
369 | .TP |
370 | .BR -b ", " --bitmap= | |
371 | Specify a file to store a write-intent bitmap in. The file should not | |
372 | exist unless --force is also given. The same file should be provided | |
373 | when assembling the array. | |
374 | ||
375 | .TP | |
376 | .BR --bitmap-chunk= | |
377 | Specifty the chunksize for the bitmap. | |
378 | ||
cd29a5c8 | 379 | .TP |
b83d95f3 | 380 | .BR -n ", " --raid-devices= |
5787fa49 NB |
381 | Specify the number of active devices in the array. This, plus the |
382 | number of spare devices (see below) must equal the number of | |
383 | .I component-devices | |
d013a55e | 384 | (including "\fBmissing\fP" devices) |
dd0781e5 NB |
385 | that are listed on the command line for |
386 | .BR --create . | |
387 | Setting a value of 1 is probably | |
aa88f531 NB |
388 | a mistake and so requires that |
389 | .B --force | |
390 | be specified first. A value of 1 will then be allowed for linear, | |
391 | multipath, raid0 and raid1. It is never allowed for raid4 or raid5. | |
392 | .br | |
dd0781e5 NB |
393 | This number can only be changed using |
394 | .B --grow | |
395 | for RAID1 arrays, and only on kernels which provide necessary support. | |
cd29a5c8 NB |
396 | |
397 | .TP | |
b83d95f3 | 398 | .BR -x ", " --spare-devices= |
5787fa49 NB |
399 | Specify the number of spare (eXtra) devices in the initial array. |
400 | Spares can also be added | |
401 | and removed later. The number of component devices listed | |
402 | on the command line must equal the number of raid devices plus the | |
403 | number of spare devices. | |
404 | ||
cd29a5c8 NB |
405 | |
406 | .TP | |
407 | .BR -z ", " --size= | |
98c6faba | 408 | Amount (in Kibibytes) of space to use from each drive in RAID1/4/5/6. |
cd29a5c8 NB |
409 | This must be a multiple of the chunk size, and must leave about 128Kb |
410 | of space at the end of the drive for the RAID superblock. | |
411 | If this is not specified | |
412 | (as it normally is not) the smallest drive (or partition) sets the | |
413 | size, though if there is a variance among the drives of greater than 1%, a warning is | |
414 | issued. | |
52826846 | 415 | |
dd0781e5 NB |
416 | This value can be set with |
417 | .B --grow | |
418 | for RAID level 1/4/5/6. If the array was created with a size smaller | |
419 | than the currently active drives, the extra space can be accessed | |
420 | using | |
421 | .BR --grow . | |
779043ef NB |
422 | The size can be given as |
423 | .B max | |
424 | which means to choose the largest size that fits all on all current drives. | |
dd0781e5 NB |
425 | |
426 | .TP | |
427 | .BR --assume-clean | |
428 | Tell | |
429 | .I mdadm | |
430 | that the array pre-existed and is known to be clean. This is only | |
431 | really useful for Building RAID1 array. Only use this if you really | |
432 | know what you are doing. This is currently only supported for --build. | |
433 | ||
434 | .TP | |
435 | .BR -R ", " --run | |
436 | Insist that | |
437 | .I mdadm | |
438 | run the array, even if some of the components | |
439 | appear to be active in another array or filesystem. Normally | |
440 | .I mdadm | |
441 | will ask for confirmation before including such components in an | |
442 | array. This option causes that question to be suppressed. | |
443 | ||
444 | .TP | |
445 | .BR -f ", " --force | |
446 | Insist that | |
447 | .I mdadm | |
448 | accept the geometry and layout specified without question. Normally | |
449 | .I mdadm | |
450 | will not allow creation of an array with only one device, and will try | |
451 | to create a raid5 array with one missing drive (as this makes the | |
452 | initial resync work faster). With | |
453 | .BR --force , | |
454 | .I mdadm | |
455 | will not try to be so clever. | |
456 | ||
457 | .TP | |
458 | .BR -a ", " "--auto{=no,yes,md,mdp,part,p}{NN}" | |
48f7b27a NB |
459 | Instruct mdadm to create the device file if needed, possibly allocating |
460 | an unused minor number. "md" causes a non-partitionable array | |
dd0781e5 | 461 | to be used. "mdp", "part" or "p" causes a partitionable array (2.6 and |
48f7b27a NB |
462 | later) to be used. "yes" requires the named md device to have a |
463 | 'standard' format, and the type and minor number will be determined | |
464 | from this. See DEVICE NAMES below. | |
465 | ||
466 | The argumentment can also come immediately after | |
dd0781e5 NB |
467 | "-a". e.g. "-ap". |
468 | ||
1337546d NB |
469 | If |
470 | .I --scan | |
471 | is also given, then any | |
472 | .I auto= | |
473 | entries in the config file will over-ride the | |
474 | .I --auto | |
475 | instruction given on the command line. | |
476 | ||
dd0781e5 NB |
477 | For partitionable arrays, |
478 | .I mdadm | |
479 | will create the device file for the whole array and for the first 4 | |
480 | partitions. A different number of partitions can be specified at the | |
481 | end of this option (e.g. | |
482 | .BR --auto=p7 ). | |
48f7b27a NB |
483 | If the device name ends with a digit, the partition names add a'p', |
484 | and a number, e.g. "/dev/home1p3". If there is no | |
dd0781e5 NB |
485 | trailing digit, then the partition names just have a number added, |
486 | e.g. "/dev/scratch3". | |
487 | ||
48f7b27a NB |
488 | If the md device name is in a 'standard' format as described in DEVICE |
489 | NAMES, then it will be created, if necessary, with the appropriate | |
490 | number based on that name. If the device name is not in one of these | |
491 | formats, then a unused minor number will be allocted. The minor | |
492 | number will be considered unused if there is no active array for that | |
493 | number, and there is no entry in /dev for that number and with a | |
494 | non-standard name. | |
495 | ||
52826846 NB |
496 | .SH For assemble: |
497 | ||
cd29a5c8 NB |
498 | .TP |
499 | .BR -u ", " --uuid= | |
500 | uuid of array to assemble. Devices which don't have this uuid are | |
501 | excluded | |
502 | ||
503 | .TP | |
504 | .BR -m ", " --super-minor= | |
505 | Minor number of device that array was created for. Devices which | |
506 | don't have this minor number are excluded. If you create an array as | |
2d465520 | 507 | /dev/md1, then all superblocks will contain the minor number 1, even if |
cd29a5c8 NB |
508 | the array is later assembled as /dev/md2. |
509 | ||
d013a55e NB |
510 | Giving the literal word "dev" for |
511 | .B --super-minor | |
512 | will cause | |
513 | .I mdadm | |
514 | to use the minor number of the md device that is being assembled. | |
515 | e.g. when assembling | |
516 | .BR /dev/md0 , | |
517 | .M --super-minor=dev | |
518 | will look for super blocks with a minor number of 0. | |
519 | ||
cd29a5c8 NB |
520 | .TP |
521 | .BR -f ", " --force | |
52826846 NB |
522 | Assemble the array even if some superblocks appear out-of-date |
523 | ||
cd29a5c8 NB |
524 | .TP |
525 | .BR -R ", " --run | |
526 | Attempt to start the array even if fewer drives were given than are | |
527 | needed for a full array. Normally if not all drives are found and | |
528 | .B --scan | |
529 | is not used, then the array will be assembled but not started. | |
530 | With | |
531 | .B --run | |
532 | an attempt will be made to start it anyway. | |
52826846 | 533 | |
dd0781e5 NB |
534 | .TP |
535 | .BR -a ", " "--auto{=no,yes,md,mdp,part}" | |
536 | See this option under Create and Build options. | |
537 | ||
e793c2e5 NB |
538 | .TP |
539 | .BR -b ", " --bitmap= | |
540 | Specify the bitmap file that was given when the array was created. | |
541 | ||
5787fa49 NB |
542 | .TP |
543 | .BR -U ", " --update= | |
544 | Update the superblock on each device while assembling the array. The | |
feb716e9 NB |
545 | argument given to this flag can be one of |
546 | .BR sparc2.2 , | |
547 | .BR summaries , | |
e5329c37 | 548 | .BR resync , |
586ed405 | 549 | .BR byteorder , |
5787fa49 NB |
550 | or |
551 | .BR super-minor . | |
552 | ||
553 | The | |
554 | .B sparc2.2 | |
555 | option will adjust the superblock of an array what was created on a Sparc | |
556 | machine running a patched 2.2 Linux kernel. This kernel got the | |
557 | alignment of part of the superblock wrong. You can use the | |
558 | .B "--examine --sparc2.2" | |
559 | option to | |
560 | .I mdadm | |
561 | to see what effect this would have. | |
562 | ||
563 | The | |
564 | .B super-minor | |
565 | option will update the | |
566 | .B "prefered minor" | |
567 | field on each superblock to match the minor number of the array being | |
feb716e9 | 568 | assembled. This is not needed on 2.6 and later kernels as they make |
5787fa49 NB |
569 | this adjustment automatically. |
570 | ||
e5329c37 NB |
571 | The |
572 | .B resync | |
573 | option will cause the array to be marked | |
574 | .I dirty | |
575 | meaning that any redundancy in the array (e.g. parity for raid5, | |
576 | copies for raid1) may be incorrect. This will cause the raid system | |
577 | to perform a "resync" pass to make sure that all redundant information | |
578 | is correct. | |
579 | ||
586ed405 NB |
580 | The |
581 | .B byteorder | |
582 | option allows arrays to be moved between machines with different | |
583 | byte-order. | |
584 | When assembling such an array for the first time after a move, giving | |
585 | .B "--update=byteorder" | |
586 | will cause | |
587 | .I mdadm | |
588 | to expect superblocks to have their byteorder reversed, and will | |
589 | correct that order before assembling the array. This is only valid | |
590 | with original (Verion 0.90) superblocks. | |
591 | ||
feb716e9 NB |
592 | The |
593 | .B summaries | |
594 | option will correct the summaries in the superblock. That is the | |
595 | counts of total, working, active, failed, and spare devices. | |
5787fa49 | 596 | |
e0d19036 | 597 | .SH For Manage mode: |
52826846 | 598 | |
cd29a5c8 NB |
599 | .TP |
600 | .BR -a ", " --add | |
601 | '''add, or | |
602 | hotadd listed devices. | |
52826846 | 603 | |
cd29a5c8 NB |
604 | .TP |
605 | .BR -r ", " --remove | |
2d465520 | 606 | remove listed devices. They must not be active. i.e. they should |
cd29a5c8 | 607 | be failed or spare devices. |
52826846 | 608 | |
cd29a5c8 NB |
609 | .TP |
610 | .BR -f ", " --fail | |
611 | mark listed devices as faulty. | |
52826846 | 612 | |
cd29a5c8 NB |
613 | .TP |
614 | .BR --set-faulty | |
615 | same as --fail. | |
52826846 | 616 | |
5787fa49 NB |
617 | .SH For Examine mode: |
618 | ||
619 | .TP | |
620 | .B --sparc2.2 | |
621 | In an array was created on a 2.2 Linux kernel patched with RAID | |
622 | support, the superblock will have been created incorrectly, or at | |
623 | least incompatibly with 2.4 and later kernels. Using the | |
624 | .B --sparc2.2 | |
625 | flag with | |
626 | .B --examine | |
627 | will fix the superblock before displaying it. If this appears to do | |
628 | the right thing, then the array can be successfully assembled using | |
629 | .BR "--assemble --update=sparc2.2" . | |
630 | ||
e0d19036 NB |
631 | .SH For Misc mode: |
632 | ||
cd29a5c8 NB |
633 | .TP |
634 | .BR -R ", " --run | |
635 | start a partially built array. | |
52826846 | 636 | |
cd29a5c8 NB |
637 | .TP |
638 | .BR -S ", " --stop | |
639 | deactivate array, releasing all resources. | |
52826846 | 640 | |
cd29a5c8 NB |
641 | .TP |
642 | .BR -o ", " --readonly | |
643 | mark array as readonly. | |
52826846 | 644 | |
cd29a5c8 NB |
645 | .TP |
646 | .BR -w ", " --readwrite | |
647 | mark array as readwrite. | |
52826846 | 648 | |
e0d19036 NB |
649 | .TP |
650 | .B --zero-superblock | |
651 | If the device contains a valid md superblock, the block is | |
652 | over-written with zeros. With | |
653 | --force | |
654 | the block where the superblock would be is over-written even if it | |
655 | doesn't appear to be valid. | |
52826846 | 656 | |
feb716e9 NB |
657 | .TP |
658 | .BR -t ", " --test | |
659 | When used with | |
660 | .BR --detail , | |
661 | the exit status of | |
662 | .I mdadm | |
663 | is set to reflect the status of the device. | |
664 | ||
e0d19036 NB |
665 | .SH For Monitor mode: |
666 | .TP | |
667 | .BR -m ", " --mail | |
668 | Give a mail address to send alerts to. | |
669 | ||
670 | .TP | |
671 | .BR -p ", " --program ", " --alert | |
672 | Give a program to be run whenever an event is detected. | |
673 | ||
674 | .TP | |
675 | .BR -d ", " --delay | |
676 | Give a delay in seconds. | |
677 | .B mdadm | |
678 | polls the md arrays and then waits this many seconds before polling | |
679 | again. The default is 60 seconds. | |
680 | ||
d013a55e NB |
681 | .TP |
682 | .BR -f ", " --daemonise | |
683 | Tell | |
684 | .B mdadm | |
685 | to run as a background daemon if it decides to monitor anything. This | |
686 | causes it to fork and run in the child, and to disconnect form the | |
687 | terminal. The process id of the child is written to stdout. | |
688 | This is useful with | |
689 | .B --scan | |
690 | which will only continue monitoring if a mail address or alert program | |
691 | is found in the config file. | |
692 | ||
b5e64645 NB |
693 | .TP |
694 | .BR -i ", " --pid-file | |
695 | When | |
696 | .B mdadm | |
697 | is running in daemon mode, write the pid of the daemon process to | |
698 | the specified file, instead of printing it on standard output. | |
699 | ||
aa88f531 NB |
700 | .TP |
701 | .BR -1 ", " --oneshot | |
702 | Check arrays only once. This will generate | |
703 | .B NewArray | |
704 | events and more significantly | |
705 | .B DegradedArray | |
706 | events. Running | |
707 | .in +5 | |
708 | .B " mdadm --monitor --scan -1" | |
709 | .in -5 | |
710 | from a cron script will ensure regular notification of any degraded arrays. | |
711 | ||
98c6faba NB |
712 | .TP |
713 | .BR -t ", " --test | |
714 | Generate a | |
715 | .B TestMessage | |
716 | alert for every array found at startup. This alert gets mailed and | |
717 | passed to the alert program. This can be used for testing that alert | |
718 | message to get through successfully. | |
719 | ||
e0d19036 | 720 | .SH ASSEMBLE MODE |
52826846 | 721 | |
cd29a5c8 NB |
722 | .HP 12 |
723 | Usage: | |
9a9dab36 | 724 | .B mdadm --assemble |
5787fa49 NB |
725 | .I md-device options-and-component-devices... |
726 | .HP 12 | |
727 | Usage: | |
728 | .B mdadm --assemble --scan | |
729 | .I md-devices-and-options... | |
cd29a5c8 NB |
730 | .HP 12 |
731 | Usage: | |
9a9dab36 | 732 | .B mdadm --assemble --scan |
cd29a5c8 | 733 | .I options... |
52826846 | 734 | |
cd29a5c8 | 735 | .PP |
52826846 | 736 | This usage assembles one or more raid arrays from pre-existing components. |
9a9dab36 | 737 | For each array, mdadm needs to know the md device, the identity of the |
e0d19036 | 738 | array, and a number of component-devices. These can be found in a number of ways. |
52826846 | 739 | |
5787fa49 NB |
740 | In the first usage example (without the |
741 | .BR --scan ) | |
742 | the first device given is the md device. | |
743 | In the second usage example, all devices listed are treated as md | |
744 | devices and assembly is attempted. | |
745 | In the third (where no devices are listed) all md devices that are | |
746 | listed in the configuration file are assembled. | |
52826846 | 747 | |
d013a55e NB |
748 | If precisely one device is listed, but |
749 | .B --scan | |
dd0781e5 | 750 | is not given, then |
d013a55e NB |
751 | .I mdadm |
752 | acts as though | |
753 | .B --scan | |
754 | was given and identify information is extracted from the configuration file. | |
755 | ||
cd29a5c8 | 756 | The identity can be given with the |
52826846 | 757 | .B --uuid |
cd29a5c8 NB |
758 | option, with the |
759 | .B --super-minor | |
5787fa49 | 760 | option, can be found in the config file, or will be taken from the |
e0d19036 | 761 | super block on the first component-device listed on the command line. |
52826846 NB |
762 | |
763 | Devices can be given on the | |
764 | .B --assemble | |
5787fa49 NB |
765 | command line or in the config file. Only devices which have an md |
766 | superblock which contains the right identity will be considered for | |
767 | any array. | |
52826846 NB |
768 | |
769 | The config file is only used if explicitly named with | |
770 | .B --config | |
d013a55e | 771 | or requested with (a possibly implicit) |
52826846 NB |
772 | .B --scan. |
773 | In the later case, | |
9a9dab36 | 774 | .B /etc/mdadm.conf |
52826846 NB |
775 | is used. |
776 | ||
777 | If | |
778 | .B --scan | |
cd29a5c8 NB |
779 | is not given, then the config file will only be used to find the |
780 | identity of md arrays. | |
52826846 | 781 | |
2d465520 | 782 | Normally the array will be started after it is assembled. However if |
cd29a5c8 | 783 | .B --scan |
2d465520 | 784 | is not given and insufficient drives were listed to start a complete |
cd29a5c8 NB |
785 | (non-degraded) array, then the array is not started (to guard against |
786 | usage errors). To insist that the array be started in this case (as | |
98c6faba | 787 | may work for RAID1, 4, 5 or 6), give the |
cd29a5c8 NB |
788 | .B --run |
789 | flag. | |
52826846 | 790 | |
dd0781e5 NB |
791 | If an |
792 | .B auto | |
793 | option is given, either on the command line (--auto) or in the | |
794 | configuration file (e.g. auto=part), then | |
795 | .I mdadm | |
796 | will create the md device if necessary or will re-create it if it | |
797 | doesn't look usable as it is. | |
798 | ||
799 | This can be useful for handling partitioned devices (which don't have | |
800 | a stable device number - it can change after a reboot) and when using | |
801 | "udev" to manage your | |
802 | .B /dev | |
803 | tree (udev cannot handle md devices because of the unusual device | |
804 | initialisation conventions). | |
805 | ||
806 | If the option to "auto" is "mdp" or "part" or (on the command line | |
807 | only) "p", then mdadm will create a partitionable array, using the | |
808 | first free one that is not inuse, and does not already have an entry | |
809 | in /dev (apart from numeric /dev/md* entries). | |
810 | ||
811 | If the option to "auto" is "yes" or "md" or (on the command line) | |
812 | nothing, then mdadm will create a traditional, non-partitionable md | |
813 | array. | |
814 | ||
815 | It is expected that the "auto" functionality will be used to create | |
816 | device entries with meaningful names such as "/dev/md/home" or | |
817 | "/dev/md/root", rather than names based on the numerical array number. | |
818 | ||
819 | When using this option to create a partitionable array, the device | |
820 | files for the first 4 partitions are also created. If a different | |
821 | number is required it can be simply appended to the auto option. | |
822 | e.g. "auto=part8". Partition names are created by appending a digit | |
823 | string to the device name, with an intervening "_p" if the device name | |
824 | ends with a digit. | |
825 | ||
826 | The | |
827 | .B --auto | |
828 | option is also available in Build and Create modes. As those modes do | |
829 | not use a config file, the "auto=" config option does not apply to | |
830 | these modes. | |
52826846 | 831 | |
cd29a5c8 | 832 | .SH BUILD MODE |
52826846 | 833 | |
cd29a5c8 NB |
834 | .HP 12 |
835 | Usage: | |
9a9dab36 | 836 | .B mdadm --build |
cd29a5c8 NB |
837 | .I device |
838 | .BI --chunk= X | |
839 | .BI --level= Y | |
b83d95f3 | 840 | .BI --raid-devices= Z |
cd29a5c8 NB |
841 | .I devices |
842 | ||
843 | .PP | |
52826846 | 844 | This usage is similar to |
cd29a5c8 | 845 | .BR --create . |
52826846 | 846 | The difference is that it creates a legacy array without a superblock. With |
cd29a5c8 | 847 | these arrays there is no difference between initially creating the array and |
52826846 NB |
848 | subsequently assembling the array, except that hopefully there is useful |
849 | data there in the second case. | |
850 | ||
cd29a5c8 NB |
851 | The level may only be 0, raid0, or linear. All devices must be listed |
852 | and the array will be started once complete. | |
853 | ||
854 | .SH CREATE MODE | |
855 | ||
856 | .HP 12 | |
857 | Usage: | |
9a9dab36 | 858 | .B mdadm --create |
cd29a5c8 NB |
859 | .I device |
860 | .BI --chunk= X | |
861 | .BI --level= Y | |
862 | .br | |
b83d95f3 | 863 | .BI --raid-devices= Z |
cd29a5c8 NB |
864 | .I devices |
865 | ||
866 | .PP | |
867 | This usage will initialise a new md array, associate some devices with | |
868 | it, and activate the array. | |
869 | ||
dd0781e5 NB |
870 | This the |
871 | .B --auto | |
872 | option is given (as described in more detail in the section on | |
873 | Assemble mode), then the md device will be created with a suitable | |
874 | device number if necessary. | |
875 | ||
cd29a5c8 | 876 | As devices are added, they are checked to see if they contain raid |
2d465520 | 877 | superblocks or filesystems. They are also checked to see if the variance in |
cd29a5c8 NB |
878 | device size exceeds 1%. |
879 | ||
880 | If any discrepancy is found, the array will not automatically be run, though | |
881 | the presence of a | |
882 | .B --run | |
883 | can override this caution. | |
884 | ||
2d465520 | 885 | To create a "degraded" array in which some devices are missing, simply |
d013a55e | 886 | give the word "\fBmissing\fP" |
2d465520 NB |
887 | in place of a device name. This will cause |
888 | .B mdadm | |
889 | to leave the corresponding slot in the array empty. | |
890 | For a RAID4 or RAID5 array at most one slot can be | |
98c6faba | 891 | "\fBmissing\fP"; for a RAID6 array at most two slots. |
2d465520 NB |
892 | For a RAID1 array, only one real device needs to be given. All of the |
893 | others can be | |
d013a55e | 894 | "\fBmissing\fP". |
2d465520 | 895 | |
feb716e9 NB |
896 | When creating a RAID5 array, |
897 | .B mdadm | |
898 | will automatically create a degraded array with an extra spare drive. | |
899 | This is because building the spare into a degraded array is in general faster than resyncing | |
900 | the parity on a non-degraded, but not clean, array. This feature can | |
901 | be over-ridden with the | |
b5e64645 | 902 | .I --force |
feb716e9 NB |
903 | option. |
904 | ||
cd29a5c8 NB |
905 | '''If the |
906 | '''.B --size | |
e0d19036 | 907 | '''option is given, it is not necessary to list any component-devices in this command. |
cd29a5c8 NB |
908 | '''They can be added later, before a |
909 | '''.B --run. | |
910 | '''If no | |
911 | '''.B --size | |
912 | '''is given, the apparent size of the smallest drive given is used. | |
913 | ||
914 | The General Management options that are valid with --create are: | |
915 | .TP | |
916 | .B --run | |
dd0781e5 | 917 | insist on running the array even if some devices look like they might |
cd29a5c8 NB |
918 | be in use. |
919 | ||
920 | .TP | |
921 | .B --readonly | |
922 | start the array readonly - not supported yet. | |
52826846 | 923 | |
e0d19036 | 924 | .SH MANAGE MODE |
cd29a5c8 NB |
925 | .HP 12 |
926 | Usage: | |
e0d19036 NB |
927 | .B mdadm |
928 | .I device | |
929 | .I options... devices... | |
cd29a5c8 NB |
930 | .PP |
931 | ||
e0d19036 NB |
932 | This usage will allow individual devices in an array to be failed, |
933 | removed or added. It is possible to perform multiple operations with | |
934 | on command. For example: | |
935 | .br | |
5787fa49 | 936 | .B " mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 -a /dev/hda1" |
e0d19036 NB |
937 | .br |
938 | will firstly mark | |
939 | .B /dev/hda1 | |
940 | as faulty in | |
941 | .B /dev/md0 | |
942 | and will then remove it from the array and finally add it back | |
2d465520 | 943 | in as a spare. However only one md array can be affected by a single |
e0d19036 NB |
944 | command. |
945 | ||
946 | .SH MISC MODE | |
947 | .HP 12 | |
948 | Usage: | |
9a9dab36 | 949 | .B mdadm |
e0d19036 NB |
950 | .I options ... |
951 | .I devices ... | |
952 | .PP | |
cd29a5c8 | 953 | |
b5e64645 | 954 | MISC mode includes a number of distinct operations that |
e0d19036 NB |
955 | operate on distinct devices. The operations are: |
956 | .TP | |
957 | --query | |
958 | The device is examined to see if it is | |
959 | (1) an active md array, or | |
960 | (2) a component of an md array. | |
961 | The information discovered is reported. | |
962 | ||
963 | .TP | |
964 | --detail | |
2d465520 NB |
965 | The device should be an active md device. |
966 | .B mdadm | |
967 | will display a detailed description of the array. | |
cd29a5c8 | 968 | .B --brief |
2d465520 NB |
969 | or |
970 | .B --scan | |
971 | will cause the output to be less detailed and the format to be | |
e0d19036 | 972 | suitable for inclusion in |
9a9dab36 | 973 | .BR /etc/mdadm.conf . |
feb716e9 NB |
974 | The exit status of |
975 | .I mdadm | |
976 | will normally be 0 unless | |
977 | .I mdadm | |
978 | failed to get useful information about the device(s). However if the | |
979 | .B --test | |
980 | option is given, then the exit status will be: | |
981 | .RS | |
982 | .TP | |
983 | 0 | |
984 | The array is functioning normally. | |
985 | .TP | |
986 | 1 | |
987 | The array has at least one failed device. | |
988 | .TP | |
989 | 2 | |
990 | The array has multiple failed devices and hence is unusable (raid4 or | |
991 | raid5). | |
992 | .TP | |
993 | 4 | |
994 | There was an error while trying to get information about the device. | |
995 | .RE | |
cd29a5c8 | 996 | |
e0d19036 NB |
997 | .TP |
998 | --examine | |
2d465520 NB |
999 | The device should be a component of an md array. |
1000 | .B mdadm | |
1001 | will read the md superblock of the device and display the contents. | |
e0d19036 NB |
1002 | If |
1003 | .B --brief | |
1004 | is given, or | |
1005 | .B --scan | |
1006 | then multiple devices that are components of the one array | |
1007 | are grouped together and reported in a single entry suitable | |
1008 | for inclusion in | |
1009 | .BR /etc/mdadm.conf . | |
1010 | ||
2d465520 | 1011 | Having |
e0d19036 NB |
1012 | .B --scan |
1013 | without listing any devices will cause all devices listed in the | |
1014 | config file to be examined. | |
1015 | ||
1016 | .TP | |
1017 | --stop | |
98c6faba NB |
1018 | The devices should be active md arrays which will be deactivated, as |
1019 | long as they are not currently in use. | |
e0d19036 NB |
1020 | |
1021 | .TP | |
1022 | --run | |
1023 | This will fully activate a partially assembled md array. | |
1024 | ||
1025 | .TP | |
1026 | --readonly | |
1027 | This will mark an active array as read-only, providing that it is | |
1028 | not currently being used. | |
1029 | ||
1030 | .TP | |
1031 | --readwrite | |
1032 | This will change a | |
1033 | .B readonly | |
1034 | array back to being read/write. | |
1035 | ||
2d465520 NB |
1036 | .TP |
1037 | --scan | |
1038 | For all operations except | |
1039 | .BR --examine , | |
1040 | .B --scan | |
1041 | will cause the operation to be applied to all arrays listed in | |
1042 | .BR /proc/mdstat . | |
1043 | For | |
1044 | .BR --examine, | |
1045 | .B --scan | |
1046 | causes all devices listed in the config file to be examined. | |
1047 | ||
1048 | ||
e0d19036 NB |
1049 | .SH MONITOR MODE |
1050 | ||
cd29a5c8 NB |
1051 | .HP 12 |
1052 | Usage: | |
e0d19036 NB |
1053 | .B mdadm --monitor |
1054 | .I options... devices... | |
1055 | ||
cd29a5c8 | 1056 | .PP |
e0d19036 NB |
1057 | This usage causes |
1058 | .B mdadm | |
1059 | to periodically poll a number of md arrays and to report on any events | |
1060 | noticed. | |
1061 | .B mdadm | |
1062 | will never exit once it decides that there are arrays to be checked, | |
1063 | so it should normally be run in the background. | |
1064 | ||
2d465520 NB |
1065 | As well as reporting events, |
1066 | .B mdadm | |
1067 | may move a spare drive from one array to another if they are in the | |
1068 | same | |
1069 | .B spare-group | |
1070 | and if the destination array has a failed drive but not spares. | |
1071 | ||
e0d19036 NB |
1072 | If any devices are listed on the command line, |
1073 | .B mdadm | |
1074 | will only monitor those devices. Otherwise all arrays listed in the | |
1075 | configuration file will be monitored. Further, if | |
1076 | .B --scan | |
1077 | is given, then any other md devices that appear in | |
1078 | .B /proc/mdstat | |
1079 | will also be monitored. | |
1080 | ||
1081 | The result of monitoring the arrays is the generation of events. | |
bd526cee | 1082 | These events are passed to a separate program (if specified) and may |
2d465520 | 1083 | be mailed to a given E-mail address. |
e0d19036 | 1084 | |
bd526cee NB |
1085 | When passing event to program, the program is run once for each event |
1086 | and is given 2 or 3 command-line arguements. The first is the | |
1087 | name of the event (see below). The second is the name of the | |
1088 | md device which is affected, and the third is the name of a related | |
1089 | device if relevant, such as a component device that has failed. | |
cd29a5c8 NB |
1090 | |
1091 | If | |
1092 | .B --scan | |
e0d19036 NB |
1093 | is given, then a program or an E-mail address must be specified on the |
1094 | command line or in the config file. If neither are available, then | |
1095 | .B mdadm | |
1096 | will not monitor anything. | |
1097 | Without | |
cd29a5c8 | 1098 | .B --scan |
e0d19036 | 1099 | .B mdadm |
2d465520 | 1100 | will continue monitoring as long as something was found to monitor. If |
e0d19036 NB |
1101 | no program or email is given, then each event is reported to |
1102 | .BR stdout . | |
cd29a5c8 | 1103 | |
e0d19036 NB |
1104 | The different events are: |
1105 | ||
1106 | .RS 4 | |
1107 | .TP | |
1108 | .B DeviceDisappeared | |
2d465520 | 1109 | An md array which previously was configured appears to no longer be |
e0d19036 NB |
1110 | configured. |
1111 | ||
b8f72a62 NB |
1112 | If |
1113 | .I mdadm | |
1114 | was told to monitor an array which is RAID0 or Linear, then it will | |
1115 | report | |
1116 | .B DeviceDisappeared | |
1117 | with the extra information | |
1118 | .BR Wrong-Level . | |
1119 | This is because RAID0 and Linear do not support the device-failed, | |
1120 | hot-spare and resync operations which are monitored. | |
1121 | ||
e0d19036 NB |
1122 | .TP |
1123 | .B RebuildStarted | |
1124 | An md array started reconstruction. | |
1125 | ||
1126 | .TP | |
1127 | .BI Rebuild NN | |
1128 | Where | |
1129 | .I NN | |
1130 | is 20, 40, 60, or 80, this indicates that rebuild has passed that many | |
1131 | percentage of the total. | |
1132 | ||
98c6faba NB |
1133 | .TP |
1134 | .B RebuildFinished | |
1135 | An md array that was rebuilding, isn't any more, either because it | |
1136 | finished normally or was aborted. | |
1137 | ||
e0d19036 NB |
1138 | .TP |
1139 | .B Fail | |
1140 | An active component device of an array has been marked as faulty. | |
1141 | ||
1142 | .TP | |
1143 | .B FailSpare | |
1144 | A spare component device which was being rebuilt to replace a faulty | |
1145 | device has failed. | |
1146 | ||
1147 | .TP | |
1148 | .B SpareActive | |
1149 | A spare component device which was being rebuilt to replace a faulty | |
1150 | device as been successfully rebuild and has been made active. | |
1151 | ||
1152 | .TP | |
1153 | .B NewArray | |
1154 | A new md array has been detected in the | |
1155 | .B /proc/mdstat | |
1156 | file. | |
1157 | ||
aa88f531 NB |
1158 | .TP |
1159 | .B DegradedArray | |
1160 | A newly noticed array appears to be degraded. This message is not | |
1161 | generated when | |
1162 | .I mdadm | |
1163 | notices a drive failure which causes degradation, but only when | |
1164 | .I mdadm | |
1165 | notices that an array is degraded when it first sees the array. | |
1166 | ||
e0d19036 NB |
1167 | .TP |
1168 | .B MoveSpare | |
1169 | A spare drive has been moved from one array in a | |
1170 | .B spare-group | |
1171 | to another to allow a failed drive to be replaced. | |
1172 | ||
b8f72a62 NB |
1173 | .TP |
1174 | .B SparesMissing | |
1175 | If | |
1176 | .I mdadm | |
1177 | has been told, via the config file, that an array should have a certain | |
1178 | number of spare devices, and | |
1179 | .I mdadm | |
1180 | detects that it has fewer that this number when it first sees the | |
1181 | array, it will report a | |
1182 | .B SparesMissing | |
1183 | message. | |
1184 | ||
98c6faba NB |
1185 | .TP |
1186 | .B TestMessage | |
1187 | An array was found at startup, and the | |
1188 | .B --test | |
1189 | flag was given. | |
e0d19036 NB |
1190 | .RE |
1191 | ||
1192 | Only | |
98c6faba NB |
1193 | .B Fail , |
1194 | .B FailSpare , | |
1195 | .B DegradedArray , | |
e0d19036 | 1196 | and |
98c6faba | 1197 | .B TestMessage |
e0d19036 NB |
1198 | cause Email to be sent. All events cause the program to be run. |
1199 | The program is run with two or three arguments, they being the event | |
1200 | name, the array device and possibly a second device. | |
1201 | ||
1202 | Each event has an associated array device (e.g. | |
1203 | .BR /dev/md1 ) | |
1204 | and possibly a second device. For | |
1205 | .BR Fail , | |
1206 | .BR FailSpare , | |
1207 | and | |
1208 | .B SpareActive | |
1209 | the second device is the relevant component device. | |
1210 | For | |
1211 | .B MoveSpare | |
1212 | the second device is the array that the spare was moved from. | |
1213 | ||
1214 | For | |
1215 | .B mdadm | |
1216 | to move spares from one array to another, the different arrays need to | |
1217 | be labelled with the same | |
1218 | .B spare-group | |
1219 | in the configuration file. The | |
1220 | .B spare-group | |
1221 | name can be any string. It is only necessary that different spare | |
2d465520 | 1222 | groups use different names. |
e0d19036 NB |
1223 | |
1224 | When | |
9a9dab36 | 1225 | .B mdadm |
e0d19036 NB |
1226 | detects that an array which is in a spare group has fewer active |
1227 | devices than necessary for the complete array, and has no spare | |
1228 | devices, it will look for another array in the same spare group that | |
1229 | has a full complement of working drive and a spare. It will then | |
1230 | attempt to remove the spare from the second drive and add it to the | |
1231 | first. | |
1232 | If the removal succeeds but the adding fails, then it is added back to | |
1233 | the original array. | |
1234 | ||
dd0781e5 NB |
1235 | .SH GROW MODE |
1236 | The GROW mode is used for changing the size or shape of an active | |
1237 | array. | |
1238 | For this to work, the kernel must support the necessary change. | |
1239 | Various types of growth may be added during 2.6 development, possibly | |
1240 | including restructuring a raid5 array to have more active devices. | |
1241 | ||
dfd4d8ee NB |
1242 | Currently the only support available is to |
1243 | .IP \(bu 4 | |
1244 | change the "size" attribute | |
1245 | for RAID1, RAID5 and RAID6. | |
1246 | .IP \(bu 4 | |
1247 | change the "raid-disks" attribute of RAID1. | |
1248 | .IP \(bu 4 | |
1249 | add a write-intent bitmap to a RAID1 array. | |
1250 | .PP | |
dd0781e5 NB |
1251 | |
1252 | Normally when an array is build the "size" it taken from the smallest | |
1253 | of the drives. If all the small drives in an arrays are, one at a | |
1254 | time, removed and replaced with larger drives, then you could have an | |
1255 | array of large drives with only a small amount used. In this | |
1256 | situation, changing the "size" with "GROW" mode will allow the extra | |
1257 | space to start being used. If the size is increased in this way, a | |
1258 | "resync" process will start to make sure the new parts of the array | |
1259 | are synchronised. | |
1260 | ||
1261 | Note that when an array changes size, any filesystem that may be | |
1262 | stored in the array will not automatically grow to use the space. The | |
1263 | filesystem will need to be explicitly told to use the extra space. | |
1264 | ||
1265 | A RAID1 array can work with any number of devices from 1 upwards | |
1266 | (though 1 is not very useful). There may be times which you want to | |
1267 | increase or decrease the number of active devices. Note that this is | |
1268 | different to hot-add or hot-remove which changes the number of | |
1269 | inactive devices. | |
1270 | ||
1271 | When reducing the number of devices in a RAID1 array, the slots which | |
1272 | are to be removed from the array must already be vacant. That is, the | |
1273 | devices that which were in those slots must be failed and removed. | |
1274 | ||
1275 | When the number of devices is increased, any hot spares that are | |
1276 | present may be activated immediately. | |
1277 | ||
2d465520 NB |
1278 | .SH EXAMPLES |
1279 | ||
5787fa49 | 1280 | .B " mdadm --query /dev/name-of-device" |
2d465520 | 1281 | .br |
5787fa49 NB |
1282 | This will find out if a given device is a raid array, or is part of |
1283 | one, and will provide brief information about the device. | |
2d465520 | 1284 | |
5787fa49 | 1285 | .B " mdadm --assemble --scan" |
2d465520 | 1286 | .br |
5787fa49 NB |
1287 | This will assemble and start all arrays listed in the standard confile |
1288 | file. This command will typically go in a system startup file. | |
2d465520 | 1289 | |
2d465520 | 1290 | .B " mdadm --stop --scan" |
5787fa49 NB |
1291 | .br |
1292 | This will shut down all array that can be shut down (i.e. are not | |
19f8b8fc | 1293 | currently in use). This will typically go in a system shutdown script. |
2d465520 | 1294 | |
5787fa49 | 1295 | .B " mdadm --follow --scan --delay=120" |
2d465520 | 1296 | .br |
5787fa49 NB |
1297 | If (and only if) there is an Email address or program given in the |
1298 | standard config file, then | |
1299 | monitor the status of all arrays listed in that file by | |
1300 | polling them ever 2 minutes. | |
2d465520 | 1301 | |
5787fa49 | 1302 | .B " mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1" |
2d465520 | 1303 | .br |
5787fa49 | 1304 | Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1. |
2d465520 | 1305 | |
2d465520 NB |
1306 | .br |
1307 | .B " echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > mdadm.conf" | |
1308 | .br | |
1309 | .B " mdadm --detail --scan >> mdadm.conf" | |
1310 | .br | |
5787fa49 NB |
1311 | This will create a prototype config file that describes currently |
1312 | active arrays that are known to be made from partitions of IDE or SCSI drives. | |
2d465520 NB |
1313 | This file should be reviewed before being used as it may |
1314 | contain unwanted detail. | |
1315 | ||
2d465520 NB |
1316 | .B " echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' > mdadm.conf" |
1317 | .br | |
5787fa49 NB |
1318 | .B " mdadm --examine --scan --config=mdadm.conf >> mdadm.conf" |
1319 | .ber | |
1320 | This will find what arrays could be assembled from existign IDE and | |
1321 | SCSI whole drives (not partitions) and store the information is the | |
1322 | format of a config file. | |
2d465520 NB |
1323 | This file is very likely to contain unwanted detail, particularly |
1324 | the | |
1325 | .B devices= | |
5787fa49 NB |
1326 | entries. It should be reviewed and edited before being used as an |
1327 | actual config file. | |
2d465520 | 1328 | |
5787fa49 | 1329 | .B " mdadm --examine --brief --scan --config=partitions" |
2d465520 | 1330 | .br |
5787fa49 NB |
1331 | .B " mdadm -Ebsc partitions" |
1332 | .br | |
1333 | Create a list of devices by reading | |
1334 | .BR /proc/partitions , | |
1335 | scan these for RAID superblocks, and printout a brief listing of all | |
1336 | that was found. | |
2d465520 | 1337 | |
5787fa49 | 1338 | .B " mdadm -Ac partitions -m 0 /dev/md0" |
2d465520 | 1339 | .br |
5787fa49 NB |
1340 | Scan all partitions and devices listed in |
1341 | .BR /proc/partitions | |
1342 | and assemble | |
1343 | .B /dev/md0 | |
1344 | out of all such devices with a RAID superblock with a minor number of 0. | |
2d465520 | 1345 | |
d013a55e NB |
1346 | .B " mdadm --monitor --scan --daemonise > /var/run/mdadm" |
1347 | .br | |
1348 | If config file contains a mail address or alert program, run mdadm in | |
1349 | the background in monitor mode monitoring all md devices. Also write | |
1350 | pid of mdadm daemon to | |
1351 | .BR /var/run/mdadm . | |
1352 | ||
5787fa49 | 1353 | .B " mdadm --create --help" |
2d465520 | 1354 | .br |
5787fa49 | 1355 | Providew help about the Create mode. |
2d465520 | 1356 | |
5787fa49 NB |
1357 | .B " mdadm --config --help" |
1358 | .br | |
1359 | Provide help about the format of the config file. | |
2d465520 | 1360 | |
5787fa49 NB |
1361 | .B " mdadm --help" |
1362 | .br | |
1363 | Provide general help. | |
cd29a5c8 | 1364 | |
cd29a5c8 NB |
1365 | |
1366 | .SH FILES | |
1367 | ||
1368 | .SS /proc/mdstat | |
1369 | ||
1370 | If you're using the | |
1371 | .B /proc | |
1372 | filesystem, | |
1373 | .B /proc/mdstat | |
2d465520 NB |
1374 | lists all active md devices with information about them. |
1375 | .B mdadm | |
1376 | uses this to find arrays when | |
1377 | .B --scan | |
1378 | is given in Misc mode, and to monitor array reconstruction | |
1379 | on Monitor mode. | |
1380 | ||
cd29a5c8 | 1381 | |
9a9dab36 | 1382 | .SS /etc/mdadm.conf |
cd29a5c8 | 1383 | |
11a3e71d NB |
1384 | The config file lists which devices may be scanned to see if |
1385 | they contain MD super block, and gives identifying information | |
1386 | (e.g. UUID) about known MD arrays. See | |
1387 | .BR mdadm.conf (5) | |
1388 | for more details. | |
cd29a5c8 | 1389 | |
48f7b27a NB |
1390 | .SH DEVICE NAMES |
1391 | ||
1392 | While entries in the /dev directory can have any format you like, | |
1393 | .I mdadm | |
1394 | has an understanding of 'standard' formats which it uses to guide its | |
1395 | behaviour when creating device files via the | |
1396 | .I --auto | |
1397 | option. | |
1398 | ||
1399 | The standard names for non-partitioned arrays (the only sort of md | |
1400 | array available in 2.4 and earlier) either of | |
1401 | .IP | |
1402 | /dev/mdNN | |
1403 | .br | |
1404 | /dev/md/NN | |
1405 | .PP | |
1406 | where NN is a number. | |
1407 | The standard names for partitionable arrays (as available from 2.6 | |
1408 | onwards) is one of | |
1409 | .IP | |
1410 | /dev/md/dNN | |
1411 | .br | |
1412 | /dev/md_dNN | |
1413 | .PP | |
1414 | Partition numbers should be indicated by added "pMM" to these, thus "/dev/md/d1p2". | |
52826846 | 1415 | |
2d465520 NB |
1416 | .SH NOTE |
1417 | .B mdadm | |
1418 | was previously known as | |
1419 | .BR mdctl . | |
1420 | ||
52826846 | 1421 | .SH SEE ALSO |
cd29a5c8 NB |
1422 | For information on the various levels of |
1423 | RAID, check out: | |
1424 | ||
1425 | .IP | |
1426 | .UR http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/ | |
1427 | http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/ | |
1428 | .UE | |
1429 | .PP | |
1430 | for new releases of the RAID driver check out: | |
1431 | ||
1432 | .IP | |
1433 | .UR ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches | |
1434 | ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches | |
1435 | .UE | |
1436 | .PP | |
1437 | or | |
1438 | .IP | |
1439 | .UR http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/ | |
1440 | http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/ | |
1441 | .URk | |
1442 | .PP | |
56eb10c0 NB |
1443 | .BR mdadm.conf (5), |
1444 | .BR md (4). | |
1445 | .PP | |
52826846 NB |
1446 | .IR raidtab (5), |
1447 | .IR raid0run (8), | |
1448 | .IR raidstop (8), | |
1449 | .IR mkraid (8) |