]>
Commit | Line | Data |
---|---|---|
1 | .\" -*- nroff -*- | |
2 | .\" Copyright Neil Brown and others. | |
3 | .\" This program is free software; you can redistribute it and/or modify | |
4 | .\" it under the terms of the GNU General Public License as published by | |
5 | .\" the Free Software Foundation; either version 2 of the License, or | |
6 | .\" (at your option) any later version. | |
7 | .\" See file COPYING in distribution for details. | |
8 | .TH MDADM 8 "" v4.4 | |
9 | .SH NAME | |
10 | mdadm \- manage MD devices | |
11 | .I aka | |
12 | Linux Software RAID | |
13 | ||
14 | .SH SYNOPSIS | |
15 | ||
16 | .BI mdadm " [mode] <raiddevice> [options] <component-devices>" | |
17 | ||
18 | .SH DESCRIPTION | |
19 | RAID devices are virtual devices created from two or more | |
20 | real block devices. This allows multiple devices (typically disk | |
21 | drives or partitions thereof) to be combined into a single device to | |
22 | hold (for example) a single filesystem. | |
23 | Some RAID levels include redundancy and so can survive some degree of | |
24 | device failure. | |
25 | ||
26 | Linux Software RAID devices are implemented through the md (Multiple | |
27 | Devices) device driver. | |
28 | ||
29 | Currently, Linux supports | |
30 | .B LINEAR | |
31 | md devices, | |
32 | .B RAID0 | |
33 | (striping), | |
34 | .B RAID1 | |
35 | (mirroring), | |
36 | .BR RAID4 , | |
37 | .BR RAID5 , | |
38 | .BR RAID6 , | |
39 | .BR RAID10 , | |
40 | .BR MULTIPATH , | |
41 | .BR FAULTY , | |
42 | and | |
43 | .BR CONTAINER . | |
44 | ||
45 | .B MULTIPATH | |
46 | is not a Software RAID mechanism, but does involve | |
47 | multiple devices: | |
48 | each device is a path to one common physical storage device. | |
49 | New installations should not use md/multipath as it is not well | |
50 | supported and has no ongoing development. Use the Device Mapper based | |
51 | multipath-tools instead. It is deprecated and support will be removed in the future. | |
52 | ||
53 | .B FAULTY | |
54 | is also not true RAID, and it only involves one device. It | |
55 | provides a layer over a true device that can be used to inject faults. It is deprecated | |
56 | and support will be removed in the future. | |
57 | ||
58 | .B CONTAINER | |
59 | is different again. A | |
60 | .B CONTAINER | |
61 | is a collection of devices that are | |
62 | managed as a set. This is similar to the set of devices connected to | |
63 | a hardware RAID controller. The set of devices may contain a number | |
64 | of different RAID arrays each utilising some (or all) of the blocks from a | |
65 | number of the devices in the set. For example, two devices in a 5-device set | |
66 | might form a RAID1 using the whole devices. The remaining three might | |
67 | have a RAID5 over the first half of each device, and a RAID0 over the | |
68 | second half. | |
69 | ||
70 | With a | |
71 | .BR CONTAINER , | |
72 | there is one set of metadata that describes all of | |
73 | the arrays in the container. So when | |
74 | .I mdadm | |
75 | creates a | |
76 | .B CONTAINER | |
77 | device, the device just represents the metadata. Other normal arrays (RAID1 | |
78 | etc) can be created inside the container. | |
79 | ||
80 | .SH MODES | |
81 | mdadm has several major modes of operation: | |
82 | .TP | |
83 | .B Assemble | |
84 | Assemble the components of a previously created | |
85 | array into an active array. Components can be explicitly given | |
86 | or can be searched for. | |
87 | .I mdadm | |
88 | checks that the components | |
89 | do form a bona fide array, and can, on request, fiddle superblock | |
90 | information so as to assemble a faulty array. | |
91 | ||
92 | .TP | |
93 | .B Build | |
94 | Build an array that doesn't have per-device metadata (superblocks). For these | |
95 | sorts of arrays, | |
96 | .I mdadm | |
97 | cannot differentiate between initial creation and subsequent assembly | |
98 | of an array. It also cannot perform any checks that appropriate | |
99 | components have been requested. Because of this, the | |
100 | .B Build | |
101 | mode should only be used together with a complete understanding of | |
102 | what you are doing. | |
103 | ||
104 | .TP | |
105 | .B Create | |
106 | Create a new array with per-device metadata (superblocks). | |
107 | Appropriate metadata is written to each device, and then the array | |
108 | comprising those devices is activated. A 'resync' process is started | |
109 | to make sure that the array is consistent (e.g. both sides of a mirror | |
110 | contain the same data) but the content of the device is left otherwise | |
111 | untouched. | |
112 | The array can be used as soon as it has been created. There is no | |
113 | need to wait for the initial resync to finish. | |
114 | ||
115 | .TP | |
116 | .B "Follow or Monitor" | |
117 | Monitor one or more md devices and act on any state changes. This is | |
118 | only meaningful for RAID1, 4, 5, 6, 10 or multipath arrays, as | |
119 | only these have interesting state. RAID0 or Linear never have | |
120 | missing, spare, or failed drives, so there is nothing to monitor. | |
121 | ||
122 | .TP | |
123 | .B "Grow" | |
124 | Grow (or shrink) an array, or otherwise reshape it in some way. | |
125 | Currently supported growth options including changing the active size | |
126 | of component devices and changing the number of active devices in | |
127 | Linear and RAID levels 0/1/4/5/6, | |
128 | changing the RAID level between 0, 1, 5, and 6, and between 0 and 10, | |
129 | changing the chunk size and layout for RAID 0,4,5,6,10 as well as adding or | |
130 | removing a write-intent bitmap and changing the array's consistency policy. | |
131 | ||
132 | .TP | |
133 | .B "Incremental Assembly" | |
134 | Add a single device to an appropriate array. If the addition of the | |
135 | device makes the array runnable, the array will be started. | |
136 | This provides a convenient interface to a | |
137 | .I hot-plug | |
138 | system. As each device is detected, | |
139 | .I mdadm | |
140 | has a chance to include it in some array as appropriate. | |
141 | Optionally, when the | |
142 | .I \-\-fail | |
143 | flag is passed in we will remove the device from any active array | |
144 | instead of adding it. | |
145 | ||
146 | If a | |
147 | .B CONTAINER | |
148 | is passed to | |
149 | .I mdadm | |
150 | in this mode, then any arrays within that container will be assembled | |
151 | and started. | |
152 | ||
153 | .TP | |
154 | .B Manage | |
155 | This is for doing things to specific components of an array such as | |
156 | adding new spares and removing faulty devices. | |
157 | ||
158 | .TP | |
159 | .B Misc | |
160 | This is an 'everything else' mode that supports operations on active | |
161 | arrays, operations on component devices such as erasing old superblocks, and | |
162 | information-gathering operations. | |
163 | .\"This mode allows operations on independent devices such as examine MD | |
164 | .\"superblocks, erasing old superblocks and stopping active arrays. | |
165 | ||
166 | .TP | |
167 | .B Auto-detect | |
168 | This mode does not act on a specific device or array, but rather it | |
169 | requests the Linux Kernel to activate any auto-detected arrays. | |
170 | .SH OPTIONS | |
171 | ||
172 | .SH Options for selecting a mode are: | |
173 | ||
174 | .TP | |
175 | .BR \-A ", " \-\-assemble | |
176 | Assemble a pre-existing array. | |
177 | ||
178 | .TP | |
179 | .BR \-B ", " \-\-build | |
180 | Build a legacy array without superblocks. | |
181 | ||
182 | .TP | |
183 | .BR \-C ", " \-\-create | |
184 | Create a new array. | |
185 | ||
186 | .TP | |
187 | .BR \-F ", " \-\-follow ", " \-\-monitor | |
188 | Select | |
189 | .B Monitor | |
190 | mode. | |
191 | ||
192 | .TP | |
193 | .BR \-G ", " \-\-grow | |
194 | Change the size or shape of an active array. | |
195 | ||
196 | .TP | |
197 | .BR \-I ", " \-\-incremental | |
198 | Add/remove a single device to/from an appropriate array, and possibly start the array. | |
199 | ||
200 | .TP | |
201 | .B \-\-auto-detect | |
202 | Request that the kernel starts any auto-detected arrays. This can only | |
203 | work if | |
204 | .I md | |
205 | is compiled into the kernel \(em not if it is a module. | |
206 | Arrays can be auto-detected by the kernel if all the components are in | |
207 | primary MS-DOS partitions with partition type | |
208 | .BR FD , | |
209 | and all use v0.90 metadata. | |
210 | In-kernel autodetect is not recommended for new installations. Using | |
211 | .I mdadm | |
212 | to detect and assemble arrays \(em possibly in an | |
213 | .I initrd | |
214 | \(em is substantially more flexible and should be preferred. | |
215 | ||
216 | .P | |
217 | If a device is given before any options, or if the first option is | |
218 | one of | |
219 | .BR \-\-add , | |
220 | .BR \-\-re\-add , | |
221 | .BR \-\-add\-spare , | |
222 | .BR \-\-fail , | |
223 | .BR \-\-remove , | |
224 | or | |
225 | .BR \-\-replace , | |
226 | then the MANAGE mode is assumed. | |
227 | Anything other than these will cause the | |
228 | .B Misc | |
229 | mode to be assumed. | |
230 | ||
231 | .SH Options that are not mode-specific are: | |
232 | ||
233 | .TP | |
234 | .BR \-h ", " \-\-help | |
235 | Display a general help message or, after one of the above options, a | |
236 | mode-specific help message. | |
237 | ||
238 | .TP | |
239 | .B \-\-help\-options | |
240 | Display more detailed help about command-line parsing and some commonly | |
241 | used options. | |
242 | ||
243 | .TP | |
244 | .BR \-V ", " \-\-version | |
245 | Print version information for mdadm. | |
246 | ||
247 | .TP | |
248 | .BR \-v ", " \-\-verbose | |
249 | Be more verbose about what is happening. This can be used twice to be | |
250 | extra-verbose. | |
251 | The extra verbosity currently only affects | |
252 | .B \-\-detail \-\-scan | |
253 | and | |
254 | .BR "\-\-examine \-\-scan" . | |
255 | ||
256 | .TP | |
257 | .BR \-q ", " \-\-quiet | |
258 | Avoid printing purely informative messages. With this, | |
259 | .I mdadm | |
260 | will be silent unless there is something really important to report. | |
261 | ||
262 | ||
263 | .TP | |
264 | .BR \-f ", " \-\-force | |
265 | Be more forceful about certain operations. See the various modes for | |
266 | the exact meaning of this option in different contexts. | |
267 | ||
268 | .TP | |
269 | .BR \-c ", " \-\-config= | |
270 | Specify the config file or directory. If not specified, the default config file | |
271 | and default conf.d directory will be used. See | |
272 | .BR mdadm.conf (5) | |
273 | for more details. | |
274 | ||
275 | If the config file given is | |
276 | .B "partitions" | |
277 | then nothing will be read, but | |
278 | .I mdadm | |
279 | will act as though the config file contained exactly | |
280 | .br | |
281 | .B " DEVICE partitions containers" | |
282 | .br | |
283 | and will read | |
284 | .B /proc/partitions | |
285 | to find a list of devices to scan, and | |
286 | .B /proc/mdstat | |
287 | to find a list of containers to examine. | |
288 | If the word | |
289 | .B "none" | |
290 | is given for the config file, then | |
291 | .I mdadm | |
292 | will act as though the config file were empty. | |
293 | ||
294 | If the name given is of a directory, then | |
295 | .I mdadm | |
296 | will collect all the files contained in the directory with a name ending | |
297 | in | |
298 | .BR .conf , | |
299 | sort them lexically, and process all of those files as config files. | |
300 | ||
301 | .TP | |
302 | .BR \-s ", " \-\-scan | |
303 | Scan config file or | |
304 | .B /proc/mdstat | |
305 | for missing information. | |
306 | In general, this option gives | |
307 | .I mdadm | |
308 | permission to get any missing information (like component devices, | |
309 | array devices, array identities, and alert destination) from the | |
310 | configuration file (see previous option); | |
311 | one exception is MISC mode when using | |
312 | .B \-\-detail | |
313 | or | |
314 | .B \-\-stop, | |
315 | in which case | |
316 | .B \-\-scan | |
317 | says to get a list of array devices from | |
318 | .BR /proc/mdstat . | |
319 | ||
320 | .TP | |
321 | .BR \-e ", " \-\-metadata= | |
322 | Declare the style of RAID metadata (superblock) to be used. The | |
323 | default is {DEFAULT_METADATA} for | |
324 | .BR \-\-create , | |
325 | and to guess for other operations. | |
326 | The default can be overridden by setting the | |
327 | .B metadata | |
328 | value for the | |
329 | .B CREATE | |
330 | keyword in | |
331 | .BR mdadm.conf . | |
332 | ||
333 | Options are: | |
334 | .RS | |
335 | .ie '{DEFAULT_METADATA}'0.90' | |
336 | .IP "0, 0.90, default" | |
337 | .el | |
338 | .IP "0, 0.90" | |
339 | Use the original 0.90 format superblock. This format limits arrays to | |
340 | 28 component devices and limits component devices of levels 1 and | |
341 | greater to 2 terabytes. It is also possible for there to be confusion | |
342 | about whether the superblock applies to a whole device or just the | |
343 | last partition, if that partition starts on a 64K boundary. | |
344 | .ie '{DEFAULT_METADATA}'0.90' | |
345 | .IP "1, 1.0, 1.1, 1.2" | |
346 | .el | |
347 | .IP "1, 1.0, 1.1, 1.2 default" | |
348 | Use the new version-1 format superblock. This has fewer restrictions. | |
349 | It can easily be moved between hosts with different endian-ness, and a | |
350 | recovery operation can be checkpointed and restarted. The different | |
351 | sub-versions store the superblock at different locations on the | |
352 | device, either at the end (for 1.0), at the start (for 1.1) or 4K from | |
353 | the start (for 1.2). "1" is equivalent to "1.2" (the commonly | |
354 | preferred 1.x format). | |
355 | 'if '{DEFAULT_METADATA}'1.2' "default" is equivalent to "1.2". | |
356 | .IP ddf | |
357 | Use the "Industry Standard" DDF (Disk Data Format) format defined by | |
358 | SNIA. DDF is deprecated and there is no active development around it. | |
359 | When creating a DDF array a | |
360 | .B CONTAINER | |
361 | will be created, and normal arrays can be created in that container. | |
362 | .IP imsm | |
363 | Use the Intel(R) Matrix Storage Manager metadata format. This creates a | |
364 | .B CONTAINER | |
365 | which is managed in a similar manner to DDF, and is supported by an | |
366 | option-rom on some platforms: | |
367 | .IP | |
368 | .B https://www.intel.com/content/www/us/en/support/products/122484 | |
369 | .PP | |
370 | .RE | |
371 | ||
372 | .TP | |
373 | .B \-\-homehost= | |
374 | This will override any | |
375 | .B HOMEHOST | |
376 | setting in the config file and provides the identity of the host which | |
377 | should be considered the home for any arrays. | |
378 | ||
379 | When creating an array, the | |
380 | .B homehost | |
381 | will be recorded in the metadata. For version-1 superblocks, it will | |
382 | be prefixed to the array name. For version-0.90 superblocks, part of | |
383 | the SHA1 hash of the hostname will be stored in the latter half of the | |
384 | UUID. | |
385 | ||
386 | When reporting information about an array, any array which is tagged | |
387 | for the given homehost will be reported as such. | |
388 | ||
389 | When using Auto-Assemble, only arrays tagged for the given homehost | |
390 | will be allowed to use 'local' names (i.e. not ending in '_' followed | |
391 | by a digit string). See below under | |
392 | .BR "Auto-Assembly" . | |
393 | ||
394 | The special name "\fBany\fP" can be used as a wild card. If an array | |
395 | is created with | |
396 | .B --homehost=any | |
397 | then the name "\fBany\fP" will be stored in the array and it can be | |
398 | assembled in the same way on any host. If an array is assembled with | |
399 | this option, then the homehost recorded on the array will be ignored. | |
400 | ||
401 | .TP | |
402 | .B \-\-prefer= | |
403 | When | |
404 | .I mdadm | |
405 | needs to print the name for a device it normally finds the name in | |
406 | .B /dev | |
407 | which refers to the device and is the shortest. When a path component is | |
408 | given with | |
409 | .B \-\-prefer | |
410 | .I mdadm | |
411 | will prefer a longer name if it contains that component. For example | |
412 | .B \-\-prefer=by-uuid | |
413 | will prefer a name in a subdirectory of | |
414 | .B /dev | |
415 | called | |
416 | .BR by-uuid . | |
417 | ||
418 | This functionality is currently only provided by | |
419 | .B \-\-detail | |
420 | and | |
421 | .BR \-\-monitor . | |
422 | ||
423 | .TP | |
424 | .B \-\-home\-cluster= | |
425 | specifies the cluster name for the md device. The md device can be assembled | |
426 | only on the cluster which matches the name specified. If this option is not | |
427 | provided, mdadm tries to detect the cluster name automatically. | |
428 | ||
429 | .SH For create, build, or grow: | |
430 | ||
431 | .TP | |
432 | .BR \-n ", " \-\-raid\-devices= | |
433 | Specify the number of active devices in the array. This, plus the | |
434 | number of spare devices (see below) must equal the number of | |
435 | .I component-devices | |
436 | (including "\fBmissing\fP" devices) | |
437 | that are listed on the command line for | |
438 | .BR \-\-create . | |
439 | Setting a value of 1 is probably | |
440 | a mistake and so requires that | |
441 | .B \-\-force | |
442 | be specified first. A value of 1 will then be allowed for linear, | |
443 | multipath, RAID0 and RAID1. It is never allowed for RAID4, RAID5 or RAID6. | |
444 | .br | |
445 | This number can only be changed using | |
446 | .B \-\-grow | |
447 | for RAID1, RAID4, RAID5 and RAID6 arrays. | |
448 | ||
449 | .TP | |
450 | .BR \-x ", " \-\-spare\-devices= | |
451 | Specify the number of spare (eXtra) devices in the initial array. | |
452 | Spares can also be added | |
453 | and removed later. The number of component devices listed | |
454 | on the command line must equal the number of RAID devices plus the | |
455 | number of spare devices. | |
456 | ||
457 | .TP | |
458 | .BR \-z ", " \-\-size= | |
459 | Amount (in Kilobytes) of space to use from each drive in RAID levels 1/4/5/6/10 | |
460 | and for RAID 0 on external metadata. | |
461 | This must be a multiple of the chunk size, and must leave about 128Kb | |
462 | of space at the end of the drive for the RAID superblock. | |
463 | If this is not specified | |
464 | (as it normally is not) the smallest drive (or partition) sets the | |
465 | size, though if there is a variance among the drives of greater than 1%, a warning is | |
466 | issued. | |
467 | ||
468 | A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, | |
469 | Megabytes, Gigabytes or Terabytes respectively. | |
470 | ||
471 | Sometimes a replacement drive can be a little smaller than the | |
472 | original drives though this should be minimised by IDEMA standards. | |
473 | Such a replacement drive will be rejected by | |
474 | .IR md . | |
475 | To guard against this it can be useful to set the initial size | |
476 | slightly smaller than the smaller device with the aim that it will | |
477 | still be larger than any replacement. | |
478 | ||
479 | This option can be used with | |
480 | .B \-\-create | |
481 | for determining the initial size of an array. For external metadata, | |
482 | it can be used on a volume, but not on a container itself. | |
483 | Setting the initial size of | |
484 | .B RAID 0 | |
485 | array is only valid for external metadata. | |
486 | ||
487 | This value can be set with | |
488 | .B \-\-grow | |
489 | for RAID level 1/4/5/6/10 though | |
490 | DDF arrays may not be able to support this. | |
491 | RAID 0 array size cannot be changed. | |
492 | If the array was created with a size smaller than the currently | |
493 | active drives, the extra space can be accessed using | |
494 | .BR \-\-grow . | |
495 | The size can be given as | |
496 | .B max | |
497 | which means to choose the largest size that fits on all current drives. | |
498 | ||
499 | Before reducing the size of the array (with | |
500 | .BR "\-\-grow \-\-size=" ) | |
501 | you should make sure that space isn't needed. If the device holds a | |
502 | filesystem, you would need to resize the filesystem to use less space. | |
503 | ||
504 | After reducing the array size you should check that the data stored in | |
505 | the device is still available. If the device holds a filesystem, then | |
506 | an 'fsck' of the filesystem is a minimum requirement. If there are | |
507 | problems the array can be made bigger again with no loss with another | |
508 | .B "\-\-grow \-\-size=" | |
509 | command. | |
510 | ||
511 | .TP | |
512 | .BR \-Z ", " \-\-array\-size= | |
513 | This is only meaningful with | |
514 | .B \-\-grow | |
515 | and its effect is not persistent: when the array is stopped and | |
516 | restarted the default array size will be restored. | |
517 | ||
518 | Setting the array-size causes the array to appear smaller to programs | |
519 | that access the data. This is particularly needed before reshaping an | |
520 | array so that it will be smaller. As the reshape is not reversible, | |
521 | but setting the size with | |
522 | .B \-\-array-size | |
523 | is, it is required that the array size is reduced as appropriate | |
524 | before the number of devices in the array is reduced. | |
525 | ||
526 | Before reducing the size of the array you should make sure that space | |
527 | isn't needed. If the device holds a filesystem, you would need to | |
528 | resize the filesystem to use less space. | |
529 | ||
530 | After reducing the array size you should check that the data stored in | |
531 | the device is still available. If the device holds a filesystem, then | |
532 | an 'fsck' of the filesystem is a minimum requirement. If there are | |
533 | problems the array can be made bigger again with no loss with another | |
534 | .B "\-\-grow \-\-array\-size=" | |
535 | command. | |
536 | ||
537 | A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, | |
538 | Megabytes, Gigabytes or Terabytes respectively. | |
539 | A value of | |
540 | .B max | |
541 | restores the apparent size of the array to be whatever the real | |
542 | amount of available space is. | |
543 | ||
544 | Clustered arrays do not support this parameter yet. | |
545 | ||
546 | .TP | |
547 | .BR \-c ", " \-\-chunk= | |
548 | Specify chunk size in kilobytes. The default when creating an | |
549 | array is 512KB. To ensure compatibility with earlier versions, the | |
550 | default when building an array with no persistent metadata is 64KB. | |
551 | This is only meaningful for RAID0, RAID4, RAID5, RAID6, and RAID10. | |
552 | ||
553 | RAID4, RAID5, RAID6, and RAID10 require the chunk size to be a power | |
554 | of 2, with minimal chunk size being 4KB. | |
555 | ||
556 | A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, | |
557 | Megabytes, Gigabytes or Terabytes respectively. | |
558 | ||
559 | .TP | |
560 | .BR \-\-rounding= | |
561 | Specify the rounding factor for a Linear array. The size of each | |
562 | component will be rounded down to a multiple of this size. | |
563 | This is a synonym for | |
564 | .B \-\-chunk | |
565 | but highlights the different meaning for Linear as compared to other | |
566 | RAID levels. The default is 0K (i.e. no rounding). | |
567 | ||
568 | .TP | |
569 | .BR \-l ", " \-\-level= | |
570 | Set RAID level. When used with | |
571 | .BR \-\-create , | |
572 | options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4, | |
573 | raid5, 5, raid6, 6, raid10, 10, multipath, mp, faulty, container. | |
574 | Obviously some of these are synonymous. | |
575 | ||
576 | When a | |
577 | .B CONTAINER | |
578 | metadata type is requested, only the | |
579 | .B container | |
580 | level is permitted, and it does not need to be explicitly given. | |
581 | ||
582 | When used with | |
583 | .BR \-\-build , | |
584 | only linear, stripe, raid0, 0, raid1, multipath, mp, and faulty are valid. | |
585 | ||
586 | Can be used with | |
587 | .B \-\-grow | |
588 | to change the RAID level in some cases. See LEVEL CHANGES below. | |
589 | ||
590 | .TP | |
591 | .BR \-p ", " \-\-layout= | |
592 | This option configures the fine details of data layout for RAID5, RAID6, | |
593 | and RAID10 arrays, and controls the failure modes for | |
594 | .IR faulty . | |
595 | It can also be used for working around a kernel bug with RAID0, but generally | |
596 | doesn't need to be used explicitly. | |
597 | ||
598 | The layout of the RAID5 parity block can be one of | |
599 | .BR left\-asymmetric , | |
600 | .BR left\-symmetric , | |
601 | .BR right\-asymmetric , | |
602 | .BR right\-symmetric , | |
603 | .BR la ", " ra ", " ls ", " rs . | |
604 | The default is | |
605 | .BR left\-symmetric . | |
606 | ||
607 | It is also possible to cause RAID5 to use a RAID4-like layout by | |
608 | choosing | |
609 | .BR parity\-first , | |
610 | or | |
611 | .BR parity\-last . | |
612 | ||
613 | Finally for RAID5 there are DDF\-compatible layouts, | |
614 | .BR ddf\-zero\-restart , | |
615 | .BR ddf\-N\-restart , | |
616 | and | |
617 | .BR ddf\-N\-continue . | |
618 | ||
619 | These same layouts are available for RAID6. There are also 4 layouts | |
620 | that will provide an intermediate stage for converting between RAID5 | |
621 | and RAID6. These provide a layout which is identical to the | |
622 | corresponding RAID5 layout on the first N\-1 devices, and has the 'Q' | |
623 | syndrome (the second 'parity' block used by RAID6) on the last device. | |
624 | These layouts are: | |
625 | .BR left\-symmetric\-6 , | |
626 | .BR right\-symmetric\-6 , | |
627 | .BR left\-asymmetric\-6 , | |
628 | .BR right\-asymmetric\-6 , | |
629 | and | |
630 | .BR parity\-first\-6 . | |
631 | ||
632 | When setting the failure mode for level | |
633 | .I faulty, | |
634 | the options are: | |
635 | .BR write\-transient ", " wt , | |
636 | .BR read\-transient ", " rt , | |
637 | .BR write\-persistent ", " wp , | |
638 | .BR read\-persistent ", " rp , | |
639 | .BR write\-all , | |
640 | .BR read\-fixable ", " rf , | |
641 | .BR clear ", " flush ", " none . | |
642 | ||
643 | Each failure mode can be followed by a number, which is used as a period | |
644 | between fault generation. Without a number, the fault is generated | |
645 | once on the first relevant request. With a number, the fault will be | |
646 | generated after that many requests, and will continue to be generated | |
647 | every time the period elapses. | |
648 | ||
649 | Multiple failure modes can be current simultaneously by using the | |
650 | .B \-\-grow | |
651 | option to set subsequent failure modes. | |
652 | ||
653 | "clear" or "none" will remove any pending or periodic failure modes, | |
654 | and "flush" will clear any persistent faults. | |
655 | ||
656 | The layout options for RAID10 are one of 'n', 'o' or 'f' followed | |
657 | by a small number signifying the number of copies of each datablock. | |
658 | The default is 'n2'. The supported options are: | |
659 | ||
660 | .I 'n' | |
661 | signals 'near' copies. Multiple copies of one data block are at | |
662 | similar offsets in different devices. | |
663 | ||
664 | .I 'o' | |
665 | signals 'offset' copies. Rather than the chunks being duplicated | |
666 | within a stripe, whole stripes are duplicated but are rotated by one | |
667 | device so duplicate blocks are on different devices. Thus subsequent | |
668 | copies of a block are in the next drive, and are one chunk further | |
669 | down. | |
670 | ||
671 | .I 'f' | |
672 | signals 'far' copies | |
673 | (multiple copies have very different offsets). | |
674 | See md(4) for more detail about 'near', 'offset', and 'far'. | |
675 | ||
676 | As for the number of copies of each data block, 2 is normal, 3 | |
677 | can be useful. This number can be at most equal to the number of | |
678 | devices in the array. It does not need to divide evenly into that | |
679 | number (e.g. it is perfectly legal to have an 'n2' layout for an array | |
680 | with an odd number of devices). | |
681 | ||
682 | A bug introduced in Linux 3.14 means that RAID0 arrays | |
683 | .B "with devices of differing sizes" | |
684 | started using a different layout. This could lead to | |
685 | data corruption. Since Linux 5.4 (and various stable releases that received | |
686 | backports), the kernel will not accept such an array unless | |
687 | a layout is explicitly set. It can be set to | |
688 | .RB ' original ' | |
689 | or | |
690 | .RB ' alternate '. | |
691 | When creating a new array, | |
692 | .I mdadm | |
693 | will select | |
694 | .RB ' original ' | |
695 | by default, so the layout does not normally need to be set. | |
696 | An array created for either | |
697 | .RB ' original ' | |
698 | or | |
699 | .RB ' alternate ' | |
700 | will not be recognized by an (unpatched) kernel prior to 5.4. To create | |
701 | a RAID0 array with devices of differing sizes that can be used on an | |
702 | older kernel, you can set the layout to | |
703 | .RB ' dangerous '. | |
704 | This will use whichever layout the running kernel supports, so the data | |
705 | on the array may become corrupt when changing kernel from pre-3.14 to a | |
706 | later kernel. | |
707 | ||
708 | When an array is converted between RAID5 and RAID6 an intermediate | |
709 | RAID6 layout is used in which the second parity block (Q) is always on | |
710 | the last device. To convert a RAID5 to RAID6 and leave it in this new | |
711 | layout (which does not require re-striping) use | |
712 | .BR \-\-layout=preserve . | |
713 | This will try to avoid any restriping. | |
714 | ||
715 | The converse of this is | |
716 | .B \-\-layout=normalise | |
717 | which will change a non-standard RAID6 layout into a more standard | |
718 | arrangement. | |
719 | ||
720 | .TP | |
721 | .BR \-\-parity= | |
722 | same as | |
723 | .B \-\-layout | |
724 | (thus explaining the p of | |
725 | .BR \-p ). | |
726 | ||
727 | .TP | |
728 | .BR \-b ", " \-\-bitmap= | |
729 | Specify how to store a write-intent bitmap. Following values are supported: | |
730 | ||
731 | .B internal | |
732 | - the bitmap is stored with the metadata on the array and so is replicated on all devices. | |
733 | ||
734 | .B clustered | |
735 | - the array is created for a clustered environment. One bitmap is created for each node as defined | |
736 | by the | |
737 | .B \-\-nodes | |
738 | parameter and are stored internally. | |
739 | ||
740 | .B none | |
741 | - create array with no bitmap or remove any present bitmap (grow mode). | |
742 | ||
743 | .TP | |
744 | .BR \-\-bitmap\-chunk= | |
745 | Set the chunk size of the bitmap. Each bit corresponds to that many | |
746 | Kilobytes of storage. | |
747 | ||
748 | .B internal | |
749 | bitmap, the chunk size defaults to 64Meg, or larger if necessary to | |
750 | fit the bitmap into the available space. | |
751 | ||
752 | A suffix of 'K', 'M', 'G' or 'T' can be given to indicate Kilobytes, | |
753 | Megabytes, Gigabytes or Terabytes respectively. | |
754 | ||
755 | .TP | |
756 | .BR \-W ", " \-\-write\-mostly | |
757 | subsequent devices listed in a | |
758 | .BR \-\-build , | |
759 | .BR \-\-create , | |
760 | or | |
761 | .B \-\-add | |
762 | command will be flagged as 'write\-mostly'. This is valid for RAID1 | |
763 | only and means that the 'md' driver will avoid reading from these | |
764 | devices if at all possible. This can be useful if mirroring over a | |
765 | slow link. | |
766 | ||
767 | .TP | |
768 | .BR \-\-write\-behind= | |
769 | Specify that write-behind mode should be enabled (valid for RAID1 | |
770 | only). If an argument is specified, it will set the maximum number | |
771 | of outstanding writes allowed. The default value is 256. | |
772 | A write-intent bitmap is required in order to use write-behind | |
773 | mode, and write-behind is only attempted on drives marked as | |
774 | .IR write-mostly . | |
775 | ||
776 | .TP | |
777 | .BR \-\-failfast | |
778 | subsequent devices listed in a | |
779 | .B \-\-create | |
780 | or | |
781 | .B \-\-add | |
782 | command will be flagged as 'failfast'. This is valid for RAID1 and | |
783 | RAID10 only. IO requests to these devices will be encouraged to fail | |
784 | quickly rather than cause long delays due to error handling. Also no | |
785 | attempt is made to repair a read error on these devices. | |
786 | ||
787 | If an array becomes degraded so that the 'failfast' device is the only | |
788 | usable device, the 'failfast' flag will then be ignored and extended | |
789 | delays will be preferred to complete failure. | |
790 | ||
791 | The 'failfast' flag is appropriate for storage arrays which have a | |
792 | low probability of true failure, but which may sometimes | |
793 | cause unacceptable delays due to internal maintenance functions. | |
794 | ||
795 | .TP | |
796 | .BR \-\-assume\-clean | |
797 | Tell | |
798 | .I mdadm | |
799 | that the array pre-existed and is known to be clean. It can be useful | |
800 | when trying to recover from a major failure as you can be sure that no | |
801 | data will be affected unless you actually write to the array. It can | |
802 | also be used when creating a RAID1 or RAID10 if you want to avoid the | |
803 | initial resync, however this practice \(em while normally safe \(em is not | |
804 | recommended. Use this only if you really know what you are doing. | |
805 | .IP | |
806 | When the devices that will be part of a new array were filled | |
807 | with zeros before creation the operator knows the array is | |
808 | actually clean. If that is the case, such as after running | |
809 | badblocks, this argument can be used to tell mdadm the | |
810 | facts the operator knows. | |
811 | .IP | |
812 | When an array is resized to a larger size with | |
813 | .B "\-\-grow \-\-size=" | |
814 | the new space is normally resynced in that same way that the whole | |
815 | array is resynced at creation. | |
816 | .B \-\-assume\-clean | |
817 | can be used with that command to avoid the automatic resync. | |
818 | ||
819 | .TP | |
820 | .BR \-\-write-zeroes | |
821 | When creating an array, send write zeroes requests to all the block | |
822 | devices. This should zero the data area on all disks such that the | |
823 | initial sync is not necessary and, if successful, will behave as if | |
824 | .B \-\-assume\-clean | |
825 | was specified. | |
826 | .IP | |
827 | This is intended for use with devices that have hardware offload for | |
828 | zeroing, but despite this zeroing can still take several minutes for | |
829 | large disks. Thus a message is printed before and after zeroing and | |
830 | each disk is zeroed in parallel with the others. | |
831 | .IP | |
832 | This is only meaningful with --create. | |
833 | ||
834 | .TP | |
835 | .BR \-\-backup\-file= | |
836 | This is needed when | |
837 | .B \-\-grow | |
838 | is used to increase the number of raid devices in a RAID5 or RAID6 if | |
839 | there are no spare devices available, or to shrink, change RAID level | |
840 | or layout. See the GROW MODE section below on RAID\-DEVICES CHANGES. | |
841 | The file must be stored on a separate device, not on the RAID array | |
842 | being reshaped. | |
843 | ||
844 | .TP | |
845 | .B \-\-data\-offset= | |
846 | Arrays with 1.x metadata can leave a gap between the start of the | |
847 | device and the start of array data. This gap can be used for various | |
848 | metadata. The start of data is known as the | |
849 | .IR data\-offset . | |
850 | Normally an appropriate data offset is computed automatically. | |
851 | However it can be useful to set it explicitly such as when re-creating | |
852 | an array which was originally created using a different version of | |
853 | .I mdadm | |
854 | which computed a different offset. | |
855 | ||
856 | Setting the offset explicitly over-rides the default. The value given | |
857 | is in Kilobytes unless a suffix of 'K', 'M', 'G' or 'T' is used to explicitly | |
858 | indicate Kilobytes, Megabytes, Gigabytes or Terabytes respectively. | |
859 | ||
860 | .B \-\-data\-offset | |
861 | can also be used with | |
862 | .B --grow | |
863 | for some RAID levels (initially on RAID10). This allows the | |
864 | data\-offset to be changed as part of the reshape process. When the | |
865 | data offset is changed, no backup file is required as the difference | |
866 | in offsets is used to provide the same functionality. | |
867 | ||
868 | When the new offset is earlier than the old offset, the number of | |
869 | devices in the array cannot shrink. When it is after the old offset, | |
870 | the number of devices in the array cannot increase. | |
871 | ||
872 | When creating an array, | |
873 | .B \-\-data\-offset | |
874 | can be specified as | |
875 | .BR variable . | |
876 | In the case each member device is expected to have an offset appended | |
877 | to the name, separated by a colon. This makes it possible to recreate | |
878 | exactly an array which has varying data offsets (as can happen when | |
879 | different versions of | |
880 | .I mdadm | |
881 | are used to add different devices). | |
882 | ||
883 | .TP | |
884 | .BR \-N ", " \-\-name= | |
885 | Set a | |
886 | .B name | |
887 | for the array. It cannot be longer than 32 chars. This is effective when | |
888 | creating an array with a v1 metadata, or an external array. | |
889 | ||
890 | If name is needed but not specified, it is taken from the basename of the device | |
891 | that is being created. See | |
892 | .BR "DEVICE NAMES" | |
893 | ||
894 | .TP | |
895 | .BR \-R ", " \-\-run | |
896 | Insist that | |
897 | .I mdadm | |
898 | run the array, even if some of the components | |
899 | appear to be active in another array or filesystem. Normally | |
900 | .I mdadm | |
901 | will ask for confirmation before including such components in an | |
902 | array. This option causes that question to be suppressed. | |
903 | ||
904 | .TP | |
905 | .BR \-f ", " \-\-force | |
906 | Insist that | |
907 | .I mdadm | |
908 | accept the geometry and layout specified without question. Normally | |
909 | .I mdadm | |
910 | will not allow the creation of an array with only one device, and will try | |
911 | to create a RAID5 array with one missing drive (as this makes the | |
912 | initial resync work faster). With | |
913 | .BR \-\-force , | |
914 | .I mdadm | |
915 | will not try to be so clever. | |
916 | ||
917 | .TP | |
918 | .BR \-o ", " \-\-readonly | |
919 | Start the array | |
920 | .B read only | |
921 | rather than read-write as normal. No writes will be allowed to the | |
922 | array, and no resync, recovery, or reshape will be started. It works with | |
923 | Create, Assemble, Manage and Misc mode. | |
924 | ||
925 | .TP | |
926 | .BR \-a ", " "\-\-add" | |
927 | This option can be used in Grow mode in two cases. | |
928 | ||
929 | If the target array is a Linear array, then | |
930 | .B \-\-add | |
931 | can be used to add one or more devices to the array. They | |
932 | are simply catenated on to the end of the array. Once added, the | |
933 | devices cannot be removed. | |
934 | ||
935 | If the | |
936 | .B \-\-raid\-disks | |
937 | option is being used to increase the number of devices in an array, | |
938 | then | |
939 | .B \-\-add | |
940 | can be used to add some extra devices to be included in the array. | |
941 | In most cases this is not needed as the extra devices can be added as | |
942 | spares first, and then the number of raid disks can be changed. | |
943 | However, for RAID0 it is not possible to add spares. So to increase | |
944 | the number of devices in a RAID0, it is necessary to set the new | |
945 | number of devices, and to add the new devices, in the same command. | |
946 | ||
947 | .TP | |
948 | .BR \-\-nodes | |
949 | Only works when the array is created for a clustered environment. It specifies | |
950 | the maximum number of nodes in the cluster that will use this device | |
951 | simultaneously. If not specified, this defaults to 4. | |
952 | ||
953 | .TP | |
954 | .BR \-\-write-journal | |
955 | Specify journal device for the RAID-4/5/6 array. The journal device | |
956 | should be an SSD with a reasonable lifetime. | |
957 | ||
958 | .TP | |
959 | .BR \-k ", " \-\-consistency\-policy= | |
960 | Specify how the array maintains consistency in the case of an unexpected shutdown. | |
961 | Only relevant for RAID levels with redundancy. | |
962 | Currently supported options are: | |
963 | .RS | |
964 | ||
965 | .TP | |
966 | .B resync | |
967 | Full resync is performed and all redundancy is regenerated when the array is | |
968 | started after an unclean shutdown. | |
969 | ||
970 | .TP | |
971 | .B bitmap | |
972 | Resync assisted by a write-intent bitmap. Implicitly selected when using | |
973 | .BR \-\-bitmap . | |
974 | ||
975 | .TP | |
976 | .B journal | |
977 | For RAID levels 4/5/6, the journal device is used to log transactions and replay | |
978 | after an unclean shutdown. Implicitly selected when using | |
979 | .BR \-\-write\-journal . | |
980 | ||
981 | .TP | |
982 | .B ppl | |
983 | For RAID5 only, Partial Parity Log is used to close the write hole and | |
984 | eliminate resync. PPL is stored in the metadata region of RAID member drives, | |
985 | no additional journal drive is needed. | |
986 | ||
987 | .PP | |
988 | Can be used with \-\-grow to change the consistency policy of an active array | |
989 | in some cases. See CONSISTENCY POLICY CHANGES below. | |
990 | .RE | |
991 | ||
992 | ||
993 | .SH For assemble: | |
994 | ||
995 | .TP | |
996 | .BR \-u ", " \-\-uuid= | |
997 | uuid of array to assemble. Devices which don't have this uuid are | |
998 | excluded | |
999 | ||
1000 | .TP | |
1001 | .BR \-m ", " \-\-super\-minor= | |
1002 | Minor number of device that array was created for. Devices which | |
1003 | don't have this minor number are excluded. If you create an array as | |
1004 | /dev/md1, then all superblocks will contain the minor number 1, even if | |
1005 | the array is later assembled as /dev/md2. | |
1006 | ||
1007 | Giving the literal word "dev" for | |
1008 | .B \-\-super\-minor | |
1009 | will cause | |
1010 | .I mdadm | |
1011 | to use the minor number of the md device that is being assembled. | |
1012 | e.g. when assembling | |
1013 | .BR /dev/md0 , | |
1014 | .B \-\-super\-minor=dev | |
1015 | will look for super blocks with a minor number of 0. | |
1016 | ||
1017 | .B \-\-super\-minor | |
1018 | is only relevant for v0.90 metadata, and should not normally be used. | |
1019 | Using | |
1020 | .B \-\-uuid | |
1021 | is much safer. | |
1022 | ||
1023 | .TP | |
1024 | .BR \-N ", " \-\-name= | |
1025 | Specify the name of the array to assemble. It cannot be longer than 32 chars. | |
1026 | This must be the name that was specified when creating the array. It must | |
1027 | either match the name stored in the superblock exactly, or it must match | |
1028 | with the current | |
1029 | .I homehost | |
1030 | prefixed to the start of the given name. | |
1031 | ||
1032 | .TP | |
1033 | .BR \-f ", " \-\-force | |
1034 | Assemble the array even if the metadata on some devices appears to be | |
1035 | out-of-date. If | |
1036 | .I mdadm | |
1037 | cannot find enough working devices to start the array, but can find | |
1038 | some devices that are recorded as having failed, then it will mark | |
1039 | those devices as working so that the array can be started. This works only for | |
1040 | native. For external metadata it allows to start dirty degraded RAID 4, 5, 6. | |
1041 | An array which requires | |
1042 | .B \-\-force | |
1043 | to be started may contain data corruption. Use it carefully. | |
1044 | ||
1045 | .TP | |
1046 | .BR \-R ", " \-\-run | |
1047 | Attempt to start the array even if fewer drives were given than were | |
1048 | present last time the array was active. Normally if not all the | |
1049 | expected drives are found and | |
1050 | .B \-\-scan | |
1051 | is not used, then the array will be assembled but not started. | |
1052 | With | |
1053 | .B \-\-run | |
1054 | an attempt will be made to start it anyway. | |
1055 | ||
1056 | .TP | |
1057 | .B \-\-no\-degraded | |
1058 | This is the reverse of | |
1059 | .B \-\-run | |
1060 | in that it inhibits the startup of array unless all expected drives | |
1061 | are present. This is only needed with | |
1062 | .B \-\-scan, | |
1063 | and can be used if the physical connections to devices are | |
1064 | not as reliable as you would like. | |
1065 | ||
1066 | .TP | |
1067 | .BR \-\-backup\-file= | |
1068 | If | |
1069 | .B \-\-backup\-file | |
1070 | was used while reshaping an array (e.g. changing number of devices or | |
1071 | chunk size) and the system crashed during the critical section, then the same | |
1072 | .B \-\-backup\-file | |
1073 | must be presented to | |
1074 | .B \-\-assemble | |
1075 | to allow possibly corrupted data to be restored, and the reshape | |
1076 | to be completed. | |
1077 | ||
1078 | .TP | |
1079 | .BR \-\-invalid\-backup | |
1080 | If the file needed for the above option is not available for any | |
1081 | reason an empty file can be given together with this option to | |
1082 | indicate that the backup file is invalid. In this case the data that | |
1083 | was being rearranged at the time of the crash could be irrecoverably | |
1084 | lost, but the rest of the array may still be recoverable. This option | |
1085 | should only be used as a last resort if there is no way to recover the | |
1086 | backup file. | |
1087 | ||
1088 | ||
1089 | .TP | |
1090 | .BR \-U ", " \-\-update= | |
1091 | Update the superblock on each device while assembling the array. The | |
1092 | argument given to this flag can be one of | |
1093 | .BR summaries , | |
1094 | .BR uuid , | |
1095 | .BR name , | |
1096 | .BR nodes , | |
1097 | .BR homehost , | |
1098 | .BR home-cluster , | |
1099 | .BR resync , | |
1100 | .BR byteorder , | |
1101 | .BR devicesize , | |
1102 | .BR no\-bitmap , | |
1103 | .BR bbl , | |
1104 | .BR no\-bbl , | |
1105 | .BR ppl , | |
1106 | .BR no\-ppl , | |
1107 | .BR layout\-original , | |
1108 | .BR layout\-alternate , | |
1109 | .BR layout\-unspecified , | |
1110 | .BR metadata , | |
1111 | or | |
1112 | .BR super\-minor . | |
1113 | ||
1114 | The | |
1115 | .B super\-minor | |
1116 | option will update the | |
1117 | .B "preferred minor" | |
1118 | field on each superblock to match the minor number of the array being | |
1119 | assembled. | |
1120 | This can be useful if | |
1121 | .B \-\-examine | |
1122 | reports a different "Preferred Minor" to | |
1123 | .BR \-\-detail . | |
1124 | In some cases this update will be performed automatically | |
1125 | by the kernel driver. In particular, the update happens automatically | |
1126 | at the first write to an array with redundancy (RAID level 1 or | |
1127 | greater). | |
1128 | ||
1129 | The | |
1130 | .B uuid | |
1131 | option will change the uuid of the array. If a UUID is given with the | |
1132 | .B \-\-uuid | |
1133 | option that UUID will be used as a new UUID and will | |
1134 | .B NOT | |
1135 | be used to help identify the devices in the array. | |
1136 | If no | |
1137 | .B \-\-uuid | |
1138 | is given, a random UUID is chosen. | |
1139 | ||
1140 | The | |
1141 | .B name | |
1142 | option will change the | |
1143 | .I name | |
1144 | of the array as stored in the superblock. This is only supported for | |
1145 | version-1 superblocks. | |
1146 | ||
1147 | The | |
1148 | .B nodes | |
1149 | option will change the | |
1150 | .I nodes | |
1151 | of the array as stored in the bitmap superblock. This option only | |
1152 | works for a clustered environment. | |
1153 | ||
1154 | The | |
1155 | .B homehost | |
1156 | option will change the | |
1157 | .I homehost | |
1158 | as recorded in the superblock. For version-0 superblocks, this is the | |
1159 | same as updating the UUID. | |
1160 | For version-1 superblocks, this involves updating the name. | |
1161 | ||
1162 | The | |
1163 | .B home\-cluster | |
1164 | option will change the cluster name as recorded in the superblock and | |
1165 | bitmap. This option only works for a clustered environment. | |
1166 | ||
1167 | The | |
1168 | .B resync | |
1169 | option will cause the array to be marked | |
1170 | .I dirty | |
1171 | meaning that any redundancy in the array (e.g. parity for RAID5, | |
1172 | copies for RAID1) may be incorrect. This will cause the RAID system | |
1173 | to perform a "resync" pass to make sure that all redundant information | |
1174 | is correct. | |
1175 | ||
1176 | The | |
1177 | .B byteorder | |
1178 | option allows arrays to be moved between machines with different | |
1179 | byte-order, such as from a big-endian machine like a Sparc or some | |
1180 | MIPS machines, to a little-endian x86_64 machine. | |
1181 | When assembling such an array for the first time after a move, giving | |
1182 | .B "\-\-update=byteorder" | |
1183 | will cause | |
1184 | .I mdadm | |
1185 | to expect superblocks to have their byteorder reversed, and will | |
1186 | correct that order before assembling the array. This is only valid | |
1187 | with original (Version 0.90) superblocks. | |
1188 | ||
1189 | The | |
1190 | .B summaries | |
1191 | option will correct the summaries in the superblock. That is the | |
1192 | counts of total, working, active, failed, and spare devices. | |
1193 | ||
1194 | The | |
1195 | .B devicesize | |
1196 | option will rarely be of use. It applies to version 1.1 and 1.2 metadata | |
1197 | only (where the metadata is at the start of the device) and is only | |
1198 | useful when the component device has changed size (typically become | |
1199 | larger). The version 1 metadata records the amount of the device that | |
1200 | can be used to store data, so if a device in a version 1.1 or 1.2 | |
1201 | array becomes larger, the metadata will still be visible, but the | |
1202 | extra space will not. In this case it might be useful to assemble the | |
1203 | array with | |
1204 | .BR \-\-update=devicesize . | |
1205 | This will cause | |
1206 | .I mdadm | |
1207 | to determine the maximum usable amount of space on each device and | |
1208 | update the relevant field in the metadata. | |
1209 | ||
1210 | The | |
1211 | .B metadata | |
1212 | option only works on v0.90 metadata arrays and will convert them to | |
1213 | v1.0 metadata. The array must not be dirty (i.e. it must not need a | |
1214 | sync) and it must not have a write-intent bitmap. | |
1215 | ||
1216 | The old metadata will remain on the devices, but will appear older | |
1217 | than the new metadata and so will usually be ignored. The old metadata | |
1218 | (or indeed the new metadata) can be removed by giving the appropriate | |
1219 | .B \-\-metadata= | |
1220 | option to | |
1221 | .BR \-\-zero\-superblock . | |
1222 | ||
1223 | The | |
1224 | .B no\-bitmap | |
1225 | option can be used when an array has an internal bitmap which is | |
1226 | corrupt in some way so that assembling the array normally fails. It | |
1227 | will cause any internal bitmap to be ignored. | |
1228 | ||
1229 | The | |
1230 | .B bbl | |
1231 | option will reserve space in each device for a bad block list. This | |
1232 | will be 4K in size and positioned near the end of any free space | |
1233 | between the superblock and the data. | |
1234 | ||
1235 | The | |
1236 | .B no\-bbl | |
1237 | option will cause any reservation of space for a bad block list to be | |
1238 | removed. If the bad block list contains entries, this will fail, as | |
1239 | removing the list could cause data corruption. | |
1240 | ||
1241 | The | |
1242 | .B ppl | |
1243 | option will enable PPL for a RAID5 array and reserve space for PPL on each | |
1244 | device. There must be enough free space between the data and superblock and a | |
1245 | write-intent bitmap or journal must not be used. | |
1246 | ||
1247 | The | |
1248 | .B no\-ppl | |
1249 | option will disable PPL in the superblock. | |
1250 | ||
1251 | The | |
1252 | .B layout\-original | |
1253 | and | |
1254 | .B layout\-alternate | |
1255 | options are for RAID0 arrays with non-uniform devices size that were in | |
1256 | use before Linux 5.4. If the array was being used with Linux 3.13 or | |
1257 | earlier, then to assemble the array on a new kernel, | |
1258 | .B \-\-update=layout\-original | |
1259 | must be given. If the array was created and used with a kernel from Linux 3.14 to | |
1260 | Linux 5.3, then | |
1261 | .B \-\-update=layout\-alternate | |
1262 | must be given. This only needs to be given once. Subsequent assembly of the array | |
1263 | will happen normally. | |
1264 | For more information, see | |
1265 | .IR md (4). | |
1266 | ||
1267 | The | |
1268 | .B layout\-unspecified | |
1269 | option reverts the effect of | |
1270 | .B layout\-orignal | |
1271 | or | |
1272 | .B layout\-alternate | |
1273 | and allows the array to be again used on a kernel prior to Linux 5.3. | |
1274 | This option should be used with great caution. | |
1275 | ||
1276 | .SH For Manage mode: | |
1277 | ||
1278 | .TP | |
1279 | .BR \-t ", " \-\-test | |
1280 | Unless a more serious error occurred, | |
1281 | .I mdadm | |
1282 | will exit with a status of 2 if no changes were made to the array and | |
1283 | 0 if at least one change was made. | |
1284 | This can be useful when an indirect specifier such as | |
1285 | .BR missing , | |
1286 | .B detached | |
1287 | or | |
1288 | .B faulty | |
1289 | is used in requesting an operation on the array. | |
1290 | .B \-\-test | |
1291 | will report failure if these specifiers didn't find any match. | |
1292 | ||
1293 | .TP | |
1294 | .BR \-a ", " \-\-add | |
1295 | hot-add listed devices. | |
1296 | If a device appears to have recently been part of the array | |
1297 | (possibly it failed or was removed) the device is re\-added as described | |
1298 | in the next point. | |
1299 | If that fails or the device was never part of the array, the device is | |
1300 | added as a hot-spare. | |
1301 | If the array is degraded, it will immediately start to rebuild data | |
1302 | onto that spare. | |
1303 | ||
1304 | Note that this and the following options are only meaningful on array | |
1305 | with redundancy. They don't apply to RAID0 or Linear. | |
1306 | ||
1307 | .TP | |
1308 | .BR \-\-re\-add | |
1309 | re\-add a device that was previously removed from an array. | |
1310 | If the metadata on the device reports that it is a member of the | |
1311 | array, and the slot that it used is still vacant, then the device will | |
1312 | be added back to the array in the same position. This will normally | |
1313 | cause the data for that device to be recovered. However, based on the | |
1314 | event count on the device, the recovery may only require sections that | |
1315 | are flagged by a write-intent bitmap to be recovered or may not require | |
1316 | any recovery at all. | |
1317 | ||
1318 | When used on an array that has no metadata (i.e. it was built with | |
1319 | .BR \-\-build) | |
1320 | it will be assumed that bitmap-based recovery is enough to make the | |
1321 | device fully consistent with the array. | |
1322 | ||
1323 | .B \-\-re\-add | |
1324 | can also be accompanied by | |
1325 | .BR \-\-update=devicesize , | |
1326 | .BR \-\-update=bbl ", or" | |
1327 | .BR \-\-update=no\-bbl . | |
1328 | See descriptions of these options when used in Assemble mode for an | |
1329 | explanation of their use. | |
1330 | ||
1331 | If the device name given is | |
1332 | .B missing | |
1333 | then | |
1334 | .I mdadm | |
1335 | will try to find any device that looks like it should be | |
1336 | part of the array but isn't and will try to re\-add all such devices. | |
1337 | ||
1338 | If the device name given is | |
1339 | .B faulty | |
1340 | then | |
1341 | .I mdadm | |
1342 | will find all devices in the array that are marked | |
1343 | .BR faulty , | |
1344 | remove them and attempt to immediately re\-add them. This can be | |
1345 | useful if you are certain that the reason for failure has been | |
1346 | resolved. | |
1347 | ||
1348 | .TP | |
1349 | .B \-\-add\-spare | |
1350 | Add a device as a spare. This is similar to | |
1351 | .B \-\-add | |
1352 | except that it does not attempt | |
1353 | .B \-\-re\-add | |
1354 | first. The device will be added as a spare even if it looks like it | |
1355 | could be a recent member of the array. | |
1356 | ||
1357 | .TP | |
1358 | .BR \-r ", " \-\-remove | |
1359 | remove listed devices. They must not be active. i.e. they should | |
1360 | be failed or spare devices. | |
1361 | ||
1362 | As well as the name of a device file | |
1363 | (e.g. | |
1364 | .BR /dev/sda1 ) | |
1365 | the words | |
1366 | .BR failed , | |
1367 | .B detached | |
1368 | and names like | |
1369 | .B set-A | |
1370 | can be given to | |
1371 | .BR \-\-remove . | |
1372 | The first causes all failed devices to be removed. The second causes | |
1373 | any device which is no longer connected to the system (i.e an 'open' | |
1374 | returns | |
1375 | .BR ENXIO ) | |
1376 | to be removed. | |
1377 | The third will remove a set as described below under | |
1378 | .BR \-\-fail . | |
1379 | ||
1380 | .TP | |
1381 | .BR \-f ", " \-\-fail | |
1382 | Mark listed devices as faulty. | |
1383 | As well as the name of a device file, the word | |
1384 | .B detached | |
1385 | or a set name like | |
1386 | .B set\-A | |
1387 | can be given. The former will cause any device that has been detached from | |
1388 | the system to be marked as failed. It can then be removed. | |
1389 | ||
1390 | For RAID10 arrays where the number of copies evenly divides the number | |
1391 | of devices, the devices can be conceptually divided into sets where | |
1392 | each set contains a single complete copy of the data on the array. | |
1393 | Sometimes a RAID10 array will be configured so that these sets are on | |
1394 | separate controllers. In this case, all the devices in one set can be | |
1395 | failed by giving a name like | |
1396 | .B set\-A | |
1397 | or | |
1398 | .B set\-B | |
1399 | to | |
1400 | .BR \-\-fail . | |
1401 | The appropriate set names are reported by | |
1402 | .BR \-\-detail . | |
1403 | ||
1404 | .TP | |
1405 | .BR \-\-set\-faulty | |
1406 | same as | |
1407 | .BR \-\-fail . | |
1408 | ||
1409 | .TP | |
1410 | .B \-\-replace | |
1411 | Mark listed devices as requiring replacement. As soon as a spare is | |
1412 | available, it will be rebuilt and will replace the marked device. | |
1413 | This is similar to marking a device as faulty, but the device remains | |
1414 | in service during the recovery process to increase resilience against | |
1415 | multiple failures. When the replacement process finishes, the | |
1416 | replaced device will be marked as faulty. | |
1417 | ||
1418 | .TP | |
1419 | .B \-\-with | |
1420 | This can follow a list of | |
1421 | .B \-\-replace | |
1422 | devices. The devices listed after | |
1423 | .B \-\-with | |
1424 | will preferentially be used to replace the devices listed after | |
1425 | .BR \-\-replace . | |
1426 | These devices must already be spare devices in the array. | |
1427 | ||
1428 | .TP | |
1429 | .BR \-\-write\-mostly | |
1430 | Subsequent devices that are added or re\-added will have the 'write-mostly' | |
1431 | flag set. This is only valid for RAID1 and means that the 'md' driver | |
1432 | will avoid reading from these devices if possible. | |
1433 | .TP | |
1434 | .BR \-\-readwrite | |
1435 | Subsequent devices that are added or re\-added will have the 'write-mostly' | |
1436 | flag cleared. | |
1437 | .TP | |
1438 | .BR \-\-cluster\-confirm | |
1439 | Confirm the existence of the device. This is issued in response to an \-\-add | |
1440 | request by a node in a cluster. When a node adds a device it sends a message | |
1441 | to all nodes in the cluster to look for a device with a UUID. This translates | |
1442 | to a udev notification with the UUID of the device to be added and the slot | |
1443 | number. The receiving node must acknowledge this message | |
1444 | with \-\-cluster\-confirm. Valid arguments are <slot>:<devicename> in case | |
1445 | the device is found or <slot>:missing in case the device is not found. | |
1446 | ||
1447 | .TP | |
1448 | .BR \-\-add-journal | |
1449 | Add a journal to an existing array, or recreate journal for a RAID-4/5/6 array | |
1450 | that lost a journal device. To avoid interrupting ongoing write operations, | |
1451 | .B \-\-add-journal | |
1452 | only works for array in Read-Only state. | |
1453 | ||
1454 | .TP | |
1455 | .BR \-\-failfast | |
1456 | Subsequent devices that are added or re\-added will have | |
1457 | the 'failfast' flag set. This is only valid for RAID1 and RAID10 and | |
1458 | means that the 'md' driver will avoid long timeouts on error handling | |
1459 | where possible. | |
1460 | .TP | |
1461 | .BR \-\-nofailfast | |
1462 | Subsequent devices that are re\-added will be re\-added without | |
1463 | the 'failfast' flag set. | |
1464 | ||
1465 | .P | |
1466 | Each of these options requires that the first device listed is the array | |
1467 | to be acted upon, and the remainder are component devices to be added, | |
1468 | removed, marked as faulty, etc. Several different operations can be | |
1469 | specified for different devices, e.g. | |
1470 | .in +5 | |
1471 | mdadm /dev/md0 \-\-add /dev/sda1 \-\-fail /dev/sdb1 \-\-remove /dev/sdb1 | |
1472 | .in -5 | |
1473 | Each operation applies to all devices listed until the next | |
1474 | operation. | |
1475 | ||
1476 | If an array is using a write-intent bitmap, then devices which have | |
1477 | been removed can be re\-added in a way that avoids a full | |
1478 | reconstruction but instead just updates the blocks that have changed | |
1479 | since the device was removed. For arrays with persistent metadata | |
1480 | (superblocks) this is done automatically. For arrays created with | |
1481 | .B \-\-build | |
1482 | mdadm needs to be told that this device we removed recently with | |
1483 | .BR \-\-re\-add . | |
1484 | ||
1485 | Devices can only be removed from an array if they are not in active | |
1486 | use, i.e. that must be spares or failed devices. To remove an active | |
1487 | device, it must first be marked as | |
1488 | .B faulty. | |
1489 | ||
1490 | .SH For Misc mode: | |
1491 | ||
1492 | .TP | |
1493 | .BR \-Q ", " \-\-query | |
1494 | Examine a device to see | |
1495 | (1) if it is an md device and (2) if it is a component of an md | |
1496 | array. | |
1497 | Information about what is discovered is presented. | |
1498 | ||
1499 | .TP | |
1500 | .BR \-D ", " \-\-detail | |
1501 | Print details of one or more md devices. | |
1502 | ||
1503 | .TP | |
1504 | .BR \-\-detail\-platform | |
1505 | Print details of the platform's RAID capabilities (firmware / hardware | |
1506 | topology) for a given metadata format. If used without an argument, mdadm | |
1507 | will scan all controllers looking for their capabilities. Otherwise, mdadm | |
1508 | will only look at the controller specified by the argument in the form of an | |
1509 | absolute filepath or a link, e.g. | |
1510 | .IR /sys/devices/pci0000:00/0000:00:1f.2 . | |
1511 | ||
1512 | .TP | |
1513 | .BR \-Y ", " \-\-export | |
1514 | When used with | |
1515 | .BR \-\-detail , | |
1516 | .BR \-\-detail-platform , | |
1517 | .BR \-\-examine , | |
1518 | or | |
1519 | .B \-\-incremental | |
1520 | output will be formatted as | |
1521 | .B key=value | |
1522 | pairs for easy import into the environment. | |
1523 | ||
1524 | With | |
1525 | .B \-\-incremental | |
1526 | The value | |
1527 | .B MD_STARTED | |
1528 | indicates whether an array was started | |
1529 | .RB ( yes ) | |
1530 | or not, which may include a reason | |
1531 | .RB ( unsafe ", " nothing ", " no ). | |
1532 | Also the value | |
1533 | .B MD_FOREIGN | |
1534 | indicates if the array is expected on this host | |
1535 | .RB ( no ), | |
1536 | or seems to be from elsewhere | |
1537 | .RB ( yes ). | |
1538 | ||
1539 | .TP | |
1540 | .BR \-E ", " \-\-examine | |
1541 | Print contents of the metadata stored on the named device(s). | |
1542 | Note the contrast between | |
1543 | .B \-\-examine | |
1544 | and | |
1545 | .BR \-\-detail . | |
1546 | .B \-\-examine | |
1547 | applies to devices which are components of an array, while | |
1548 | .B \-\-detail | |
1549 | applies to a whole array which is currently active. | |
1550 | ||
1551 | .TP | |
1552 | .BR \-X ", " \-\-examine\-bitmap | |
1553 | Report information about a bitmap. | |
1554 | The argument is an array component. Note that running this on an array | |
1555 | device (e.g. | |
1556 | .BR /dev/md0 ) | |
1557 | does not report the bitmap for that array. | |
1558 | ||
1559 | .TP | |
1560 | .B \-\-examine\-badblocks | |
1561 | List the bad-blocks recorded for the device, if a bad-blocks list has | |
1562 | been configured. Currently only | |
1563 | .B 1.x | |
1564 | and | |
1565 | .B IMSM | |
1566 | metadata support bad-blocks lists. | |
1567 | ||
1568 | .TP | |
1569 | .BI \-\-dump= directory | |
1570 | .TP | |
1571 | .BI \-\-restore= directory | |
1572 | Save metadata from lists devices, or restore metadata to listed devices. | |
1573 | ||
1574 | .TP | |
1575 | .BR \-R ", " \-\-run | |
1576 | start a partially assembled array. If | |
1577 | .B \-\-assemble | |
1578 | did not find enough devices to fully start the array, it might leaving | |
1579 | it partially assembled. If you wish, you can then use | |
1580 | .B \-\-run | |
1581 | to start the array in degraded mode. | |
1582 | ||
1583 | .TP | |
1584 | .BR \-S ", " \-\-stop | |
1585 | deactivate array, releasing all resources. | |
1586 | ||
1587 | .TP | |
1588 | .BR \-o ", " \-\-readonly | |
1589 | mark array as readonly. | |
1590 | ||
1591 | .TP | |
1592 | .BR \-w ", " \-\-readwrite | |
1593 | mark array as readwrite. | |
1594 | ||
1595 | .TP | |
1596 | .B \-\-zero\-superblock | |
1597 | If the device contains a valid md superblock, the block is | |
1598 | overwritten with zeros. With | |
1599 | .B \-\-force | |
1600 | the block where the superblock would be is overwritten even if it | |
1601 | doesn't appear to be valid. | |
1602 | ||
1603 | .B Note: | |
1604 | Be careful when calling \-\-zero\-superblock with clustered raid. Make sure | |
1605 | the array isn't used or assembled in another cluster node before executing it. | |
1606 | ||
1607 | .TP | |
1608 | .B \-\-kill\-subarray= | |
1609 | If the device is a container and the argument to \-\-kill\-subarray | |
1610 | specifies an inactive subarray in the container, then the subarray is | |
1611 | deleted. Deleting all subarrays will leave an 'empty-container' or | |
1612 | spare superblock on the drives. See | |
1613 | .B \-\-zero\-superblock | |
1614 | for completely | |
1615 | removing a superblock. Note that some formats depend on the subarray | |
1616 | index for generating a UUID, this command will fail if it would change | |
1617 | the UUID of an active subarray. | |
1618 | ||
1619 | .TP | |
1620 | .B \-\-update\-subarray= | |
1621 | If the device is a container and the argument to \-\-update\-subarray | |
1622 | specifies a subarray in the container, then attempt to update the given | |
1623 | superblock field in the subarray. See below in | |
1624 | .B MISC MODE | |
1625 | for details. | |
1626 | ||
1627 | .TP | |
1628 | .BR \-t ", " \-\-test | |
1629 | When used with | |
1630 | .BR \-\-detail , | |
1631 | the exit status of | |
1632 | .I mdadm | |
1633 | is set to reflect the status of the device. See below in | |
1634 | .B MISC MODE | |
1635 | for details. | |
1636 | ||
1637 | .TP | |
1638 | .BR \-W ", " \-\-wait | |
1639 | For each md device given, wait for any resync, recovery, or reshape | |
1640 | activity to finish before returning. | |
1641 | .I mdadm | |
1642 | will return with success if it actually waited for every device | |
1643 | listed, otherwise it will return failure. | |
1644 | ||
1645 | .TP | |
1646 | .BR \-\-wait\-clean | |
1647 | For each md device given, or each device in /proc/mdstat if | |
1648 | .B \-\-scan | |
1649 | is given, arrange for the array to be marked clean as soon as possible. | |
1650 | .I mdadm | |
1651 | will return with success if the array uses external metadata and we | |
1652 | successfully waited. For native arrays, this returns immediately as the | |
1653 | kernel handles dirty-clean transitions at shutdown. No action is taken | |
1654 | if safe-mode handling is disabled. | |
1655 | ||
1656 | .TP | |
1657 | .B \-\-action= | |
1658 | Set the "sync_action" for all md devices given to one of | |
1659 | .BR idle , | |
1660 | .BR frozen , | |
1661 | .BR check , | |
1662 | .BR repair . | |
1663 | Setting to | |
1664 | .B idle | |
1665 | will abort any currently running action though some actions will | |
1666 | automatically restart. | |
1667 | Setting to | |
1668 | .B frozen | |
1669 | will abort any current action and ensure no other action starts | |
1670 | automatically. | |
1671 | ||
1672 | Details of | |
1673 | .B check | |
1674 | and | |
1675 | .B repair | |
1676 | can be found it | |
1677 | .IR md (4) | |
1678 | under | |
1679 | .BR "SCRUBBING AND MISMATCHES" . | |
1680 | ||
1681 | .TP | |
1682 | .B \-\-udev\-rules= | |
1683 | it generates the udev rules to the file that handles hot-plug bare devices. | |
1684 | Given the POLICYs defined under | |
1685 | .IR {CONFFILE}\ (or {CONFFILE2}) | |
1686 | ||
1687 | See | |
1688 | .BR mdadm.conf (5) | |
1689 | for more details and usage examples about POLICY. | |
1690 | ||
1691 | .SH For Incremental Assembly mode: | |
1692 | .TP | |
1693 | .BR \-\-rebuild\-map ", " \-r | |
1694 | Rebuild the map file | |
1695 | .RB ( {MAP_PATH} ) | |
1696 | that | |
1697 | .I mdadm | |
1698 | uses to help track which arrays are currently being assembled. | |
1699 | ||
1700 | .TP | |
1701 | .BR \-\-run ", " \-R | |
1702 | Run any array assembled as soon as a minimal number of devices is | |
1703 | available, rather than waiting until all expected devices are present. | |
1704 | ||
1705 | .TP | |
1706 | .BR \-\-scan ", " \-s | |
1707 | Only meaningful with | |
1708 | .B \-R | |
1709 | this will scan the | |
1710 | .B map | |
1711 | file for arrays that are being incrementally assembled and will try to | |
1712 | start any that are not already started. | |
1713 | ||
1714 | .TP | |
1715 | .BR \-\-fail ", " \-f | |
1716 | This allows the hot-plug system to remove devices that have fully disappeared | |
1717 | from the kernel. It will first fail and then remove the device from any | |
1718 | array it belongs to. | |
1719 | The device name given should be a kernel device name such as "sda", | |
1720 | not a name in | |
1721 | .IR /dev . | |
1722 | ||
1723 | .TP | |
1724 | .BR \-\-path= | |
1725 | Only used with \-\-fail. The 'path' given will be recorded so that if | |
1726 | a new device appears at the same location it can be automatically | |
1727 | added to the same array. This allows the failed device to be | |
1728 | automatically replaced by a new device without metadata if it appears | |
1729 | at specified path. This option is normally only set by an | |
1730 | .I udev | |
1731 | script. | |
1732 | ||
1733 | .SH For Monitor mode: | |
1734 | .TP | |
1735 | .BR \-m ", " \-\-mail | |
1736 | Give an mail address to send alerts to. Can be configured in | |
1737 | .B mdadm.conf | |
1738 | as MAILADDR. | |
1739 | ||
1740 | .TP | |
1741 | .BR \-p ", " \-\-program ", " \-\-alert | |
1742 | Give a program to be run whenever an event is detected. Can be configured in | |
1743 | .B mdadm.conf | |
1744 | as PROGRAM. | |
1745 | ||
1746 | .TP | |
1747 | .BR \-y ", " \-\-syslog | |
1748 | Cause all events to be reported through 'syslog'. The messages have | |
1749 | facility of 'daemon' and varying priorities. | |
1750 | ||
1751 | .TP | |
1752 | .BR \-d ", " \-\-delay | |
1753 | Give a delay in seconds. The default is 60 seconds. | |
1754 | .I mdadm | |
1755 | polls the md arrays and then waits this many seconds before polling again if no event happened. | |
1756 | Can be configured in | |
1757 | .B mdadm.conf | |
1758 | as MONITORDELAY. | |
1759 | ||
1760 | .TP | |
1761 | .BR \-r ", " \-\-increment | |
1762 | Give a percentage increment. | |
1763 | .I mdadm | |
1764 | will generate RebuildNN events with the given percentage increment. | |
1765 | ||
1766 | .TP | |
1767 | .BR \-f ", " \-\-daemonise | |
1768 | Tell | |
1769 | .I mdadm | |
1770 | to run as a background daemon if it decides to monitor anything. This | |
1771 | causes it to fork and run in the child, and to disconnect from the | |
1772 | terminal. The process id of the child is written to stdout. | |
1773 | This is useful with | |
1774 | .B \-\-scan | |
1775 | which will only continue monitoring if a mail address or alert program | |
1776 | is found in the config file. | |
1777 | ||
1778 | .TP | |
1779 | .BR \-i ", " \-\-pid\-file | |
1780 | When | |
1781 | .I mdadm | |
1782 | is running in daemon mode, write the pid of the daemon process to | |
1783 | the specified file, instead of printing it on standard output. | |
1784 | ||
1785 | .TP | |
1786 | .BR \-1 ", " \-\-oneshot | |
1787 | Check arrays only once. This will generate | |
1788 | .B NewArray | |
1789 | events and more significantly | |
1790 | .B DegradedArray | |
1791 | and | |
1792 | .B SparesMissing | |
1793 | events. Running | |
1794 | .in +5 | |
1795 | .B " mdadm \-\-monitor \-\-scan \-1" | |
1796 | .in -5 | |
1797 | from a cron script will ensure regular notification of any degraded arrays. | |
1798 | ||
1799 | .TP | |
1800 | .BR \-t ", " \-\-test | |
1801 | Generate a | |
1802 | .B TestMessage | |
1803 | alert for every array found at startup. This alert gets mailed and | |
1804 | passed to the alert program. This can be used for testing that alert | |
1805 | message do get through successfully. | |
1806 | ||
1807 | .TP | |
1808 | .BR \-\-no\-sharing | |
1809 | This inhibits the functionality for moving spares between arrays. | |
1810 | Only one monitoring process started with | |
1811 | .B \-\-scan | |
1812 | but without this flag is allowed, otherwise the two could interfere | |
1813 | with each other. | |
1814 | ||
1815 | .SH ASSEMBLE MODE | |
1816 | ||
1817 | .HP 12 | |
1818 | Usage: | |
1819 | .B mdadm \-\-assemble | |
1820 | .I md-device options-and-component-devices... | |
1821 | .HP 12 | |
1822 | Usage: | |
1823 | .B mdadm \-\-assemble \-\-scan | |
1824 | .I md-devices-and-options... | |
1825 | .HP 12 | |
1826 | Usage: | |
1827 | .B mdadm \-\-assemble \-\-scan | |
1828 | .I options... | |
1829 | ||
1830 | .PP | |
1831 | This usage assembles one or more RAID arrays from pre-existing components. | |
1832 | For each array, mdadm needs to know the md device, the identity of the | |
1833 | array, and the number of component devices. These can be found in a number of ways. | |
1834 | ||
1835 | In the first usage example (without the | |
1836 | .BR \-\-scan ) | |
1837 | the first device given is the md device. | |
1838 | In the second usage example, all devices listed are treated as md | |
1839 | devices and assembly is attempted. | |
1840 | In the third (where no devices are listed) all md devices that are | |
1841 | listed in the configuration file are assembled. If no arrays are | |
1842 | described by the configuration file, then any arrays that | |
1843 | can be found on unused devices will be assembled. | |
1844 | ||
1845 | If precisely one device is listed, but | |
1846 | .B \-\-scan | |
1847 | is not given, then | |
1848 | .I mdadm | |
1849 | acts as though | |
1850 | .B \-\-scan | |
1851 | was given and identity information is extracted from the configuration file. | |
1852 | ||
1853 | The identity can be given with the | |
1854 | .B \-\-uuid | |
1855 | option, the | |
1856 | .B \-\-name | |
1857 | option, or the | |
1858 | .B \-\-super\-minor | |
1859 | option, will be taken from the md-device record in the config file, or | |
1860 | will be taken from the super block of the first component-device | |
1861 | listed on the command line. | |
1862 | ||
1863 | Devices can be given on the | |
1864 | .B \-\-assemble | |
1865 | command line or in the config file. Only devices which have an md | |
1866 | superblock which contains the right identity will be considered for | |
1867 | any array. | |
1868 | ||
1869 | The config file is only used if explicitly named with | |
1870 | .B \-\-config | |
1871 | or requested with (a possibly implicit) | |
1872 | .BR \-\-scan . | |
1873 | In the latter case, the default config file is used. See | |
1874 | .BR mdadm.conf (5) | |
1875 | for more details. | |
1876 | ||
1877 | If | |
1878 | .B \-\-scan | |
1879 | is not given, then the config file will only be used to find the | |
1880 | identity of md arrays. | |
1881 | ||
1882 | Normally the array will be started after it is assembled. However if | |
1883 | .B \-\-scan | |
1884 | is not given and not all expected drives were listed, then the array | |
1885 | is not started (to guard against usage errors). To insist that the | |
1886 | array be started in this case (as may work for RAID1, 4, 5, 6, or 10), | |
1887 | give the | |
1888 | .B \-\-run | |
1889 | flag. | |
1890 | ||
1891 | If | |
1892 | .I udev | |
1893 | is active, | |
1894 | .I mdadm | |
1895 | does not create any entries in | |
1896 | .B /dev | |
1897 | but leaves that to | |
1898 | .IR udev . | |
1899 | It does record information in | |
1900 | .B {MAP_PATH} | |
1901 | which will allow | |
1902 | .I udev | |
1903 | to choose the correct name. | |
1904 | ||
1905 | If | |
1906 | .I mdadm | |
1907 | detects that udev is not configured, it will create the devices in | |
1908 | .B /dev | |
1909 | itself. | |
1910 | ||
1911 | .SS Auto-Assembly | |
1912 | When | |
1913 | .B \-\-assemble | |
1914 | is used with | |
1915 | .B \-\-scan | |
1916 | and no devices are listed, | |
1917 | .I mdadm | |
1918 | will first attempt to assemble all the arrays listed in the config | |
1919 | file. | |
1920 | ||
1921 | If no arrays are listed in the config (other than those marked | |
1922 | .BR <ignore> ) | |
1923 | it will look through the available devices for possible arrays and | |
1924 | will try to assemble anything that it finds. Arrays which are tagged | |
1925 | as belonging to the given homehost will be assembled and started | |
1926 | normally. Arrays which do not obviously belong to this host are given | |
1927 | names that are expected not to conflict with anything local, and are | |
1928 | started "read-auto" so that nothing is written to any device until the | |
1929 | array is written to. i.e. automatic resync etc is delayed. | |
1930 | ||
1931 | If | |
1932 | .I mdadm | |
1933 | finds a consistent set of devices that look like they should comprise | |
1934 | an array, and if the superblock is tagged as belonging to the given | |
1935 | home host, it will automatically choose a device name and try to | |
1936 | assemble the array. If the array uses version-0.90 metadata, then the | |
1937 | .B minor | |
1938 | number as recorded in the superblock is used to create a name in | |
1939 | .B /dev/md/ | |
1940 | so for example | |
1941 | .BR /dev/md/3 . | |
1942 | If the array uses version-1 metadata, then the | |
1943 | .B name | |
1944 | from the superblock is used to similarly create a name in | |
1945 | .B /dev/md/ | |
1946 | (the name will have any 'host' prefix stripped first). | |
1947 | ||
1948 | This behaviour can be modified by the | |
1949 | .I AUTO | |
1950 | line in the | |
1951 | .I mdadm.conf | |
1952 | configuration file. This line can indicate that specific metadata | |
1953 | type should, or should not, be automatically assembled. If an array | |
1954 | is found which is not listed in | |
1955 | .I mdadm.conf | |
1956 | and has a metadata format that is denied by the | |
1957 | .I AUTO | |
1958 | line, then it will not be assembled. | |
1959 | The | |
1960 | .I AUTO | |
1961 | line can also request that all arrays identified as being for this | |
1962 | homehost should be assembled regardless of their metadata type. | |
1963 | See | |
1964 | .IR mdadm.conf (5) | |
1965 | for further details. | |
1966 | ||
1967 | Note: Auto-assembly cannot be used for assembling and activating some | |
1968 | arrays which are undergoing reshape. In particular as the | |
1969 | .B backup\-file | |
1970 | cannot be given, any reshape which requires a backup file to continue | |
1971 | cannot be started by auto-assembly. An array which is growing to more | |
1972 | devices and has passed the critical section can be assembled using | |
1973 | auto-assembly. | |
1974 | ||
1975 | .SH BUILD MODE | |
1976 | ||
1977 | .HP 12 | |
1978 | Usage: | |
1979 | .B mdadm \-\-build | |
1980 | .I md-device | |
1981 | .BI \-\-chunk= X | |
1982 | .BI \-\-level= Y | |
1983 | .BI \-\-raid\-devices= Z | |
1984 | .I devices | |
1985 | ||
1986 | .PP | |
1987 | This usage is similar to | |
1988 | .BR \-\-create . | |
1989 | The difference is that it creates an array without a superblock. With | |
1990 | these arrays there is no difference between initially creating the array and | |
1991 | subsequently assembling the array, except that hopefully there is useful | |
1992 | data there in the second case. | |
1993 | ||
1994 | The level may raid0, linear, raid1, raid10, multipath, or faulty, or | |
1995 | one of their synonyms. All devices must be listed and the array will | |
1996 | be started once complete. It will often be appropriate to use | |
1997 | .B \-\-assume\-clean | |
1998 | with levels raid1 or raid10. | |
1999 | ||
2000 | .SH CREATE MODE | |
2001 | ||
2002 | .HP 12 | |
2003 | Usage: | |
2004 | .B mdadm \-\-create | |
2005 | .I md-device | |
2006 | .BI \-\-chunk= X | |
2007 | .BI \-\-level= Y | |
2008 | .BI \-\-raid\-devices= Z | |
2009 | .I devices | |
2010 | ||
2011 | .PP | |
2012 | This usage will initialize a new md array, associate some devices with | |
2013 | it, and activate the array. | |
2014 | ||
2015 | .I md-device | |
2016 | is a new device. This could be standard name or chosen name. For details see: | |
2017 | .BR "DEVICE NAMES" | |
2018 | ||
2019 | The named device will normally not exist when | |
2020 | .I "mdadm \-\-create" | |
2021 | is run, but will be created by | |
2022 | .I udev | |
2023 | once the array becomes active. | |
2024 | ||
2025 | The max length md-device name is limited to 32 characters. | |
2026 | Different metadata types have more strict limitation | |
2027 | (like IMSM where only 16 characters are allowed). | |
2028 | For that reason, long name could be truncated or rejected, it depends on metadata policy. | |
2029 | ||
2030 | As devices are added, they are checked to see if they contain RAID | |
2031 | superblocks or filesystems. They are also checked to see if the variance in | |
2032 | device size exceeds 1%. | |
2033 | ||
2034 | If any discrepancy is found, the array will not automatically be run, though | |
2035 | the presence of a | |
2036 | .B \-\-run | |
2037 | can override this caution. | |
2038 | ||
2039 | To create a "degraded" array in which some devices are missing, simply | |
2040 | give the word "\fBmissing\fP" | |
2041 | in place of a device name. This will cause | |
2042 | .I mdadm | |
2043 | to leave the corresponding slot in the array empty. | |
2044 | For a RAID4 or RAID5 array at most one slot can be | |
2045 | "\fBmissing\fP"; for a RAID6 array at most two slots. | |
2046 | For a RAID1 array, only one real device needs to be given. All of the | |
2047 | others can be | |
2048 | "\fBmissing\fP". | |
2049 | ||
2050 | When creating a RAID5 array, | |
2051 | .I mdadm | |
2052 | will automatically create a degraded array with an extra spare drive. | |
2053 | This is because building the spare into a degraded array is in general | |
2054 | faster than resyncing the parity on a non-degraded, but not clean, | |
2055 | array. This feature can be overridden with the | |
2056 | .B \-\-force | |
2057 | option. | |
2058 | ||
2059 | When creating a partition based array, using | |
2060 | .I mdadm | |
2061 | with version-1.x metadata, the partition type should be set to | |
2062 | .B 0xDA | |
2063 | (non fs-data). This type of selection allows for greater precision since | |
2064 | using any other [RAID auto-detect (0xFD) or a GNU/Linux partition (0x83)], | |
2065 | might create problems in the event of array recovery through a live cdrom. | |
2066 | ||
2067 | A new array will normally get a randomly assigned 128bit UUID which is | |
2068 | very likely to be unique. If you have a specific need, you can choose | |
2069 | a UUID for the array by giving the | |
2070 | .B \-\-uuid= | |
2071 | option. Be warned that creating two arrays with the same UUID is a | |
2072 | recipe for disaster. Also, using | |
2073 | .B \-\-uuid= | |
2074 | when creating a v0.90 array will silently override any | |
2075 | .B \-\-homehost= | |
2076 | setting. | |
2077 | .\"If the | |
2078 | .\".B \-\-size | |
2079 | .\"option is given, it is not necessary to list any component devices in this command. | |
2080 | .\"They can be added later, before a | |
2081 | .\".B \-\-run. | |
2082 | .\"If no | |
2083 | .\".B \-\-size | |
2084 | .\"is given, the apparent size of the smallest drive given is used. | |
2085 | ||
2086 | Space for a bitmap will be reserved so that one can be added later with | |
2087 | .BR "\-\-grow \-\-bitmap=internal" . | |
2088 | ||
2089 | If the metadata type supports it (currently only 1.x and IMSM metadata), | |
2090 | space will be allocated to store a bad block list. This allows a modest | |
2091 | number of bad blocks to be recorded, allowing the drive to remain in | |
2092 | service while only partially functional. | |
2093 | ||
2094 | When creating an array within a | |
2095 | .B CONTAINER | |
2096 | .I mdadm | |
2097 | can be given either the list of devices to use, or simply the name of | |
2098 | the container. The former case gives control over which devices in | |
2099 | the container will be used for the array. The latter case allows | |
2100 | .I mdadm | |
2101 | to automatically choose which devices to use based on how much spare | |
2102 | space is available. | |
2103 | ||
2104 | The General Management options that are valid with | |
2105 | .B \-\-create | |
2106 | are: | |
2107 | .TP | |
2108 | .B \-\-run | |
2109 | insist on running the array even if some devices look like they might | |
2110 | be in use. | |
2111 | ||
2112 | .TP | |
2113 | .B \-\-readonly | |
2114 | start the array in readonly mode. | |
2115 | ||
2116 | .SH MANAGE MODE | |
2117 | .HP 12 | |
2118 | Usage: | |
2119 | .B mdadm | |
2120 | .I device | |
2121 | .I options... devices... | |
2122 | .PP | |
2123 | ||
2124 | This usage will allow individual devices in an array to be failed, | |
2125 | removed or added. It is possible to perform multiple operations with | |
2126 | on command. For example: | |
2127 | .br | |
2128 | .B " mdadm /dev/md0 \-f /dev/hda1 \-r /dev/hda1 \-a /dev/hda1" | |
2129 | .br | |
2130 | will firstly mark | |
2131 | .B /dev/hda1 | |
2132 | as faulty in | |
2133 | .B /dev/md0 | |
2134 | and will then remove it from the array and finally add it back | |
2135 | in as a spare. However, only one md array can be affected by a single | |
2136 | command. | |
2137 | ||
2138 | When a device is added to an active array, mdadm checks to see if it | |
2139 | has metadata on it which suggests that it was recently a member of the | |
2140 | array. If it does, it tries to "re\-add" the device. If there have | |
2141 | been no changes since the device was removed, or if the array has a | |
2142 | write-intent bitmap which has recorded whatever changes there were, | |
2143 | then the device will immediately become a full member of the array and | |
2144 | those differences recorded in the bitmap will be resolved. | |
2145 | ||
2146 | .SH MISC MODE | |
2147 | .HP 12 | |
2148 | Usage: | |
2149 | .B mdadm | |
2150 | .I options ... | |
2151 | .I devices ... | |
2152 | .PP | |
2153 | ||
2154 | MISC mode includes a number of distinct operations that | |
2155 | operate on distinct devices. The operations are: | |
2156 | .TP | |
2157 | .B \-\-query | |
2158 | The device is examined to see if it is | |
2159 | (1) an active md array, or | |
2160 | (2) a component of an md array. | |
2161 | The information discovered is reported. | |
2162 | ||
2163 | .TP | |
2164 | .B \-\-detail | |
2165 | The device should be an active md device. | |
2166 | .B mdadm | |
2167 | will display a detailed description of the array. | |
2168 | .B \-\-brief | |
2169 | or | |
2170 | .B \-\-scan | |
2171 | will cause the output to be less detailed and the format to be | |
2172 | suitable for inclusion in | |
2173 | .BR mdadm.conf . | |
2174 | The exit status of | |
2175 | .I mdadm | |
2176 | will normally be 0 unless | |
2177 | .I mdadm | |
2178 | failed to get useful information about the device(s); however, if the | |
2179 | .B \-\-test | |
2180 | option is given, then the exit status will be: | |
2181 | .RS | |
2182 | .TP | |
2183 | 0 | |
2184 | The array is functioning normally. | |
2185 | .TP | |
2186 | 1 | |
2187 | The array has at least one failed device. | |
2188 | .TP | |
2189 | 2 | |
2190 | The array has multiple failed devices such that it is unusable. | |
2191 | .TP | |
2192 | 4 | |
2193 | There was an error while trying to get information about the device. | |
2194 | .RE | |
2195 | ||
2196 | .TP | |
2197 | .B \-\-detail\-platform | |
2198 | Print detail of the platform's RAID capabilities (firmware / hardware | |
2199 | topology). If the metadata is specified with | |
2200 | .B \-e | |
2201 | or | |
2202 | .B \-\-metadata= | |
2203 | then the return status will be: | |
2204 | .RS | |
2205 | .TP | |
2206 | 0 | |
2207 | metadata successfully enumerated its platform components on this system | |
2208 | .TP | |
2209 | 1 | |
2210 | metadata is platform independent | |
2211 | .TP | |
2212 | 2 | |
2213 | metadata failed to find its platform components on this system | |
2214 | .RE | |
2215 | ||
2216 | .TP | |
2217 | .B \-\-update\-subarray= | |
2218 | If the device is a container and the argument to \-\-update\-subarray | |
2219 | specifies a subarray in the container, then attempt to update the given | |
2220 | superblock field in the subarray. Similar to updating an array in | |
2221 | "assemble" mode, the field to update is selected by | |
2222 | .B \-U | |
2223 | or | |
2224 | .B \-\-update= | |
2225 | option. The supported options are | |
2226 | .BR name , | |
2227 | .BR ppl , | |
2228 | .BR no\-ppl , | |
2229 | .BR bitmap | |
2230 | and | |
2231 | .BR no\-bitmap . | |
2232 | ||
2233 | The | |
2234 | .B name | |
2235 | option updates the subarray name in the metadata. It cannot be longer than | |
2236 | 32 chars. If successes, new value will be respected after next assembly. | |
2237 | ||
2238 | The | |
2239 | .B ppl | |
2240 | and | |
2241 | .B no\-ppl | |
2242 | options enable and disable PPL in the metadata. Currently supported only for | |
2243 | IMSM subarrays. | |
2244 | ||
2245 | The | |
2246 | .B bitmap | |
2247 | and | |
2248 | .B no\-bitmap | |
2249 | options enable and disable write-intent bitmap in the metadata. Currently supported only for | |
2250 | IMSM subarrays. | |
2251 | ||
2252 | .TP | |
2253 | .B \-\-examine | |
2254 | The device should be a component of an md array. | |
2255 | .I mdadm | |
2256 | will read the md superblock of the device and display the contents. | |
2257 | If | |
2258 | .B \-\-brief | |
2259 | or | |
2260 | .B \-\-scan | |
2261 | is given, then multiple devices that are components of the one array | |
2262 | are grouped together and reported in a single entry suitable | |
2263 | for inclusion in | |
2264 | .BR mdadm.conf . | |
2265 | ||
2266 | Having | |
2267 | .B \-\-scan | |
2268 | without listing any devices will cause all devices listed in the | |
2269 | config file to be examined. | |
2270 | ||
2271 | .TP | |
2272 | .BI \-\-dump= directory | |
2273 | If the device contains RAID metadata, a file will be created in the | |
2274 | .I directory | |
2275 | and the metadata will be written to it. The file will be the same | |
2276 | size as the device and will have the metadata written at the | |
2277 | same location as it exists in the device. However, the file will be "sparse" so | |
2278 | that only those blocks containing metadata will be allocated. The | |
2279 | total space used will be small. | |
2280 | ||
2281 | The filename used in the | |
2282 | .I directory | |
2283 | will be the base name of the device. Further, if any links appear in | |
2284 | .I /dev/disk/by-id | |
2285 | which point to the device, then hard links to the file will be created | |
2286 | in | |
2287 | .I directory | |
2288 | based on these | |
2289 | .I by-id | |
2290 | names. | |
2291 | ||
2292 | Multiple devices can be listed and their metadata will all be stored | |
2293 | in the one directory. | |
2294 | ||
2295 | .TP | |
2296 | .BI \-\-restore= directory | |
2297 | This is the reverse of | |
2298 | .BR \-\-dump . | |
2299 | .I mdadm | |
2300 | will locate a file in the directory that has a name appropriate for | |
2301 | the given device and will restore metadata from it. Names that match | |
2302 | .I /dev/disk/by-id | |
2303 | names are preferred, however if two of those refer to different files, | |
2304 | .I mdadm | |
2305 | will not choose between them but will abort the operation. | |
2306 | ||
2307 | If a file name is given instead of a | |
2308 | .I directory | |
2309 | then | |
2310 | .I mdadm | |
2311 | will restore from that file to a single device, always provided the | |
2312 | size of the file matches that of the device, and the file contains | |
2313 | valid metadata. | |
2314 | .TP | |
2315 | .B \-\-stop | |
2316 | The devices should be active md arrays which will be deactivated, as | |
2317 | long as they are not currently in use. | |
2318 | ||
2319 | .TP | |
2320 | .B \-\-run | |
2321 | This will fully activate a partially assembled md array. | |
2322 | ||
2323 | .TP | |
2324 | .B \-\-readonly | |
2325 | This will mark an active array as read-only, providing that it is | |
2326 | not currently being used. | |
2327 | ||
2328 | .TP | |
2329 | .B \-\-readwrite | |
2330 | This will change a | |
2331 | .B readonly | |
2332 | array back to being read/write. | |
2333 | ||
2334 | .TP | |
2335 | .B \-\-scan | |
2336 | For all operations except | |
2337 | .BR \-\-examine , | |
2338 | .B \-\-scan | |
2339 | will cause the operation to be applied to all arrays listed in | |
2340 | .BR /proc/mdstat . | |
2341 | For | |
2342 | .BR \-\-examine, | |
2343 | .B \-\-scan | |
2344 | causes all devices listed in the config file to be examined. | |
2345 | ||
2346 | .TP | |
2347 | .BR \-b ", " \-\-brief | |
2348 | Be less verbose. This is used with | |
2349 | .B \-\-detail | |
2350 | and | |
2351 | .BR \-\-examine . | |
2352 | Using | |
2353 | .B \-\-brief | |
2354 | with | |
2355 | .B \-\-verbose | |
2356 | gives an intermediate level of verbosity. | |
2357 | ||
2358 | .SH MONITOR MODE | |
2359 | ||
2360 | .HP 12 | |
2361 | Usage: | |
2362 | .B mdadm \-\-monitor | |
2363 | .I options... devices... | |
2364 | ||
2365 | .PP | |
2366 | Monitor option can work in two modes: | |
2367 | .IP \(bu 4 | |
2368 | system wide mode, follow all md devices based on | |
2369 | .B /proc/mdstat, | |
2370 | .IP \(bu 4 | |
2371 | follow only specified MD devices in command line. | |
2372 | .PP | |
2373 | ||
2374 | .B \-\-scan - | |
2375 | indicates system wide mode. Option causes the | |
2376 | .I monitor | |
2377 | to track all md devices that appear in | |
2378 | .B /proc/mdstat. | |
2379 | If it is not set, then at least one | |
2380 | .B device | |
2381 | must be specified. | |
2382 | ||
2383 | Monitor usage causes | |
2384 | .I mdadm | |
2385 | to periodically poll a number of md arrays and to report on any events | |
2386 | noticed. | |
2387 | ||
2388 | In both modes, | |
2389 | .I monitor | |
2390 | will work as long as there is an active array with redundancy and it is defined to follow (for | |
2391 | .B \-\-scan | |
2392 | every array is followed). | |
2393 | ||
2394 | As well as reporting events, | |
2395 | .I mdadm | |
2396 | may move a spare drive from one array to another if they are in the | |
2397 | same | |
2398 | .B spare-group | |
2399 | or | |
2400 | .B domain | |
2401 | and if the destination array has a failed drive but no spares. | |
2402 | ||
2403 | The result of monitoring the arrays is the generation of events. | |
2404 | These events are passed to a separate program (if specified) and may | |
2405 | be mailed to a given E-mail address. | |
2406 | ||
2407 | When passing events to a program, the program is run once for each event, | |
2408 | and is given 2 or 3 command-line arguments: the first is the | |
2409 | name of the event (see below), the second is the name of the | |
2410 | md device which is affected, and the third is the name of a related | |
2411 | device if relevant (such as a component device that has failed). | |
2412 | ||
2413 | If | |
2414 | .B \-\-scan | |
2415 | is given, then a | |
2416 | .B program | |
2417 | or an | |
2418 | .B e-mail | |
2419 | address must be specified on the command line or in the config file. If neither are available, then | |
2420 | .I mdadm | |
2421 | will not monitor anything. For devices given directly in command line, without | |
2422 | .B program | |
2423 | or | |
2424 | .B email | |
2425 | specified, each event is reported to | |
2426 | .BR stdout. | |
2427 | ||
2428 | Note: On systems where mdadm monitoring is managed through systemd, the mdmonitor.service | |
2429 | should be present. This service is designed to be the primary solution for array monitoring. | |
2430 | It is configured to operate in system-wide mode. It is initiated by udev when start criteria are | |
2431 | met, e.g. | |
2432 | .B mdadm.conf | |
2433 | exists and necessary configuration parameters are set. | |
2434 | It is kept alive as long as a redundant RAID array is active; it stops otherwise. User should | |
2435 | customize MAILADDR in | |
2436 | .B mdadm.conf | |
2437 | to receive mail notifications. MONITORDELAY, MAILFROM and PROGRAM are optional. See | |
2438 | .BR mdadm.conf (5) | |
2439 | for detailed description of these options. | |
2440 | Use systemctl status mdmonitor.service to verify status or determine if additional configuration | |
2441 | is needed. | |
2442 | ||
2443 | The different events are: | |
2444 | ||
2445 | .RS 4 | |
2446 | .TP | |
2447 | .B DeviceDisappeared | |
2448 | An md array which previously was configured appears to no longer be | |
2449 | configured. (syslog priority: Critical) | |
2450 | ||
2451 | If | |
2452 | .I mdadm | |
2453 | was told to monitor an array which is RAID0 or Linear, then it will | |
2454 | report | |
2455 | .B DeviceDisappeared | |
2456 | with the extra information | |
2457 | .BR Wrong-Level . | |
2458 | This is because RAID0 and Linear do not support the device-failed, | |
2459 | hot-spare and resync operations which are monitored. | |
2460 | ||
2461 | .TP | |
2462 | .B RebuildStarted | |
2463 | An md array started reconstruction (e.g. recovery, resync, reshape, | |
2464 | check, repair). (syslog priority: Warning) | |
2465 | ||
2466 | .TP | |
2467 | .BI Rebuild NN | |
2468 | Where | |
2469 | .I NN | |
2470 | is a two-digit number (eg. 05, 48). This indicates that the rebuild | |
2471 | has reached that percentage of the total. The events are generated | |
2472 | at a fixed increment from 0. The increment size may be specified with | |
2473 | a command-line option (the default is 20). (syslog priority: Warning) | |
2474 | ||
2475 | .TP | |
2476 | .B RebuildFinished | |
2477 | An md array that was rebuilding, isn't any more, either because it | |
2478 | finished normally or was aborted. (syslog priority: Warning) | |
2479 | ||
2480 | .TP | |
2481 | .B Fail | |
2482 | An active component device of an array has been marked as | |
2483 | faulty. (syslog priority: Critical) | |
2484 | ||
2485 | .TP | |
2486 | .B FailSpare | |
2487 | A spare component device which was being rebuilt to replace a faulty | |
2488 | device has failed. (syslog priority: Critical) | |
2489 | ||
2490 | .TP | |
2491 | .B SpareActive | |
2492 | A spare component device which was being rebuilt to replace a faulty | |
2493 | device has been successfully rebuilt and has been made active. | |
2494 | (syslog priority: Info) | |
2495 | ||
2496 | .TP | |
2497 | .B NewArray | |
2498 | A new md array has been detected in the | |
2499 | .B /proc/mdstat | |
2500 | file. (syslog priority: Info) | |
2501 | ||
2502 | .TP | |
2503 | .B DegradedArray | |
2504 | A newly noticed array appears to be degraded. This message is not | |
2505 | generated when | |
2506 | .I mdadm | |
2507 | notices a drive failure which causes degradation, but only when | |
2508 | .I mdadm | |
2509 | notices that an array is degraded when it first sees the array. | |
2510 | (syslog priority: Critical) | |
2511 | ||
2512 | .TP | |
2513 | .B MoveSpare | |
2514 | A spare drive has been moved from one array in a | |
2515 | .B spare-group | |
2516 | or | |
2517 | .B domain | |
2518 | to another to allow a failed drive to be replaced. | |
2519 | (syslog priority: Info) | |
2520 | ||
2521 | .TP | |
2522 | .B SparesMissing | |
2523 | If | |
2524 | .I mdadm | |
2525 | has been told, via the config file, that an array should have a certain | |
2526 | number of spare devices, and | |
2527 | .I mdadm | |
2528 | detects that it has fewer than this number when it first sees the | |
2529 | array, it will report a | |
2530 | .B SparesMissing | |
2531 | message. | |
2532 | (syslog priority: Warning) | |
2533 | ||
2534 | .TP | |
2535 | .B TestMessage | |
2536 | An array was found at startup, and the | |
2537 | .B \-\-test | |
2538 | flag was given. | |
2539 | (syslog priority: Info) | |
2540 | .RE | |
2541 | ||
2542 | Only | |
2543 | .B Fail, | |
2544 | .B FailSpare, | |
2545 | .B DegradedArray, | |
2546 | .B SparesMissing | |
2547 | and | |
2548 | .B TestMessage | |
2549 | cause Email to be sent. All events cause the program to be run. | |
2550 | The program is run with two or three arguments: the event | |
2551 | name, the array device and possibly a second device. | |
2552 | ||
2553 | Each event has an associated array device (e.g. | |
2554 | .BR /dev/md1 ) | |
2555 | and possibly a second device. For | |
2556 | .BR Fail , | |
2557 | .BR FailSpare , | |
2558 | and | |
2559 | .B SpareActive | |
2560 | the second device is the relevant component device. | |
2561 | For | |
2562 | .B MoveSpare | |
2563 | the second device is the array that the spare was moved from. | |
2564 | ||
2565 | For | |
2566 | .I mdadm | |
2567 | to move spares from one array to another, the different arrays need to | |
2568 | be labeled with the same | |
2569 | .B spare-group | |
2570 | or the spares must be allowed to migrate through matching POLICY domains | |
2571 | in the configuration file. The | |
2572 | .B spare-group | |
2573 | name can be any string; it is only necessary that different spare | |
2574 | groups use different names. | |
2575 | ||
2576 | When | |
2577 | .I mdadm | |
2578 | detects that an array in a spare group has fewer active | |
2579 | devices than necessary for the complete array, and has no spare | |
2580 | devices, it will look for another array in the same spare group that | |
2581 | has a full complement of working drives and a spare. It will then | |
2582 | attempt to remove the spare from the second array and add it to the | |
2583 | first. | |
2584 | If the removal succeeds but the adding fails, then it is added back to | |
2585 | the original array. | |
2586 | ||
2587 | If the spare group for a degraded array is not defined, | |
2588 | .I mdadm | |
2589 | will look at the rules of spare migration specified by POLICY lines in | |
2590 | .B mdadm.conf | |
2591 | and then follow similar steps as above if a matching spare is found. | |
2592 | ||
2593 | .SH GROW MODE | |
2594 | The GROW mode is used for changing the size or shape of an active | |
2595 | array. | |
2596 | ||
2597 | The following changes are supported: | |
2598 | .IP \(bu 4 | |
2599 | change the "size" attribute for RAID1, RAID4, RAID5 and RAID6. | |
2600 | .IP \(bu 4 | |
2601 | increase or decrease the "raid\-devices" attribute of RAID0, RAID1, RAID4, | |
2602 | RAID5, and RAID6. | |
2603 | .IP \(bu 4 | |
2604 | change the chunk-size and layout of RAID0, RAID4, RAID5, RAID6 and RAID10. | |
2605 | .IP \(bu 4 | |
2606 | convert between RAID1 and RAID5, between RAID5 and RAID6, between | |
2607 | RAID0, RAID4, and RAID5, and between RAID0 and RAID10 (in the near-2 mode). | |
2608 | .IP \(bu 4 | |
2609 | add a write-intent bitmap to any array which supports these bitmaps, or | |
2610 | remove a write-intent bitmap from such an array. | |
2611 | .IP \(bu 4 | |
2612 | change the array's consistency policy. | |
2613 | .PP | |
2614 | ||
2615 | Using GROW on containers is currently supported only for Intel's IMSM | |
2616 | container format. The number of devices in a container can be | |
2617 | increased - which affects all arrays in the container - or an array | |
2618 | in a container can be converted between levels where those levels are | |
2619 | supported by the container, and the conversion is on of those listed | |
2620 | above. | |
2621 | ||
2622 | .PP | |
2623 | Notes: | |
2624 | .IP \(bu 4 | |
2625 | Intel's native checkpointing doesn't use | |
2626 | .B --backup-file | |
2627 | option and it is transparent for assembly feature. | |
2628 | .IP \(bu 4 | |
2629 | Roaming between Windows(R) and Linux systems for IMSM metadata is not | |
2630 | supported during grow process. | |
2631 | .IP \(bu 4 | |
2632 | When growing a raid0 device, the new component disk size (or external | |
2633 | backup size) should be larger than LCM(old, new) * chunk-size * 2, | |
2634 | where LCM() is the least common multiple of the old and new count of | |
2635 | component disks, and "* 2" comes from the fact that mdadm refuses to | |
2636 | use more than half of a spare device for backup space. | |
2637 | ||
2638 | .SS SIZE CHANGES | |
2639 | Normally when an array is built the "size" is taken from the smallest | |
2640 | of the drives. If all the small drives in an arrays are, over time, | |
2641 | removed and replaced with larger drives, then you could have an | |
2642 | array of large drives with only a small amount used. In this | |
2643 | situation, changing the "size" with "GROW" mode will allow the extra | |
2644 | space to start being used. If the size is increased in this way, a | |
2645 | "resync" process will start to make sure the new parts of the array | |
2646 | are synchronised. | |
2647 | ||
2648 | Note that when an array changes size, any filesystem that may be | |
2649 | stored in the array will not automatically grow or shrink to use or | |
2650 | vacate the space. The | |
2651 | filesystem will need to be explicitly told to use the extra space | |
2652 | after growing, or to reduce its size | |
2653 | .B prior | |
2654 | to shrinking the array. | |
2655 | ||
2656 | Also, the size of an array cannot be changed while it has an active | |
2657 | bitmap. If an array has a bitmap, it must be removed before the size | |
2658 | can be changed. Once the change is complete a new bitmap can be created. | |
2659 | ||
2660 | .SS RAID\-DEVICES CHANGES | |
2661 | ||
2662 | A RAID1 array can work with any number of devices from 1 upwards | |
2663 | (though 1 is not very useful). There may be times which you want to | |
2664 | increase or decrease the number of active devices. Note that this is | |
2665 | different to hot-add or hot-remove which changes the number of | |
2666 | inactive devices. | |
2667 | ||
2668 | When reducing the number of devices in a RAID1 array, the slots which | |
2669 | are to be removed from the array must already be vacant. That is, the | |
2670 | devices which were in those slots must be failed and removed. | |
2671 | ||
2672 | When the number of devices is increased, any hot spares that are | |
2673 | present will be activated immediately. | |
2674 | ||
2675 | Changing the number of active devices in a RAID5 or RAID6 is much more | |
2676 | effort. Every block in the array will need to be read and written | |
2677 | back to a new location. Linux Kernel is able to increase or decrease | |
2678 | the number of devices in a RAID5 and RAID6 safely, including restarting | |
2679 | an interrupted "reshape". | |
2680 | ||
2681 | The Linux Kernel is able to convert a RAID0 into a RAID4 or RAID5. | |
2682 | .I mdadm | |
2683 | uses this functionality and the ability to add | |
2684 | devices to a RAID4 to allow devices to be added to a RAID0. When | |
2685 | requested to do this, | |
2686 | .I mdadm | |
2687 | will convert the RAID0 to a RAID4, add the necessary disks and make | |
2688 | the reshape happen, and then convert the RAID4 back to RAID0. | |
2689 | ||
2690 | When decreasing the number of devices, the size of the array will also | |
2691 | decrease. If there was data in the array, it could get destroyed and | |
2692 | this is not reversible, so you should firstly shrink the filesystem on | |
2693 | the array to fit within the new size. To help prevent accidents, | |
2694 | .I mdadm | |
2695 | requires that the size of the array be decreased first with | |
2696 | .BR "mdadm --grow --array-size" . | |
2697 | This is a reversible change which simply makes the end of the array | |
2698 | inaccessible. The integrity of any data can then be checked before | |
2699 | the non-reversible reduction in the number of devices is request. | |
2700 | ||
2701 | When relocating the first few stripes on a RAID5 or RAID6, it is not | |
2702 | possible to keep the data on disk completely consistent and | |
2703 | crash-proof. To provide the required safety, mdadm disables writes to | |
2704 | the array while this "critical section" is reshaped, and takes a | |
2705 | backup of the data that is in that section. For grows, this backup may be | |
2706 | stored in any spare devices that the array has, however it can also be | |
2707 | stored in a separate file specified with the | |
2708 | .B \-\-backup\-file | |
2709 | option, and is required to be specified for shrinks, RAID level | |
2710 | changes and layout changes. If this option is used, and the system | |
2711 | does crash during the critical period, the same file must be passed to | |
2712 | .B \-\-assemble | |
2713 | to restore the backup and reassemble the array. When shrinking rather | |
2714 | than growing the array, the reshape is done from the end towards the | |
2715 | beginning, so the "critical section" is at the end of the reshape. | |
2716 | ||
2717 | .SS LEVEL CHANGES | |
2718 | ||
2719 | Changing the RAID level of any array happens instantaneously. However | |
2720 | in the RAID5 to RAID6 case this requires a non-standard layout of the | |
2721 | RAID6 data, and in the RAID6 to RAID5 case that non-standard layout is | |
2722 | required before the change can be accomplished. So while the level | |
2723 | change is instant, the accompanying layout change can take quite a | |
2724 | long time. A | |
2725 | .B \-\-backup\-file | |
2726 | is required. If the array is not simultaneously being grown or | |
2727 | shrunk, so that the array size will remain the same - for example, | |
2728 | reshaping a 3-drive RAID5 into a 4-drive RAID6 - the backup file will | |
2729 | be used not just for a "critical section" but throughout the reshape | |
2730 | operation, as described below under LAYOUT CHANGES. | |
2731 | ||
2732 | .SS CHUNK-SIZE AND LAYOUT CHANGES | |
2733 | ||
2734 | Changing the chunk-size or layout without also changing the number of | |
2735 | devices as the same time will involve re-writing all blocks in-place. | |
2736 | To ensure against data loss in the case of a crash, a | |
2737 | .B --backup-file | |
2738 | must be provided for these changes. Small sections of the array will | |
2739 | be copied to the backup file while they are being rearranged. This | |
2740 | means that all the data is copied twice, once to the backup and once | |
2741 | to the new layout on the array, so this type of reshape will go very | |
2742 | slowly. | |
2743 | ||
2744 | If the reshape is interrupted for any reason, this backup file must be | |
2745 | made available to | |
2746 | .B "mdadm --assemble" | |
2747 | so the array can be reassembled. Consequently, the file cannot be | |
2748 | stored on the device being reshaped. | |
2749 | ||
2750 | ||
2751 | .SS BITMAP CHANGES | |
2752 | ||
2753 | A write-intent bitmap can be added to, or removed from, an active | |
2754 | array. | |
2755 | ||
2756 | .SS CONSISTENCY POLICY CHANGES | |
2757 | ||
2758 | The consistency policy of an active array can be changed by using the | |
2759 | .B \-\-consistency\-policy | |
2760 | option in Grow mode. Currently this works only for the | |
2761 | .B ppl | |
2762 | and | |
2763 | .B resync | |
2764 | policies and allows to enable or disable the RAID5 Partial Parity Log (PPL). | |
2765 | ||
2766 | .SH INCREMENTAL MODE | |
2767 | ||
2768 | .HP 12 | |
2769 | Usage: | |
2770 | .B mdadm \-\-incremental | |
2771 | .RB [ \-\-run ] | |
2772 | .RB [ \-\-quiet ] | |
2773 | .I component-device | |
2774 | .RI [ optional-aliases-for-device ] | |
2775 | .HP 12 | |
2776 | Usage: | |
2777 | .B mdadm \-\-incremental \-\-fail | |
2778 | .I component-device | |
2779 | .HP 12 | |
2780 | Usage: | |
2781 | .B mdadm \-\-incremental \-\-rebuild\-map | |
2782 | .HP 12 | |
2783 | Usage: | |
2784 | .B mdadm \-\-incremental \-\-run \-\-scan | |
2785 | ||
2786 | .PP | |
2787 | This mode is designed to be used in conjunction with a device | |
2788 | discovery system. As devices are found in a system, they can be | |
2789 | passed to | |
2790 | .B "mdadm \-\-incremental" | |
2791 | to be conditionally added to an appropriate array. | |
2792 | ||
2793 | Conversely, it can also be used with the | |
2794 | .B \-\-fail | |
2795 | flag to do just the opposite and find whatever array a particular device | |
2796 | is part of and remove the device from that array. | |
2797 | ||
2798 | If the device passed is a | |
2799 | .B CONTAINER | |
2800 | device created by a previous call to | |
2801 | .IR mdadm , | |
2802 | then rather than trying to add that device to an array, all the arrays | |
2803 | described by the metadata of the container will be started. | |
2804 | ||
2805 | .I mdadm | |
2806 | performs a number of tests to determine if the device is part of an | |
2807 | array, and which array it should be part of. If an appropriate array | |
2808 | is found, or can be created, | |
2809 | .I mdadm | |
2810 | adds the device to the array and conditionally starts the array. | |
2811 | ||
2812 | Note that | |
2813 | .I mdadm | |
2814 | will normally only add devices to an array which were previously working | |
2815 | (active or spare) parts of that array. The support for automatic | |
2816 | inclusion of a new drive as a spare in some array requires | |
2817 | a configuration through POLICY in config file. | |
2818 | ||
2819 | The tests that | |
2820 | .I mdadm | |
2821 | makes are as follow: | |
2822 | .IP + | |
2823 | Is the device permitted by | |
2824 | .BR mdadm.conf ? | |
2825 | That is, is it listed in a | |
2826 | .B DEVICES | |
2827 | line in that file. If | |
2828 | .B DEVICES | |
2829 | is absent then the default it to allow any device. Similarly if | |
2830 | .B DEVICES | |
2831 | contains the special word | |
2832 | .B partitions | |
2833 | then any device is allowed. Otherwise the device name given to | |
2834 | .IR mdadm , | |
2835 | or one of the aliases given, or an alias found in the filesystem, | |
2836 | must match one of the names or patterns in a | |
2837 | .B DEVICES | |
2838 | line. | |
2839 | ||
2840 | This is the only context where the aliases are used. They are | |
2841 | usually provided by a | |
2842 | .I udev | |
2843 | rules mentioning | |
2844 | .BR $env{DEVLINKS} . | |
2845 | ||
2846 | .IP + | |
2847 | Does the device have a valid md superblock? If a specific metadata | |
2848 | version is requested with | |
2849 | .B \-\-metadata | |
2850 | or | |
2851 | .B \-e | |
2852 | then only that style of metadata is accepted, otherwise | |
2853 | .I mdadm | |
2854 | finds any known version of metadata. If no | |
2855 | .I md | |
2856 | metadata is found, the device may be still added to an array | |
2857 | as a spare if POLICY allows. | |
2858 | ||
2859 | .ig | |
2860 | .IP + | |
2861 | Does the metadata match an expected array? | |
2862 | The metadata can match in two ways. Either there is an array listed | |
2863 | in | |
2864 | .B mdadm.conf | |
2865 | which identifies the array (either by UUID, by name, by device list, | |
2866 | or by minor-number), or the array was created with a | |
2867 | .B homehost | |
2868 | specified and that | |
2869 | .B homehost | |
2870 | matches the one in | |
2871 | .B mdadm.conf | |
2872 | or on the command line. | |
2873 | If | |
2874 | .I mdadm | |
2875 | is not able to positively identify the array as belonging to the | |
2876 | current host, the device will be rejected. | |
2877 | .. | |
2878 | ||
2879 | .PP | |
2880 | .I mdadm | |
2881 | keeps a list of arrays that it has partially assembled in | |
2882 | .BR {MAP_PATH} . | |
2883 | If no array exists which matches | |
2884 | the metadata on the new device, | |
2885 | .I mdadm | |
2886 | must choose a device name and unit number. It does this based on any | |
2887 | name given in | |
2888 | .B mdadm.conf | |
2889 | or any name information stored in the metadata. If this name | |
2890 | suggests a unit number, that number will be used, otherwise a free | |
2891 | unit number will be chosen. Normally | |
2892 | .I mdadm | |
2893 | will prefer to create a partitionable array, however if the | |
2894 | .B CREATE | |
2895 | line in | |
2896 | .B mdadm.conf | |
2897 | suggests that a non-partitionable array is preferred, that will be | |
2898 | honoured. | |
2899 | ||
2900 | If the array is not found in the config file and its metadata does not | |
2901 | identify it as belonging to the "homehost", then | |
2902 | .I mdadm | |
2903 | will choose a name for the array which is certain not to conflict with | |
2904 | any array which does belong to this host. It does this be adding an | |
2905 | underscore and a small number to the name preferred by the metadata. | |
2906 | ||
2907 | Once an appropriate array is found or created and the device is added, | |
2908 | .I mdadm | |
2909 | must decide if the array is ready to be started. It will | |
2910 | normally compare the number of available (non-spare) devices to the | |
2911 | number of devices that the metadata suggests need to be active. If | |
2912 | there are at least that many, the array will be started. This means | |
2913 | that if any devices are missing the array will not be restarted. | |
2914 | ||
2915 | As an alternative, | |
2916 | .B \-\-run | |
2917 | may be passed to | |
2918 | .I mdadm | |
2919 | in which case the array will be run as soon as there are enough | |
2920 | devices present for the data to be accessible. For a RAID1, that | |
2921 | means one device will start the array. For a clean RAID5, the array | |
2922 | will be started as soon as all but one drive is present. | |
2923 | ||
2924 | Note that neither of these approaches is really ideal. If it can | |
2925 | be known that all device discovery has completed, then | |
2926 | .br | |
2927 | .B " mdadm \-IRs" | |
2928 | .br | |
2929 | can be run which will try to start all arrays that are being | |
2930 | incrementally assembled. They are started in "read-auto" mode in | |
2931 | which they are read-only until the first write request. This means | |
2932 | that no metadata updates are made and no attempt at resync or recovery | |
2933 | happens. Further devices that are found before the first write can | |
2934 | still be added safely. | |
2935 | ||
2936 | .SH ENVIRONMENT | |
2937 | This section describes environment variables that affect how mdadm | |
2938 | operates. | |
2939 | ||
2940 | .TP | |
2941 | .B MDADM_NO_MDMON | |
2942 | Setting this value to 1 will prevent mdadm from automatically launching | |
2943 | mdmon. This variable is intended primarily for debugging mdadm/mdmon. | |
2944 | ||
2945 | .TP | |
2946 | .B MDADM_NO_UDEV | |
2947 | Normally, | |
2948 | .I mdadm | |
2949 | does not create any device nodes in /dev, but leaves that task to | |
2950 | .IR udev . | |
2951 | If | |
2952 | .I udev | |
2953 | appears not to be configured, or if this environment variable is set | |
2954 | to '1', the | |
2955 | .I mdadm | |
2956 | will create and devices that are needed. | |
2957 | ||
2958 | .TP | |
2959 | .B MDADM_NO_SYSTEMCTL | |
2960 | If | |
2961 | .I mdadm | |
2962 | detects that | |
2963 | .I systemd | |
2964 | is in use it will normally request | |
2965 | .I systemd | |
2966 | to start various background tasks (particularly | |
2967 | .IR mdmon ) | |
2968 | rather than forking and running them in the background. This can be | |
2969 | suppressed by setting | |
2970 | .BR MDADM_NO_SYSTEMCTL=1 . | |
2971 | ||
2972 | .TP | |
2973 | .B IMSM_NO_PLATFORM | |
2974 | A key value of IMSM metadata is that it allows interoperability with | |
2975 | boot ROMs on Intel platforms, and with other major operating systems. | |
2976 | Consequently, | |
2977 | .I mdadm | |
2978 | will only allow an IMSM array to be created or modified if detects | |
2979 | that it is running on an Intel platform which supports IMSM, and | |
2980 | supports the particular configuration of IMSM that is being requested | |
2981 | (some functionality requires newer OROM support). | |
2982 | ||
2983 | These checks can be suppressed by setting IMSM_NO_PLATFORM=1 in the | |
2984 | environment. This can be useful for testing or for disaster | |
2985 | recovery. You should be aware that interoperability may be | |
2986 | compromised by setting this value. | |
2987 | ||
2988 | These change can also be suppressed by adding | |
2989 | .B mdadm.imsm.test=1 | |
2990 | to the kernel command line. This makes it easy to test IMSM | |
2991 | code in a virtual machine that doesn't have IMSM virtual hardware. | |
2992 | ||
2993 | .TP | |
2994 | .B MDADM_GROW_ALLOW_OLD | |
2995 | If an array is stopped while it is performing a reshape and that | |
2996 | reshape was making use of a backup file, then when the array is | |
2997 | re-assembled | |
2998 | .I mdadm | |
2999 | will sometimes complain that the backup file is too old. If this | |
3000 | happens and you are certain it is the right backup file, you can | |
3001 | over-ride this check by setting | |
3002 | .B MDADM_GROW_ALLOW_OLD=1 | |
3003 | in the environment. | |
3004 | ||
3005 | .TP | |
3006 | .B MDADM_CONF_AUTO | |
3007 | Any string given in this variable is added to the start of the | |
3008 | .B AUTO | |
3009 | line in the config file, or treated as the whole | |
3010 | .B AUTO | |
3011 | line if none is given. It can be used to disable certain metadata | |
3012 | types when | |
3013 | .I mdadm | |
3014 | is called from a boot script. For example | |
3015 | .br | |
3016 | .B " export MDADM_CONF_AUTO='-ddf -imsm' | |
3017 | .br | |
3018 | will make sure that | |
3019 | .I mdadm | |
3020 | does not automatically assemble any DDF or | |
3021 | IMSM arrays that are found. This can be useful on systems configured | |
3022 | to manage such arrays with | |
3023 | .BR dmraid . | |
3024 | ||
3025 | ||
3026 | .SH EXAMPLES | |
3027 | ||
3028 | .B " mdadm \-\-query /dev/name-of-device" | |
3029 | .br | |
3030 | This will find out if a given device is a RAID array, or is part of | |
3031 | one, and will provide brief information about the device. | |
3032 | ||
3033 | .B " mdadm \-\-assemble \-\-scan" | |
3034 | .br | |
3035 | This will assemble and start all arrays listed in the standard config | |
3036 | file. This command will typically go in a system startup file. | |
3037 | ||
3038 | .B " mdadm \-\-stop \-\-scan" | |
3039 | .br | |
3040 | This will shut down all arrays that can be shut down (i.e. are not | |
3041 | currently in use). This will typically go in a system shutdown script. | |
3042 | ||
3043 | .B " mdadm \-\-follow \-\-scan \-\-delay=120" | |
3044 | .br | |
3045 | If (and only if) there is an Email address or program given in the | |
3046 | standard config file, then | |
3047 | monitor the status of all arrays listed in that file by | |
3048 | polling them ever 2 minutes. | |
3049 | ||
3050 | .B " mdadm \-\-create /dev/md0 \-\-level=1 \-\-raid\-devices=2 /dev/hd[ac]1" | |
3051 | .br | |
3052 | Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1. | |
3053 | ||
3054 | .br | |
3055 | .B " echo 'DEVICE /dev/hd*[0\-9] /dev/sd*[0\-9]' > mdadm.conf" | |
3056 | .br | |
3057 | .B " mdadm \-\-detail \-\-scan >> mdadm.conf" | |
3058 | .br | |
3059 | This will create a prototype config file that describes currently | |
3060 | active arrays that are known to be made from partitions of IDE or SCSI drives. | |
3061 | This file should be reviewed before being used as it may | |
3062 | contain unwanted detail. | |
3063 | ||
3064 | .B " echo 'DEVICE /dev/hd[a\-z] /dev/sd*[a\-z]' > mdadm.conf" | |
3065 | .br | |
3066 | .B " mdadm \-\-examine \-\-scan \-\-config=mdadm.conf >> mdadm.conf" | |
3067 | .br | |
3068 | This will find arrays which could be assembled from existing IDE and | |
3069 | SCSI whole drives (not partitions), and store the information in the | |
3070 | format of a config file. | |
3071 | This file is very likely to contain unwanted detail, particularly | |
3072 | the | |
3073 | .B devices= | |
3074 | entries. It should be reviewed and edited before being used as an | |
3075 | actual config file. | |
3076 | ||
3077 | .B " mdadm \-\-examine \-\-brief \-\-scan \-\-config=partitions" | |
3078 | .br | |
3079 | .B " mdadm \-Ebsc partitions" | |
3080 | .br | |
3081 | Create a list of devices by reading | |
3082 | .BR /proc/partitions , | |
3083 | scan these for RAID superblocks, and printout a brief listing of all | |
3084 | that were found. | |
3085 | ||
3086 | .B " mdadm \-Ac partitions \-m 0 /dev/md0" | |
3087 | .br | |
3088 | Scan all partitions and devices listed in | |
3089 | .BR /proc/partitions | |
3090 | and assemble | |
3091 | .B /dev/md0 | |
3092 | out of all such devices with a RAID superblock with a minor number of 0. | |
3093 | ||
3094 | .B " mdadm \-\-monitor \-\-scan \-\-daemonise > /run/mdadm/mon.pid" | |
3095 | .br | |
3096 | If config file contains a mail address or alert program, run mdadm in | |
3097 | the background in monitor mode monitoring all md devices. Also write | |
3098 | pid of mdadm daemon to | |
3099 | .BR /run/mdadm/mon.pid . | |
3100 | ||
3101 | .B " mdadm \-Iq /dev/somedevice" | |
3102 | .br | |
3103 | Try to incorporate newly discovered device into some array as | |
3104 | appropriate. | |
3105 | ||
3106 | .B " mdadm \-\-incremental \-\-rebuild\-map \-\-run \-\-scan" | |
3107 | .br | |
3108 | Rebuild the array map from any current arrays, and then start any that | |
3109 | can be started. | |
3110 | ||
3111 | .B " mdadm /dev/md4 --fail detached --remove detached" | |
3112 | .br | |
3113 | Any devices which are components of /dev/md4 will be marked as faulty | |
3114 | and then remove from the array. | |
3115 | ||
3116 | .B " mdadm --grow /dev/md4 --level=6 --backup-file=/root/backup-md4" | |
3117 | .br | |
3118 | The array | |
3119 | .B /dev/md4 | |
3120 | which is currently a RAID5 array will be converted to RAID6. There | |
3121 | should normally already be a spare drive attached to the array as a | |
3122 | RAID6 needs one more drive than a matching RAID5. | |
3123 | ||
3124 | .B " mdadm --create /dev/md/ddf --metadata=ddf --raid-disks 6 /dev/sd[a-f]" | |
3125 | .br | |
3126 | Create a DDF array over 6 devices. | |
3127 | ||
3128 | .B " mdadm --create /dev/md/home -n3 -l5 -z 30000000 /dev/md/ddf" | |
3129 | .br | |
3130 | Create a RAID5 array over any 3 devices in the given DDF set. Use | |
3131 | only 30 gigabytes of each device. | |
3132 | ||
3133 | .B " mdadm -A /dev/md/ddf1 /dev/sd[a-f]" | |
3134 | .br | |
3135 | Assemble a pre-exist ddf array. | |
3136 | ||
3137 | .B " mdadm -I /dev/md/ddf1" | |
3138 | .br | |
3139 | Assemble all arrays contained in the ddf array, assigning names as | |
3140 | appropriate. | |
3141 | ||
3142 | .B " mdadm \-\-create \-\-help" | |
3143 | .br | |
3144 | Provide help about the Create mode. | |
3145 | ||
3146 | .B " mdadm \-\-config \-\-help" | |
3147 | .br | |
3148 | Provide help about the format of the config file. | |
3149 | ||
3150 | .B " mdadm \-\-help" | |
3151 | .br | |
3152 | Provide general help. | |
3153 | ||
3154 | .SH FILES | |
3155 | ||
3156 | .SS /proc/mdstat | |
3157 | ||
3158 | If you're using the | |
3159 | .B /proc | |
3160 | filesystem, | |
3161 | .B /proc/mdstat | |
3162 | lists all active md devices with information about them. | |
3163 | .I mdadm | |
3164 | uses this to find arrays when | |
3165 | .B \-\-scan | |
3166 | is given in Misc mode, and to monitor array reconstruction | |
3167 | on Monitor mode. | |
3168 | ||
3169 | .SS {CONFFILE} (or {CONFFILE2}) | |
3170 | ||
3171 | Default config file. See | |
3172 | .BR mdadm.conf (5) | |
3173 | for more details. | |
3174 | ||
3175 | .SS {CONFFILE}.d (or {CONFFILE2}.d) | |
3176 | ||
3177 | Default directory containing configuration files. See | |
3178 | .BR mdadm.conf (5) | |
3179 | for more details. | |
3180 | ||
3181 | .SS {MAP_PATH} | |
3182 | When | |
3183 | .B \-\-incremental | |
3184 | mode is used, this file gets a list of arrays currently being created. | |
3185 | ||
3186 | .SH POSIX PORTABLE NAME | |
3187 | A valid name can only consist of characters "A-Za-z0-9.-_". | |
3188 | The name cannot start with a leading "-" and cannot exceed 255 chars. | |
3189 | ||
3190 | .SH DEVICE NAMES | |
3191 | ||
3192 | .I mdadm | |
3193 | understand two sorts of names for array devices. | |
3194 | ||
3195 | The first is the so-called 'standard' format name, which matches the | |
3196 | names used by the kernel and which appear in | |
3197 | .IR /proc/mdstat . | |
3198 | ||
3199 | The second sort can be freely chosen, but must reside in | |
3200 | .IR /dev/md/ . | |
3201 | When giving a device name to | |
3202 | .I mdadm | |
3203 | to create or assemble an array, either full path name such as | |
3204 | .I /dev/md0 | |
3205 | or | |
3206 | .I /dev/md/home | |
3207 | can be given, or just the suffix of the second sort of name, such as | |
3208 | .I home | |
3209 | can be given. | |
3210 | ||
3211 | In every style, raw name has to be no longer than 32 chars. | |
3212 | ||
3213 | When | |
3214 | .I mdadm | |
3215 | chooses device names during auto-assembly or incremental assembly, it | |
3216 | will sometimes add a small sequence number to the end of the name to | |
3217 | avoid conflicted between multiple arrays that have the same name. If | |
3218 | .I mdadm | |
3219 | can reasonably determine that the array really is meant for this host, | |
3220 | either by a hostname in the metadata, or by the presence of the array | |
3221 | in | |
3222 | .BR mdadm.conf , | |
3223 | then it will leave off the suffix if possible. | |
3224 | Also if the homehost is specified as | |
3225 | .B <ignore> | |
3226 | .I mdadm | |
3227 | will only use a suffix if a different array of the same name already | |
3228 | exists or is listed in the config file. | |
3229 | ||
3230 | The names for arrays are of the form: | |
3231 | .IP | |
3232 | .RB /dev/md NN | |
3233 | .PP | |
3234 | where NN is a number. | |
3235 | ||
3236 | .PP | |
3237 | Names can be non-numeric following | |
3238 | the form: | |
3239 | .IP | |
3240 | .RB /dev/md_ XXX | |
3241 | .PP | |
3242 | where | |
3243 | .B XXX | |
3244 | is any string. These names are supported by | |
3245 | .I mdadm | |
3246 | since version 3.3 provided they are enabled in | |
3247 | .IR mdadm.conf . | |
3248 | ||
3249 | .SH UNDERSTANDING OUTPUT | |
3250 | ||
3251 | .TP | |
3252 | EXAMINE | |
3253 | ||
3254 | .TP | |
3255 | .B checkpoint | |
3256 | Checkpoint value is reported when array is performing some action including | |
3257 | resync, recovery or reshape. Checkpoints allow resuming action from certain | |
3258 | point if it was interrupted. | |
3259 | ||
3260 | Checkpoint is reported as combination of two values: current migration unit | |
3261 | and number of blocks per unit. By multiplying those values and dividing by | |
3262 | array size checkpoint progress percentage can be obtained in relation to | |
3263 | current progress reported in /proc/mdstat. Checkpoint is also related to (and | |
3264 | sometimes based on) sysfs entry sync_completed but depending on action units | |
3265 | may differ. Even if units are the same, it should not be expected that | |
3266 | checkpoint and sync_completed will be exact match nor updated simultaneously. | |
3267 | ||
3268 | .SH NOTE | |
3269 | .I mdadm | |
3270 | was previously known as | |
3271 | .IR mdctl . | |
3272 | ||
3273 | .SH SEE ALSO | |
3274 | For further information on mdadm usage, MD and the various levels of | |
3275 | RAID, see: | |
3276 | .IP | |
3277 | .B https://raid.wiki.kernel.org/ | |
3278 | .PP | |
3279 | (based upon Jakob \(/Ostergaard's Software\-RAID.HOWTO) | |
3280 | .PP | |
3281 | The latest version of | |
3282 | .I mdadm | |
3283 | should always be available from | |
3284 | .IP | |
3285 | .B https://www.kernel.org/pub/linux/utils/raid/mdadm/ | |
3286 | .PP | |
3287 | Related man pages: | |
3288 | .PP | |
3289 | .IR mdmon (8), | |
3290 | .IR mdadm.conf (5), | |
3291 | .IR md (4). |