]>
Commit | Line | Data |
---|---|---|
52826846 | 1 | .\" -*- nroff -*- |
e43d0cda NB |
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. | |
c04d5446 | 8 | .TH MDADM 8 "" v3.0-devel1 |
52826846 | 9 | .SH NAME |
9a9dab36 | 10 | mdadm \- manage MD devices |
cd29a5c8 | 11 | .I aka |
93e790af | 12 | Linux Software RAID |
cd29a5c8 | 13 | |
52826846 NB |
14 | .SH SYNOPSIS |
15 | ||
e0d19036 | 16 | .BI mdadm " [mode] <raiddevice> [options] <component-devices>" |
52826846 | 17 | |
2ae555c3 | 18 | .SH DESCRIPTION |
52826846 | 19 | RAID devices are virtual devices created from two or more |
cd29a5c8 | 20 | real block devices. This allows multiple devices (typically disk |
35cc5be4 | 21 | drives or partitions thereof) to be combined into a single device to |
cd29a5c8 | 22 | hold (for example) a single filesystem. |
2d465520 | 23 | Some RAID levels include redundancy and so can survive some degree of |
cd29a5c8 NB |
24 | device failure. |
25 | ||
2d465520 NB |
26 | Linux Software RAID devices are implemented through the md (Multiple |
27 | Devices) device driver. | |
cd29a5c8 NB |
28 | |
29 | Currently, Linux supports | |
30 | .B LINEAR | |
31 | md devices, | |
32 | .B RAID0 | |
33 | (striping), | |
34 | .B RAID1 | |
35 | (mirroring), | |
d013a55e NB |
36 | .BR RAID4 , |
37 | .BR RAID5 , | |
98c6faba | 38 | .BR RAID6 , |
1a7dfc35 | 39 | .BR RAID10 , |
b5e64645 | 40 | .BR MULTIPATH , |
90c8d668 | 41 | .BR FAULTY , |
cd29a5c8 | 42 | and |
90c8d668 | 43 | .BR CONTAINER . |
d013a55e | 44 | |
a9d69660 NB |
45 | .B MULTIPATH |
46 | is not a Software RAID mechanism, but does involve | |
93e790af | 47 | multiple devices: |
d013a55e NB |
48 | each device is a path to one common physical storage device. |
49 | ||
a9d69660 NB |
50 | .B FAULTY |
51 | is also not true RAID, and it only involves one device. It | |
b5e64645 | 52 | provides a layer over a true device that can be used to inject faults. |
52826846 | 53 | |
90c8d668 N |
54 | B CONTAINER |
55 | is different again. A CONTAINER is a collection of devices that are | |
56 | managed as a set. This is similar to the set of devices connected to | |
57 | a hardware RAID controller. The set of devices may contain a number | |
58 | of different RAID arrays each utilising some (or all) blocks from a | |
59 | number of the devices in the set. For example, two devices in a 5-device set | |
60 | might form a RAID1 used the whole devices. The remaining three might | |
61 | have a RAID5 over the first half of each device, and a RAID0 over the | |
62 | second half. | |
63 | ||
64 | With a CONTAINER, there is one set of metadata the describes | |
65 | ||
66 | ||
51ac42e3 | 67 | .\".I mdadm |
e43d0cda NB |
68 | .\"is a program that can be used to create, manage, and monitor |
69 | .\"MD devices. As | |
70 | .\"such it provides a similar set of functionality to the | |
71 | .\".B raidtools | |
72 | .\"packages. | |
73 | .\"The key differences between | |
51ac42e3 | 74 | .\".I mdadm |
e43d0cda NB |
75 | .\"and |
76 | .\".B raidtools | |
77 | .\"are: | |
78 | .\".IP \(bu 4 | |
51ac42e3 | 79 | .\".I mdadm |
e43d0cda NB |
80 | .\"is a single program and not a collection of programs. |
81 | .\".IP \(bu 4 | |
51ac42e3 | 82 | .\".I mdadm |
e43d0cda NB |
83 | .\"can perform (almost) all of its functions without having a |
84 | .\"configuration file and does not use one by default. Also | |
51ac42e3 | 85 | .\".I mdadm |
e43d0cda NB |
86 | .\"helps with management of the configuration |
87 | .\"file. | |
88 | .\".IP \(bu 4 | |
51ac42e3 | 89 | .\".I mdadm |
e43d0cda NB |
90 | .\"can provide information about your arrays (through Query, Detail, and Examine) |
91 | .\"that | |
92 | .\".B raidtools | |
93 | .\"cannot. | |
94 | .\".P | |
95 | .\".I mdadm | |
96 | .\"does not use | |
97 | .\".IR /etc/raidtab , | |
98 | .\"the | |
99 | .\".B raidtools | |
100 | .\"configuration file, at all. It has a different configuration file | |
101 | .\"with a different format and a different purpose. | |
52826846 NB |
102 | |
103 | .SH MODES | |
8382f19b | 104 | mdadm has several major modes of operation: |
cd29a5c8 NB |
105 | .TP |
106 | .B Assemble | |
93e790af | 107 | Assemble the components of a previously created |
52826846 | 108 | array into an active array. Components can be explicitly given |
2ae555c3 | 109 | or can be searched for. |
51ac42e3 | 110 | .I mdadm |
cd29a5c8 NB |
111 | checks that the components |
112 | do form a bona fide array, and can, on request, fiddle superblock | |
113 | information so as to assemble a faulty array. | |
114 | ||
115 | .TP | |
116 | .B Build | |
a9d69660 NB |
117 | Build an array that doesn't have per-device superblocks. For these |
118 | sorts of arrays, | |
119 | .I mdadm | |
120 | cannot differentiate between initial creation and subsequent assembly | |
121 | of an array. It also cannot perform any checks that appropriate | |
93e790af | 122 | components have been requested. Because of this, the |
a9d69660 NB |
123 | .B Build |
124 | mode should only be used together with a complete understanding of | |
125 | what you are doing. | |
cd29a5c8 NB |
126 | |
127 | .TP | |
128 | .B Create | |
129 | Create a new array with per-device superblocks. | |
e43d0cda NB |
130 | .\"It can progress |
131 | .\"in several step create-add-add-run or it can all happen with one command. | |
cd29a5c8 | 132 | |
cd29a5c8 NB |
133 | .TP |
134 | .B "Follow or Monitor" | |
5787fa49 | 135 | Monitor one or more md devices and act on any state changes. This is |
93e790af | 136 | only meaningful for raid1, 4, 5, 6, 10 or multipath arrays, as |
98c6faba NB |
137 | only these have interesting state. raid0 or linear never have |
138 | missing, spare, or failed drives, so there is nothing to monitor. | |
5787fa49 | 139 | |
dd0781e5 NB |
140 | .TP |
141 | .B "Grow" | |
142 | Grow (or shrink) an array, or otherwise reshape it in some way. | |
143 | Currently supported growth options including changing the active size | |
93e790af SW |
144 | of component devices and changing the number of active devices in RAID |
145 | levels 1/4/5/6, as well as adding or removing a write-intent bitmap. | |
cd29a5c8 | 146 | |
8382f19b NB |
147 | .TP |
148 | .B "Incremental Assembly" | |
149 | Add a single device to an appropriate array. If the addition of the | |
150 | device makes the array runnable, the array will be started. | |
151 | This provides a convenient interface to a | |
152 | .I hot-plug | |
153 | system. As each device is detected, | |
154 | .I mdadm | |
155 | has a chance to include it in some array as appropriate. | |
156 | ||
2ae555c3 NB |
157 | .TP |
158 | .B Manage | |
159 | This is for doing things to specific components of an array such as | |
160 | adding new spares and removing faulty devices. | |
161 | ||
162 | .TP | |
163 | .B Misc | |
164 | This is an 'everything else' mode that supports operations on active | |
165 | arrays, operations on component devices such as erasing old superblocks, and | |
166 | information gathering operations. | |
e43d0cda NB |
167 | .\"This mode allows operations on independent devices such as examine MD |
168 | .\"superblocks, erasing old superblocks and stopping active arrays. | |
2ae555c3 | 169 | |
1f48664b NB |
170 | .TP |
171 | .B Auto-detect | |
172 | This mode does not act on a specific device or array, but rather it | |
173 | requests the Linux Kernel to activate any auto-detected arrays. | |
52826846 NB |
174 | .SH OPTIONS |
175 | ||
2ae555c3 | 176 | .SH Options for selecting a mode are: |
52826846 | 177 | |
cd29a5c8 | 178 | .TP |
7e23fc43 | 179 | .BR \-A ", " \-\-assemble |
2d465520 | 180 | Assemble a pre-existing array. |
52826846 | 181 | |
cd29a5c8 | 182 | .TP |
7e23fc43 | 183 | .BR \-B ", " \-\-build |
cd29a5c8 | 184 | Build a legacy array without superblocks. |
52826846 | 185 | |
cd29a5c8 | 186 | .TP |
7e23fc43 | 187 | .BR \-C ", " \-\-create |
cd29a5c8 | 188 | Create a new array. |
52826846 | 189 | |
cd29a5c8 | 190 | .TP |
7e23fc43 | 191 | .BR \-F ", " \-\-follow ", " \-\-monitor |
cd29a5c8 NB |
192 | Select |
193 | .B Monitor | |
194 | mode. | |
52826846 | 195 | |
dd0781e5 | 196 | .TP |
7e23fc43 | 197 | .BR \-G ", " \-\-grow |
dd0781e5 | 198 | Change the size or shape of an active array. |
8382f19b NB |
199 | |
200 | .TP | |
1f48664b | 201 | .BR \-I ", " \-\-incremental |
8382f19b NB |
202 | Add a single device into an appropriate array, and possibly start the array. |
203 | ||
1f48664b NB |
204 | .TP |
205 | .B \-\-auto-detect | |
206 | Request that the kernel starts any auto-detected arrays. This can only | |
207 | work if | |
208 | .I md | |
209 | is compiled into the kernel \(em not if it is a module. | |
210 | Arrays can be auto-detected by the kernel if all the components are in | |
211 | primary MS-DOS partitions with partition type | |
212 | .BR FD . | |
213 | In-kernel autodetect is not recommended for new installations. Using | |
214 | .I mdadm | |
215 | to detect and assemble arrays \(em possibly in an | |
216 | .I initrd | |
217 | \(em is substantially more flexible and should be preferred. | |
218 | ||
2ae555c3 NB |
219 | .P |
220 | If a device is given before any options, or if the first option is | |
7e23fc43 PS |
221 | .BR \-\-add , |
222 | .BR \-\-fail , | |
2ae555c3 | 223 | or |
7e23fc43 | 224 | .BR \-\-remove , |
2ae555c3 NB |
225 | then the MANAGE mode is assume. |
226 | Anything other than these will cause the | |
227 | .B Misc | |
228 | mode to be assumed. | |
dd0781e5 | 229 | |
2ae555c3 | 230 | .SH Options that are not mode-specific are: |
e793c2e5 | 231 | |
cd29a5c8 | 232 | .TP |
7e23fc43 | 233 | .BR \-h ", " \-\-help |
a9d69660 | 234 | Display general help message or, after one of the above options, a |
93e790af | 235 | mode-specific help message. |
56eedc1a NB |
236 | |
237 | .TP | |
7e23fc43 | 238 | .B \-\-help\-options |
56eedc1a NB |
239 | Display more detailed help about command line parsing and some commonly |
240 | used options. | |
52826846 | 241 | |
cd29a5c8 | 242 | .TP |
7e23fc43 | 243 | .BR \-V ", " \-\-version |
9a9dab36 | 244 | Print version information for mdadm. |
52826846 | 245 | |
cd29a5c8 | 246 | .TP |
7e23fc43 | 247 | .BR \-v ", " \-\-verbose |
22892d56 NB |
248 | Be more verbose about what is happening. This can be used twice to be |
249 | extra-verbose. | |
a9d69660 | 250 | The extra verbosity currently only affects |
7e23fc43 | 251 | .B \-\-detail \-\-scan |
22892d56 | 252 | and |
7e23fc43 | 253 | .BR "\-\-examine \-\-scan" . |
52826846 | 254 | |
dab6685f | 255 | .TP |
7e23fc43 | 256 | .BR \-q ", " \-\-quiet |
dab6685f | 257 | Avoid printing purely informative messages. With this, |
51ac42e3 | 258 | .I mdadm |
dab6685f NB |
259 | will be silent unless there is something really important to report. |
260 | ||
cd29a5c8 | 261 | .TP |
7e23fc43 | 262 | .BR \-b ", " \-\-brief |
cd29a5c8 | 263 | Be less verbose. This is used with |
7e23fc43 | 264 | .B \-\-detail |
cd29a5c8 | 265 | and |
7e23fc43 | 266 | .BR \-\-examine . |
22892d56 | 267 | Using |
7e23fc43 | 268 | .B \-\-brief |
22892d56 | 269 | with |
7e23fc43 | 270 | .B \-\-verbose |
22892d56 | 271 | gives an intermediate level of verbosity. |
52826846 | 272 | |
e0d19036 | 273 | .TP |
7e23fc43 | 274 | .BR \-f ", " \-\-force |
93e790af | 275 | Be more forceful about certain operations. See the various modes for |
e0d19036 NB |
276 | the exact meaning of this option in different contexts. |
277 | ||
278 | .TP | |
7e23fc43 | 279 | .BR \-c ", " \-\-config= |
2ae555c3 NB |
280 | Specify the config file. Default is to use |
281 | .BR /etc/mdadm.conf , | |
93e790af | 282 | or if that is missing then |
2ae555c3 | 283 | .BR /etc/mdadm/mdadm.conf . |
5787fa49 | 284 | If the config file given is |
93e790af | 285 | .B "partitions" |
5787fa49 NB |
286 | then nothing will be read, but |
287 | .I mdadm | |
288 | will act as though the config file contained exactly | |
289 | .B "DEVICE partitions" | |
290 | and will read | |
291 | .B /proc/partitions | |
292 | to find a list of devices to scan. | |
d013a55e | 293 | If the word |
93e790af | 294 | .B "none" |
d013a55e NB |
295 | is given for the config file, then |
296 | .I mdadm | |
297 | will act as though the config file were empty. | |
e0d19036 NB |
298 | |
299 | .TP | |
7e23fc43 | 300 | .BR \-s ", " \-\-scan |
93e790af | 301 | Scan config file or |
e0d19036 NB |
302 | .B /proc/mdstat |
303 | for missing information. | |
304 | In general, this option gives | |
51ac42e3 | 305 | .I mdadm |
93e790af SW |
306 | permission to get any missing information (like component devices, |
307 | array devices, array identities, and alert destination) from the | |
308 | configuration file (see previous option); | |
309 | one exception is MISC mode when using | |
7e23fc43 | 310 | .B \-\-detail |
e0d19036 | 311 | or |
93e790af | 312 | .B \-\-stop, |
e0d19036 | 313 | in which case |
7e23fc43 | 314 | .B \-\-scan |
e0d19036 NB |
315 | says to get a list of array devices from |
316 | .BR /proc/mdstat . | |
317 | ||
570c0542 | 318 | .TP |
7e23fc43 | 319 | .B \-e ", " \-\-metadata= |
570c0542 | 320 | Declare the style of superblock (raid metadata) to be used. The |
53e8b987 | 321 | default is 0.90 for |
7e23fc43 | 322 | .BR \-\-create , |
53e8b987 | 323 | and to guess for other operations. |
2790ffe3 GB |
324 | The default can be overridden by setting the |
325 | .B metadata | |
326 | value for the | |
327 | .B CREATE | |
328 | keyword in | |
329 | .BR mdadm.conf . | |
570c0542 NB |
330 | |
331 | Options are: | |
332 | .RS | |
333 | .IP "0, 0.90, default" | |
334 | Use the original 0.90 format superblock. This format limits arrays to | |
93e790af | 335 | 28 component devices and limits component devices of levels 1 and |
570c0542 NB |
336 | greater to 2 terabytes. |
337 | .IP "1, 1.0, 1.1, 1.2" | |
338 | Use the new version-1 format superblock. This has few restrictions. | |
93e790af | 339 | The different sub-versions store the superblock at different locations |
570c0542 NB |
340 | on the device, either at the end (for 1.0), at the start (for 1.1) or |
341 | 4K from the start (for 1.2). | |
342 | .RE | |
343 | ||
41a3b72a | 344 | .TP |
7e23fc43 | 345 | .B \-\-homehost= |
35cc5be4 | 346 | This will override any |
41a3b72a | 347 | .B HOMEHOST |
93e790af | 348 | setting in the config file and provides the identity of the host which |
41a3b72a NB |
349 | should be considered the home for any arrays. |
350 | ||
351 | When creating an array, the | |
352 | .B homehost | |
353 | will be recorded in the superblock. For version-1 superblocks, it will | |
93e790af | 354 | be prefixed to the array name. For version-0.90 superblocks, part of |
41a3b72a NB |
355 | the SHA1 hash of the hostname will be stored in the later half of the |
356 | UUID. | |
357 | ||
358 | When reporting information about an array, any array which is tagged | |
359 | for the given homehost will be reported as such. | |
360 | ||
361 | When using Auto-Assemble, only arrays tagged for the given homehost | |
362 | will be assembled. | |
363 | ||
2ae555c3 NB |
364 | .SH For create, build, or grow: |
365 | ||
366 | .TP | |
7e23fc43 | 367 | .BR \-n ", " \-\-raid\-devices= |
2ae555c3 NB |
368 | Specify the number of active devices in the array. This, plus the |
369 | number of spare devices (see below) must equal the number of | |
370 | .I component-devices | |
371 | (including "\fBmissing\fP" devices) | |
372 | that are listed on the command line for | |
7e23fc43 | 373 | .BR \-\-create . |
2ae555c3 NB |
374 | Setting a value of 1 is probably |
375 | a mistake and so requires that | |
7e23fc43 | 376 | .B \-\-force |
2ae555c3 NB |
377 | be specified first. A value of 1 will then be allowed for linear, |
378 | multipath, raid0 and raid1. It is never allowed for raid4 or raid5. | |
379 | .br | |
380 | This number can only be changed using | |
7e23fc43 | 381 | .B \-\-grow |
00be0b12 NB |
382 | for RAID1, RAID5 and RAID6 arrays, and only on kernels which provide |
383 | necessary support. | |
2ae555c3 NB |
384 | |
385 | .TP | |
7e23fc43 | 386 | .BR \-x ", " \-\-spare\-devices= |
2ae555c3 NB |
387 | Specify the number of spare (eXtra) devices in the initial array. |
388 | Spares can also be added | |
389 | and removed later. The number of component devices listed | |
390 | on the command line must equal the number of raid devices plus the | |
391 | number of spare devices. | |
392 | ||
393 | ||
394 | .TP | |
7e23fc43 | 395 | .BR \-z ", " \-\-size= |
93e790af | 396 | Amount (in Kibibytes) of space to use from each drive in RAID level 1/4/5/6. |
2ae555c3 NB |
397 | This must be a multiple of the chunk size, and must leave about 128Kb |
398 | of space at the end of the drive for the RAID superblock. | |
399 | If this is not specified | |
400 | (as it normally is not) the smallest drive (or partition) sets the | |
401 | size, though if there is a variance among the drives of greater than 1%, a warning is | |
402 | issued. | |
403 | ||
404 | This value can be set with | |
7e23fc43 | 405 | .B \-\-grow |
2ae555c3 NB |
406 | for RAID level 1/4/5/6. If the array was created with a size smaller |
407 | than the currently active drives, the extra space can be accessed | |
408 | using | |
7e23fc43 | 409 | .BR \-\-grow . |
2ae555c3 NB |
410 | The size can be given as |
411 | .B max | |
412 | which means to choose the largest size that fits on all current drives. | |
52826846 | 413 | |
cd29a5c8 | 414 | .TP |
7e23fc43 | 415 | .BR \-c ", " \-\-chunk= |
cd29a5c8 | 416 | Specify chunk size of kibibytes. The default is 64. |
52826846 | 417 | |
cd29a5c8 | 418 | .TP |
7e23fc43 | 419 | .BR \-\-rounding= |
cd29a5c8 | 420 | Specify rounding factor for linear array (==chunk size) |
52826846 | 421 | |
cd29a5c8 | 422 | .TP |
7e23fc43 | 423 | .BR \-l ", " \-\-level= |
aa88f531 | 424 | Set raid level. When used with |
7e23fc43 | 425 | .BR \-\-create , |
98c6faba | 426 | options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4, |
2ae555c3 | 427 | raid5, 5, raid6, 6, raid10, 10, multipath, mp, faulty. Obviously some of these are synonymous. |
aa88f531 NB |
428 | |
429 | When used with | |
7e23fc43 | 430 | .BR \-\-build , |
a9d69660 | 431 | only linear, stripe, raid0, 0, raid1, multipath, mp, and faulty are valid. |
52826846 | 432 | |
2ae555c3 | 433 | Not yet supported with |
7e23fc43 | 434 | .BR \-\-grow . |
2ae555c3 | 435 | |
cd29a5c8 | 436 | .TP |
7e23fc43 | 437 | .BR \-p ", " \-\-layout= |
1a7dfc35 NB |
438 | This option configures the fine details of data layout for raid5, |
439 | and raid10 arrays, and controls the failure modes for | |
440 | .IR faulty . | |
441 | ||
442 | The layout of the raid5 parity block can be one of | |
7e23fc43 PS |
443 | .BR left\-asymmetric , |
444 | .BR left\-symmetric , | |
445 | .BR right\-asymmetric , | |
446 | .BR right\-symmetric , | |
53e8b987 PS |
447 | .BR la ", " ra ", " ls ", " rs . |
448 | The default is | |
7e23fc43 | 449 | .BR left\-symmetric . |
52826846 | 450 | |
93e790af SW |
451 | When setting the failure mode for level |
452 | .I faulty, | |
1a7dfc35 | 453 | the options are: |
7e23fc43 PS |
454 | .BR write\-transient ", " wt , |
455 | .BR read\-transient ", " rt , | |
456 | .BR write\-persistent ", " wp , | |
457 | .BR read\-persistent ", " rp , | |
458 | .BR write\-all , | |
459 | .BR read\-fixable ", " rf , | |
53e8b987 | 460 | .BR clear ", " flush ", " none . |
b5e64645 | 461 | |
93e790af | 462 | Each failure mode can be followed by a number, which is used as a period |
b5e64645 NB |
463 | between fault generation. Without a number, the fault is generated |
464 | once on the first relevant request. With a number, the fault will be | |
93e790af | 465 | generated after that many requests, and will continue to be generated |
b5e64645 NB |
466 | every time the period elapses. |
467 | ||
468 | Multiple failure modes can be current simultaneously by using the | |
7e23fc43 | 469 | .B \-\-grow |
53e8b987 | 470 | option to set subsequent failure modes. |
b5e64645 NB |
471 | |
472 | "clear" or "none" will remove any pending or periodic failure modes, | |
2ae555c3 | 473 | and "flush" will clear any persistent faults. |
b5e64645 | 474 | |
53e8b987 | 475 | To set the parity with |
7e23fc43 | 476 | .BR \-\-grow , |
53e8b987 | 477 | the level of the array ("faulty") |
b5e64645 NB |
478 | must be specified before the fault mode is specified. |
479 | ||
6f9a21a7 | 480 | Finally, the layout options for RAID10 are one of 'n', 'o' or 'f' followed |
93e790af | 481 | by a small number. The default is 'n2'. The supported options are: |
1a7dfc35 | 482 | |
93e790af | 483 | .I 'n' |
b578481c NB |
484 | signals 'near' copies. Multiple copies of one data block are at |
485 | similar offsets in different devices. | |
486 | ||
93e790af | 487 | .I 'o' |
b578481c NB |
488 | signals 'offset' copies. Rather than the chunks being duplicated |
489 | within a stripe, whole stripes are duplicated but are rotated by one | |
490 | device so duplicate blocks are on different devices. Thus subsequent | |
491 | copies of a block are in the next drive, and are one chunk further | |
492 | down. | |
493 | ||
93e790af | 494 | .I 'f' |
1a7dfc35 | 495 | signals 'far' copies |
93e790af SW |
496 | (multiple copies have very different offsets). |
497 | See md(4) for more detail about 'near' and 'far'. | |
1a7dfc35 NB |
498 | |
499 | The number is the number of copies of each datablock. 2 is normal, 3 | |
500 | can be useful. This number can be at most equal to the number of | |
501 | devices in the array. It does not need to divide evenly into that | |
502 | number (e.g. it is perfectly legal to have an 'n2' layout for an array | |
503 | with an odd number of devices). | |
504 | ||
cd29a5c8 | 505 | .TP |
7e23fc43 | 506 | .BR \-\-parity= |
53e8b987 | 507 | same as |
7e23fc43 | 508 | .B \-\-layout |
53e8b987 | 509 | (thus explaining the p of |
7e23fc43 | 510 | .BR \-p ). |
52826846 | 511 | |
e793c2e5 | 512 | .TP |
7e23fc43 | 513 | .BR \-b ", " \-\-bitmap= |
e793c2e5 | 514 | Specify a file to store a write-intent bitmap in. The file should not |
53e8b987 | 515 | exist unless |
7e23fc43 | 516 | .B \-\-force |
53e8b987 | 517 | is also given. The same file should be provided |
2ae555c3 | 518 | when assembling the array. If the word |
93e790af | 519 | .B "internal" |
2ae555c3 NB |
520 | is given, then the bitmap is stored with the metadata on the array, |
521 | and so is replicated on all devices. If the word | |
93e790af | 522 | .B "none" |
2ae555c3 | 523 | is given with |
7e23fc43 | 524 | .B \-\-grow |
2ae555c3 | 525 | mode, then any bitmap that is present is removed. |
e793c2e5 | 526 | |
2ae555c3 NB |
527 | To help catch typing errors, the filename must contain at least one |
528 | slash ('/') if it is a real file (not 'internal' or 'none'). | |
529 | ||
530 | Note: external bitmaps are only known to work on ext2 and ext3. | |
531 | Storing bitmap files on other filesystems may result in serious problems. | |
e793c2e5 | 532 | |
cd29a5c8 | 533 | .TP |
7e23fc43 | 534 | .BR \-\-bitmap\-chunk= |
2ae555c3 | 535 | Set the chunksize of the bitmap. Each bit corresponds to that many |
1bfdbe01 NB |
536 | Kilobytes of storage. |
537 | When using a file based bitmap, the default is to use the smallest | |
93e790af | 538 | size that is at-least 4 and requires no more than 2^21 chunks. |
2ae555c3 NB |
539 | When using an |
540 | .B internal | |
541 | bitmap, the chunksize is automatically determined to make best use of | |
542 | available space. | |
5787fa49 | 543 | |
cd29a5c8 NB |
544 | |
545 | .TP | |
7e23fc43 | 546 | .BR \-W ", " \-\-write\-mostly |
2ae555c3 | 547 | subsequent devices lists in a |
7e23fc43 PS |
548 | .BR \-\-build , |
549 | .BR \-\-create , | |
2ae555c3 | 550 | or |
7e23fc43 | 551 | .B \-\-add |
2ae555c3 NB |
552 | command will be flagged as 'write-mostly'. This is valid for RAID1 |
553 | only and means that the 'md' driver will avoid reading from these | |
554 | devices if at all possible. This can be useful if mirroring over a | |
555 | slow link. | |
52826846 | 556 | |
2ae555c3 | 557 | .TP |
7e23fc43 | 558 | .BR \-\-write\-behind= |
2ae555c3 NB |
559 | Specify that write-behind mode should be enabled (valid for RAID1 |
560 | only). If an argument is specified, it will set the maximum number | |
561 | of outstanding writes allowed. The default value is 256. | |
562 | A write-intent bitmap is required in order to use write-behind | |
563 | mode, and write-behind is only attempted on drives marked as | |
564 | .IR write-mostly . | |
dd0781e5 NB |
565 | |
566 | .TP | |
7e23fc43 | 567 | .BR \-\-assume\-clean |
dd0781e5 NB |
568 | Tell |
569 | .I mdadm | |
47d79ef8 NB |
570 | that the array pre-existed and is known to be clean. It can be useful |
571 | when trying to recover from a major failure as you can be sure that no | |
572 | data will be affected unless you actually write to the array. It can | |
573 | also be used when creating a RAID1 or RAID10 if you want to avoid the | |
b3f1c093 | 574 | initial resync, however this practice \(em while normally safe \(em is not |
93e790af | 575 | recommended. Use this only if you really know what you are doing. |
dd0781e5 | 576 | |
2ae555c3 | 577 | .TP |
7e23fc43 | 578 | .BR \-\-backup\-file= |
53e8b987 | 579 | This is needed when |
7e23fc43 | 580 | .B \-\-grow |
53e8b987 | 581 | is used to increase the number of |
2ae555c3 NB |
582 | raid-devices in a RAID5 if there are no spare devices available. |
583 | See the section below on RAID_DEVICE CHANGES. The file should be | |
584 | stored on a separate device, not on the raid array being reshaped. | |
585 | ||
947fd4dd | 586 | .TP |
7e23fc43 | 587 | .BR \-N ", " \-\-name= |
947fd4dd NB |
588 | Set a |
589 | .B name | |
590 | for the array. This is currently only effective when creating an | |
591 | array with a version-1 superblock. The name is a simple textual | |
592 | string that can be used to identify array components when assembling. | |
593 | ||
dd0781e5 | 594 | .TP |
7e23fc43 | 595 | .BR \-R ", " \-\-run |
dd0781e5 NB |
596 | Insist that |
597 | .I mdadm | |
598 | run the array, even if some of the components | |
599 | appear to be active in another array or filesystem. Normally | |
600 | .I mdadm | |
601 | will ask for confirmation before including such components in an | |
602 | array. This option causes that question to be suppressed. | |
603 | ||
604 | .TP | |
7e23fc43 | 605 | .BR \-f ", " \-\-force |
dd0781e5 NB |
606 | Insist that |
607 | .I mdadm | |
608 | accept the geometry and layout specified without question. Normally | |
609 | .I mdadm | |
610 | will not allow creation of an array with only one device, and will try | |
611 | to create a raid5 array with one missing drive (as this makes the | |
612 | initial resync work faster). With | |
7e23fc43 | 613 | .BR \-\-force , |
dd0781e5 NB |
614 | .I mdadm |
615 | will not try to be so clever. | |
616 | ||
617 | .TP | |
7e23fc43 | 618 | .BR \-a ", " "\-\-auto{=no,yes,md,mdp,part,p}{NN}" |
48f7b27a NB |
619 | Instruct mdadm to create the device file if needed, possibly allocating |
620 | an unused minor number. "md" causes a non-partitionable array | |
dd0781e5 | 621 | to be used. "mdp", "part" or "p" causes a partitionable array (2.6 and |
2ae555c3 | 622 | later) to be used. "yes" requires the named md device to have |
f9c25f1d | 623 | a 'standard' format, and the type and minor number will be determined |
48f7b27a NB |
624 | from this. See DEVICE NAMES below. |
625 | ||
a9d69660 | 626 | The argument can also come immediately after |
7e23fc43 | 627 | "\-a". e.g. "\-ap". |
dd0781e5 | 628 | |
53e8b987 | 629 | If |
7e23fc43 | 630 | .B \-\-auto |
53e8b987 | 631 | is not given on the command line or in the config file, then |
75723446 | 632 | the default will be |
7e23fc43 | 633 | .BR \-\-auto=yes . |
75723446 | 634 | |
1337546d | 635 | If |
7e23fc43 | 636 | .B \-\-scan |
1337546d NB |
637 | is also given, then any |
638 | .I auto= | |
35cc5be4 | 639 | entries in the config file will override the |
7e23fc43 | 640 | .B \-\-auto |
1337546d NB |
641 | instruction given on the command line. |
642 | ||
dd0781e5 NB |
643 | For partitionable arrays, |
644 | .I mdadm | |
645 | will create the device file for the whole array and for the first 4 | |
646 | partitions. A different number of partitions can be specified at the | |
647 | end of this option (e.g. | |
7e23fc43 | 648 | .BR \-\-auto=p7 ). |
2ae555c3 | 649 | If the device name ends with a digit, the partition names add a 'p', |
48f7b27a | 650 | and a number, e.g. "/dev/home1p3". If there is no |
dd0781e5 NB |
651 | trailing digit, then the partition names just have a number added, |
652 | e.g. "/dev/scratch3". | |
653 | ||
48f7b27a NB |
654 | If the md device name is in a 'standard' format as described in DEVICE |
655 | NAMES, then it will be created, if necessary, with the appropriate | |
656 | number based on that name. If the device name is not in one of these | |
a9d69660 | 657 | formats, then a unused minor number will be allocated. The minor |
48f7b27a NB |
658 | number will be considered unused if there is no active array for that |
659 | number, and there is no entry in /dev for that number and with a | |
660 | non-standard name. | |
661 | ||
38098016 | 662 | .TP |
7e23fc43 | 663 | .BR \-\-symlink = no |
38098016 | 664 | Normally when |
7e23fc43 | 665 | .B \-\-auto |
38098016 NB |
666 | causes |
667 | .I mdadm | |
668 | to create devices in | |
669 | .B /dev/md/ | |
670 | it will also create symlinks from | |
671 | .B /dev/ | |
672 | with names starting with | |
673 | .B md | |
674 | or | |
675 | .BR md_ . | |
676 | Use | |
7e23fc43 | 677 | .B \-\-symlink=no |
38098016 | 678 | to suppress this, or |
7e23fc43 | 679 | .B \-\-symlink=yes |
38098016 NB |
680 | to enforce this even if it is suppressing |
681 | .IR mdadm.conf . | |
682 | ||
683 | ||
52826846 NB |
684 | .SH For assemble: |
685 | ||
cd29a5c8 | 686 | .TP |
7e23fc43 | 687 | .BR \-u ", " \-\-uuid= |
cd29a5c8 NB |
688 | uuid of array to assemble. Devices which don't have this uuid are |
689 | excluded | |
690 | ||
691 | .TP | |
7e23fc43 | 692 | .BR \-m ", " \-\-super\-minor= |
cd29a5c8 NB |
693 | Minor number of device that array was created for. Devices which |
694 | don't have this minor number are excluded. If you create an array as | |
2d465520 | 695 | /dev/md1, then all superblocks will contain the minor number 1, even if |
cd29a5c8 NB |
696 | the array is later assembled as /dev/md2. |
697 | ||
d013a55e | 698 | Giving the literal word "dev" for |
7e23fc43 | 699 | .B \-\-super\-minor |
d013a55e NB |
700 | will cause |
701 | .I mdadm | |
702 | to use the minor number of the md device that is being assembled. | |
703 | e.g. when assembling | |
704 | .BR /dev/md0 , | |
51ac42e3 | 705 | .B \-\-super\-minor=dev |
d013a55e NB |
706 | will look for super blocks with a minor number of 0. |
707 | ||
947fd4dd | 708 | .TP |
7e23fc43 | 709 | .BR \-N ", " \-\-name= |
947fd4dd | 710 | Specify the name of the array to assemble. This must be the name |
624920bb | 711 | that was specified when creating the array. It must either match |
93e790af | 712 | the name stored in the superblock exactly, or it must match |
41a3b72a | 713 | with the current |
624920bb | 714 | .I homehost |
93e790af | 715 | prefixed to the start of the given name. |
947fd4dd | 716 | |
cd29a5c8 | 717 | .TP |
7e23fc43 | 718 | .BR \-f ", " \-\-force |
52826846 NB |
719 | Assemble the array even if some superblocks appear out-of-date |
720 | ||
cd29a5c8 | 721 | .TP |
7e23fc43 | 722 | .BR \-R ", " \-\-run |
b8a8ccf9 NB |
723 | Attempt to start the array even if fewer drives were given than were |
724 | present last time the array was active. Normally if not all the | |
725 | expected drives are found and | |
7e23fc43 | 726 | .B \-\-scan |
cd29a5c8 NB |
727 | is not used, then the array will be assembled but not started. |
728 | With | |
7e23fc43 | 729 | .B \-\-run |
cd29a5c8 | 730 | an attempt will be made to start it anyway. |
52826846 | 731 | |
b8a8ccf9 | 732 | .TP |
7e23fc43 | 733 | .B \-\-no\-degraded |
b8a8ccf9 | 734 | This is the reverse of |
7e23fc43 | 735 | .B \-\-run |
93e790af | 736 | in that it inhibits the startup of array unless all expected drives |
b8a8ccf9 | 737 | are present. This is only needed with |
93e790af SW |
738 | .B \-\-scan, |
739 | and can be used if the physical connections to devices are | |
b8a8ccf9 NB |
740 | not as reliable as you would like. |
741 | ||
dd0781e5 | 742 | .TP |
7e23fc43 | 743 | .BR \-a ", " "\-\-auto{=no,yes,md,mdp,part}" |
dd0781e5 NB |
744 | See this option under Create and Build options. |
745 | ||
e793c2e5 | 746 | .TP |
7e23fc43 | 747 | .BR \-b ", " \-\-bitmap= |
2ae555c3 NB |
748 | Specify the bitmap file that was given when the array was created. If |
749 | an array has an | |
750 | .B internal | |
751 | bitmap, there is no need to specify this when assembling the array. | |
752 | ||
753 | .TP | |
7e23fc43 | 754 | .BR \-\-backup\-file= |
2ae555c3 | 755 | If |
7e23fc43 | 756 | .B \-\-backup\-file |
2ae555c3 NB |
757 | was used to grow the number of raid-devices in a RAID5, and the system |
758 | crashed during the critical section, then the same | |
7e23fc43 | 759 | .B \-\-backup\-file |
53e8b987 | 760 | must be presented to |
7e23fc43 | 761 | .B \-\-assemble |
53e8b987 | 762 | to allow possibly corrupted data to be restored. |
e793c2e5 | 763 | |
5787fa49 | 764 | .TP |
7e23fc43 | 765 | .BR \-U ", " \-\-update= |
5787fa49 | 766 | Update the superblock on each device while assembling the array. The |
feb716e9 NB |
767 | argument given to this flag can be one of |
768 | .BR sparc2.2 , | |
769 | .BR summaries , | |
7d99579f | 770 | .BR uuid , |
c4f12c13 | 771 | .BR name , |
0237e0ca | 772 | .BR homehost , |
e5329c37 | 773 | .BR resync , |
586ed405 | 774 | .BR byteorder , |
bee8ec56 | 775 | .BR devicesize , |
5787fa49 | 776 | or |
7e23fc43 | 777 | .BR super\-minor . |
5787fa49 NB |
778 | |
779 | The | |
780 | .B sparc2.2 | |
7d99579f | 781 | option will adjust the superblock of an array what was created on a Sparc |
5787fa49 NB |
782 | machine running a patched 2.2 Linux kernel. This kernel got the |
783 | alignment of part of the superblock wrong. You can use the | |
7e23fc43 | 784 | .B "\-\-examine \-\-sparc2.2" |
5787fa49 NB |
785 | option to |
786 | .I mdadm | |
787 | to see what effect this would have. | |
788 | ||
789 | The | |
7e23fc43 | 790 | .B super\-minor |
5787fa49 | 791 | option will update the |
2ae555c3 | 792 | .B "preferred minor" |
5787fa49 | 793 | field on each superblock to match the minor number of the array being |
45c073c9 NB |
794 | assembled. |
795 | This can be useful if | |
7e23fc43 | 796 | .B \-\-examine |
45c073c9 | 797 | reports a different "Preferred Minor" to |
7e23fc43 | 798 | .BR \-\-detail . |
45c073c9 NB |
799 | In some cases this update will be performed automatically |
800 | by the kernel driver. In particular the update happens automatically | |
801 | at the first write to an array with redundancy (RAID level 1 or | |
802 | greater) on a 2.6 (or later) kernel. | |
5787fa49 | 803 | |
7d99579f NB |
804 | The |
805 | .B uuid | |
806 | option will change the uuid of the array. If a UUID is given with the | |
7e23fc43 | 807 | .B \-\-uuid |
53e8b987 | 808 | option that UUID will be used as a new UUID and will |
7d99579f NB |
809 | .B NOT |
810 | be used to help identify the devices in the array. | |
53e8b987 | 811 | If no |
7e23fc43 | 812 | .B \-\-uuid |
53e8b987 | 813 | is given, a random UUID is chosen. |
7d99579f | 814 | |
c4f12c13 NB |
815 | The |
816 | .B name | |
817 | option will change the | |
818 | .I name | |
819 | of the array as stored in the superblock. This is only supported for | |
820 | version-1 superblocks. | |
821 | ||
0237e0ca NB |
822 | The |
823 | .B homehost | |
824 | option will change the | |
825 | .I homehost | |
826 | as recorded in the superblock. For version-0 superblocks, this is the | |
827 | same as updating the UUID. | |
828 | For version-1 superblocks, this involves updating the name. | |
829 | ||
e5329c37 NB |
830 | The |
831 | .B resync | |
832 | option will cause the array to be marked | |
833 | .I dirty | |
834 | meaning that any redundancy in the array (e.g. parity for raid5, | |
835 | copies for raid1) may be incorrect. This will cause the raid system | |
836 | to perform a "resync" pass to make sure that all redundant information | |
837 | is correct. | |
838 | ||
586ed405 NB |
839 | The |
840 | .B byteorder | |
841 | option allows arrays to be moved between machines with different | |
842 | byte-order. | |
2ae555c3 | 843 | When assembling such an array for the first time after a move, giving |
7e23fc43 | 844 | .B "\-\-update=byteorder" |
586ed405 NB |
845 | will cause |
846 | .I mdadm | |
847 | to expect superblocks to have their byteorder reversed, and will | |
848 | correct that order before assembling the array. This is only valid | |
2ae555c3 | 849 | with original (Version 0.90) superblocks. |
586ed405 | 850 | |
feb716e9 NB |
851 | The |
852 | .B summaries | |
853 | option will correct the summaries in the superblock. That is the | |
854 | counts of total, working, active, failed, and spare devices. | |
5787fa49 | 855 | |
bee8ec56 NB |
856 | The |
857 | .B devicesize | |
858 | will rarely be of use. It applies to version 1.1 and 1.2 metadata | |
859 | only (where the metadata is at the start of the device) and is only | |
860 | useful when the component device has changed size (typically become | |
861 | larger). The version 1 metadata records the amount of the device that | |
862 | can be used to store data, so if a device in a version 1.1 or 1.2 | |
863 | array becomes larger, the metadata will still be visible, but the | |
864 | extra space will not. In this case it might be useful to assemble the | |
865 | array with | |
7e23fc43 | 866 | .BR \-\-update=devicesize . |
bee8ec56 NB |
867 | This will cause |
868 | .I mdadm | |
869 | to determine the maximum usable amount of space on each device and | |
870 | update the relevant field in the metadata. | |
871 | ||
41a3b72a | 872 | .TP |
7e23fc43 | 873 | .B \-\-auto\-update\-homehost |
93e790af | 874 | This flag is only meaningful with auto-assembly (see discussion below). |
41a3b72a NB |
875 | In that situation, if no suitable arrays are found for this homehost, |
876 | .I mdadm | |
93e790af | 877 | will rescan for any arrays at all and will assemble them and update the |
41a3b72a NB |
878 | homehost to match the current host. |
879 | ||
e0d19036 | 880 | .SH For Manage mode: |
52826846 | 881 | |
cd29a5c8 | 882 | .TP |
7e23fc43 | 883 | .BR \-a ", " \-\-add |
2ae555c3 | 884 | hot-add listed devices. |
52826846 | 885 | |
fe80f49b | 886 | .TP |
7e23fc43 | 887 | .BR \-\-re\-add |
2ae555c3 | 888 | re-add a device that was recently removed from an array. |
fe80f49b | 889 | |
cd29a5c8 | 890 | .TP |
7e23fc43 | 891 | .BR \-r ", " \-\-remove |
2d465520 | 892 | remove listed devices. They must not be active. i.e. they should |
b80da661 NB |
893 | be failed or spare devices. As well as the name of a device file |
894 | (e.g. | |
895 | .BR /dev/sda1 ) | |
896 | the words | |
897 | .B failed | |
898 | and | |
899 | .B detached | |
900 | can be given to | |
901 | .BR \-\-remove . | |
902 | The first causes all failed device to be removed. The second causes | |
93e790af | 903 | any device which is no longer connected to the system (i.e an 'open' |
b80da661 NB |
904 | returns |
905 | .BR ENXIO ) | |
906 | to be removed. This will only succeed for devices that are spares or | |
907 | have already been marked as failed. | |
52826846 | 908 | |
cd29a5c8 | 909 | .TP |
7e23fc43 | 910 | .BR \-f ", " \-\-fail |
cd29a5c8 | 911 | mark listed devices as faulty. |
b80da661 NB |
912 | As well as the name of a device file, the word |
913 | .B detached | |
914 | can be given. This will cause any device that has been detached from | |
915 | the system to be marked as failed. It can then be removed. | |
52826846 | 916 | |
cd29a5c8 | 917 | .TP |
7e23fc43 | 918 | .BR \-\-set\-faulty |
53e8b987 | 919 | same as |
7e23fc43 | 920 | .BR \-\-fail . |
52826846 | 921 | |
b3d31955 N |
922 | .TP |
923 | .BR \-\-write\-mostly | |
924 | Subsequent devices that are added or re-added will have the 'write-mostly' | |
925 | flag set. This is only valid for RAID! and means that the 'md' driver | |
926 | will avoid reading from these devices if possible. | |
927 | .TP | |
928 | .BR \-\-readwrite | |
929 | Subsequent devices that are added or re-added will have the 'write-mostly' | |
930 | flag cleared. | |
931 | ||
932 | ||
2ae555c3 | 933 | .P |
93e790af SW |
934 | Each of these options require that the first device listed is the array |
935 | to be acted upon, and the remainder are component devices to be added, | |
936 | removed, or marked as faulty. Several different operations can be | |
2ae555c3 NB |
937 | specified for different devices, e.g. |
938 | .in +5 | |
7e23fc43 | 939 | mdadm /dev/md0 \-\-add /dev/sda1 \-\-fail /dev/sdb1 \-\-remove /dev/sdb1 |
2ae555c3 NB |
940 | .in -5 |
941 | Each operation applies to all devices listed until the next | |
93e790af | 942 | operation. |
2ae555c3 NB |
943 | |
944 | If an array is using a write-intent bitmap, then devices which have | |
945 | been removed can be re-added in a way that avoids a full | |
93e790af | 946 | reconstruction but instead just updates the blocks that have changed |
2ae555c3 NB |
947 | since the device was removed. For arrays with persistent metadata |
948 | (superblocks) this is done automatically. For arrays created with | |
7e23fc43 | 949 | .B \-\-build |
2ae555c3 | 950 | mdadm needs to be told that this device we removed recently with |
7e23fc43 | 951 | .BR \-\-re\-add . |
2ae555c3 NB |
952 | |
953 | Devices can only be removed from an array if they are not in active | |
93e790af SW |
954 | use, i.e. that must be spares or failed devices. To remove an active |
955 | device, it must first be marked as | |
956 | .B faulty. | |
2ae555c3 NB |
957 | |
958 | .SH For Misc mode: | |
959 | ||
960 | .TP | |
7e23fc43 | 961 | .BR \-Q ", " \-\-query |
2ae555c3 NB |
962 | Examine a device to see |
963 | (1) if it is an md device and (2) if it is a component of an md | |
964 | array. | |
965 | Information about what is discovered is presented. | |
966 | ||
967 | .TP | |
7e23fc43 | 968 | .BR \-D ", " \-\-detail |
2ae555c3 | 969 | Print detail of one or more md devices. |
5787fa49 | 970 | |
54bad364 KS |
971 | .TP |
972 | .BR \-Y ", " \-\-export | |
973 | When used with | |
0d726f17 KS |
974 | .B \-\-detail |
975 | or | |
976 | .BR \-\-examine , | |
54bad364 KS |
977 | output will be formatted as |
978 | .B key=value | |
979 | pairs for easy import into the environment. | |
980 | ||
2ae555c3 | 981 | .TP |
7e23fc43 | 982 | .BR \-E ", " \-\-examine |
2ae555c3 | 983 | Print content of md superblock on device(s). |
5787fa49 | 984 | .TP |
7e23fc43 | 985 | .B \-\-sparc2.2 |
a9d69660 | 986 | If an array was created on a 2.2 Linux kernel patched with RAID |
5787fa49 NB |
987 | support, the superblock will have been created incorrectly, or at |
988 | least incompatibly with 2.4 and later kernels. Using the | |
7e23fc43 | 989 | .B \-\-sparc2.2 |
5787fa49 | 990 | flag with |
7e23fc43 | 991 | .B \-\-examine |
5787fa49 NB |
992 | will fix the superblock before displaying it. If this appears to do |
993 | the right thing, then the array can be successfully assembled using | |
7e23fc43 | 994 | .BR "\-\-assemble \-\-update=sparc2.2" . |
5787fa49 | 995 | |
2ae555c3 | 996 | .TP |
7e23fc43 | 997 | .BR \-X ", " \-\-examine\-bitmap |
2ae555c3 | 998 | Report information about a bitmap file. |
01d9299c NB |
999 | The argument is either an external bitmap file or an array component |
1000 | in case of an internal bitmap. | |
e0d19036 | 1001 | |
cd29a5c8 | 1002 | .TP |
7e23fc43 | 1003 | .BR \-R ", " \-\-run |
cd29a5c8 | 1004 | start a partially built array. |
52826846 | 1005 | |
cd29a5c8 | 1006 | .TP |
7e23fc43 | 1007 | .BR \-S ", " \-\-stop |
cd29a5c8 | 1008 | deactivate array, releasing all resources. |
52826846 | 1009 | |
cd29a5c8 | 1010 | .TP |
7e23fc43 | 1011 | .BR \-o ", " \-\-readonly |
cd29a5c8 | 1012 | mark array as readonly. |
52826846 | 1013 | |
cd29a5c8 | 1014 | .TP |
7e23fc43 | 1015 | .BR \-w ", " \-\-readwrite |
cd29a5c8 | 1016 | mark array as readwrite. |
52826846 | 1017 | |
e0d19036 | 1018 | .TP |
7e23fc43 | 1019 | .B \-\-zero\-superblock |
e0d19036 | 1020 | If the device contains a valid md superblock, the block is |
35cc5be4 | 1021 | overwritten with zeros. With |
7e23fc43 | 1022 | .B \-\-force |
35cc5be4 | 1023 | the block where the superblock would be is overwritten even if it |
e0d19036 | 1024 | doesn't appear to be valid. |
52826846 | 1025 | |
feb716e9 | 1026 | .TP |
7e23fc43 | 1027 | .BR \-t ", " \-\-test |
feb716e9 | 1028 | When used with |
7e23fc43 | 1029 | .BR \-\-detail , |
feb716e9 NB |
1030 | the exit status of |
1031 | .I mdadm | |
1032 | is set to reflect the status of the device. | |
1033 | ||
b90c0e9a | 1034 | .TP |
7e23fc43 | 1035 | .BR \-W ", " \-\-wait |
b90c0e9a NB |
1036 | For each md device given, wait for any resync, recovery, or reshape |
1037 | activity to finish before returning. | |
1038 | .I mdadm | |
1039 | will return with success if it actually waited for every device | |
1040 | listed, otherwise it will return failure. | |
1041 | ||
1770662b DW |
1042 | .TP |
1043 | .BR \-\-wait\-clean | |
7146ec6a DW |
1044 | For each md device given, arrange for the array to be marked clean as |
1045 | soon as possible. Also, quiesce resync so that the monitor for external | |
1046 | metadata arrays (mdmon) has an opportunity to checkpoint the resync | |
1047 | position. | |
1048 | .I mdadm | |
1049 | will return with success if the array uses external metadata and we | |
1050 | successfully waited. For native arrays this returns immediately as the | |
1051 | kernel handles both dirty-clean transitions and resync checkpointing in | |
1052 | the kernel at shutdown. No action is taken if safe-mode handling is | |
1053 | disabled. | |
1770662b | 1054 | |
8382f19b NB |
1055 | .SH For Incremental Assembly mode: |
1056 | .TP | |
7e23fc43 | 1057 | .BR \-\-rebuild\-map ", " \-r |
8382f19b NB |
1058 | Rebuild the map file |
1059 | .RB ( /var/run/mdadm/map ) | |
1060 | that | |
1061 | .I mdadm | |
1062 | uses to help track which arrays are currently being assembled. | |
1063 | ||
1064 | .TP | |
7e23fc43 | 1065 | .BR \-\-run ", " \-R |
8382f19b NB |
1066 | Run any array assembled as soon as a minimal number of devices are |
1067 | available, rather than waiting until all expected devices are present. | |
1068 | ||
1069 | .TP | |
7e23fc43 | 1070 | .BR \-\-scan ", " \-s |
8382f19b | 1071 | Only meaningful with |
7e23fc43 | 1072 | .B \-R |
8382f19b NB |
1073 | this will scan the |
1074 | .B map | |
1075 | file for arrays that are being incrementally assembled and will try to | |
1076 | start any that are not already started. If any such array is listed | |
1077 | in | |
1078 | .B mdadm.conf | |
1079 | as requiring an external bitmap, that bitmap will be attached first. | |
1080 | ||
e0d19036 NB |
1081 | .SH For Monitor mode: |
1082 | .TP | |
7e23fc43 | 1083 | .BR \-m ", " \-\-mail |
e0d19036 NB |
1084 | Give a mail address to send alerts to. |
1085 | ||
1086 | .TP | |
7e23fc43 | 1087 | .BR \-p ", " \-\-program ", " \-\-alert |
e0d19036 NB |
1088 | Give a program to be run whenever an event is detected. |
1089 | ||
773135f5 | 1090 | .TP |
7e23fc43 | 1091 | .BR \-y ", " \-\-syslog |
773135f5 NB |
1092 | Cause all events to be reported through 'syslog'. The messages have |
1093 | facility of 'daemon' and varying priorities. | |
1094 | ||
e0d19036 | 1095 | .TP |
7e23fc43 | 1096 | .BR \-d ", " \-\-delay |
e0d19036 | 1097 | Give a delay in seconds. |
51ac42e3 | 1098 | .I mdadm |
e0d19036 NB |
1099 | polls the md arrays and then waits this many seconds before polling |
1100 | again. The default is 60 seconds. | |
1101 | ||
d013a55e | 1102 | .TP |
7e23fc43 | 1103 | .BR \-f ", " \-\-daemonise |
d013a55e | 1104 | Tell |
51ac42e3 | 1105 | .I mdadm |
d013a55e NB |
1106 | to run as a background daemon if it decides to monitor anything. This |
1107 | causes it to fork and run in the child, and to disconnect form the | |
1108 | terminal. The process id of the child is written to stdout. | |
1109 | This is useful with | |
7e23fc43 | 1110 | .B \-\-scan |
d013a55e NB |
1111 | which will only continue monitoring if a mail address or alert program |
1112 | is found in the config file. | |
1113 | ||
b5e64645 | 1114 | .TP |
7e23fc43 | 1115 | .BR \-i ", " \-\-pid\-file |
b5e64645 | 1116 | When |
51ac42e3 | 1117 | .I mdadm |
b5e64645 NB |
1118 | is running in daemon mode, write the pid of the daemon process to |
1119 | the specified file, instead of printing it on standard output. | |
1120 | ||
aa88f531 | 1121 | .TP |
7e23fc43 | 1122 | .BR \-1 ", " \-\-oneshot |
aa88f531 NB |
1123 | Check arrays only once. This will generate |
1124 | .B NewArray | |
1125 | events and more significantly | |
1126 | .B DegradedArray | |
a9d69660 NB |
1127 | and |
1128 | .B SparesMissing | |
aa88f531 NB |
1129 | events. Running |
1130 | .in +5 | |
7e23fc43 | 1131 | .B " mdadm \-\-monitor \-\-scan \-1" |
aa88f531 NB |
1132 | .in -5 |
1133 | from a cron script will ensure regular notification of any degraded arrays. | |
1134 | ||
98c6faba | 1135 | .TP |
7e23fc43 | 1136 | .BR \-t ", " \-\-test |
98c6faba NB |
1137 | Generate a |
1138 | .B TestMessage | |
1139 | alert for every array found at startup. This alert gets mailed and | |
1140 | passed to the alert program. This can be used for testing that alert | |
a9d69660 | 1141 | message do get through successfully. |
98c6faba | 1142 | |
e0d19036 | 1143 | .SH ASSEMBLE MODE |
52826846 | 1144 | |
cd29a5c8 NB |
1145 | .HP 12 |
1146 | Usage: | |
7e23fc43 | 1147 | .B mdadm \-\-assemble |
5787fa49 NB |
1148 | .I md-device options-and-component-devices... |
1149 | .HP 12 | |
1150 | Usage: | |
7e23fc43 | 1151 | .B mdadm \-\-assemble \-\-scan |
5787fa49 | 1152 | .I md-devices-and-options... |
cd29a5c8 NB |
1153 | .HP 12 |
1154 | Usage: | |
7e23fc43 | 1155 | .B mdadm \-\-assemble \-\-scan |
cd29a5c8 | 1156 | .I options... |
52826846 | 1157 | |
cd29a5c8 | 1158 | .PP |
52826846 | 1159 | This usage assembles one or more raid arrays from pre-existing components. |
9a9dab36 | 1160 | For each array, mdadm needs to know the md device, the identity of the |
e0d19036 | 1161 | array, and a number of component-devices. These can be found in a number of ways. |
52826846 | 1162 | |
5787fa49 | 1163 | In the first usage example (without the |
7e23fc43 | 1164 | .BR \-\-scan ) |
5787fa49 NB |
1165 | the first device given is the md device. |
1166 | In the second usage example, all devices listed are treated as md | |
1167 | devices and assembly is attempted. | |
1168 | In the third (where no devices are listed) all md devices that are | |
1169 | listed in the configuration file are assembled. | |
52826846 | 1170 | |
d013a55e | 1171 | If precisely one device is listed, but |
7e23fc43 | 1172 | .B \-\-scan |
dd0781e5 | 1173 | is not given, then |
d013a55e NB |
1174 | .I mdadm |
1175 | acts as though | |
7e23fc43 | 1176 | .B \-\-scan |
93e790af | 1177 | was given and identity information is extracted from the configuration file. |
d013a55e | 1178 | |
2ae555c3 | 1179 | The identity can be given with the |
7e23fc43 | 1180 | .B \-\-uuid |
cd29a5c8 | 1181 | option, with the |
7e23fc43 | 1182 | .B \-\-super\-minor |
93e790af SW |
1183 | option, will be taken from the md-device record in the config file, or |
1184 | will be taken from the super block of the first component-device | |
1185 | listed on the command line. | |
52826846 | 1186 | |
2ae555c3 | 1187 | Devices can be given on the |
7e23fc43 | 1188 | .B \-\-assemble |
5787fa49 NB |
1189 | command line or in the config file. Only devices which have an md |
1190 | superblock which contains the right identity will be considered for | |
1191 | any array. | |
52826846 | 1192 | |
2ae555c3 | 1193 | The config file is only used if explicitly named with |
7e23fc43 | 1194 | .B \-\-config |
d013a55e | 1195 | or requested with (a possibly implicit) |
7e23fc43 | 1196 | .BR \-\-scan . |
52826846 | 1197 | In the later case, |
9a9dab36 | 1198 | .B /etc/mdadm.conf |
52826846 NB |
1199 | is used. |
1200 | ||
2ae555c3 | 1201 | If |
7e23fc43 | 1202 | .B \-\-scan |
cd29a5c8 NB |
1203 | is not given, then the config file will only be used to find the |
1204 | identity of md arrays. | |
52826846 | 1205 | |
2d465520 | 1206 | Normally the array will be started after it is assembled. However if |
7e23fc43 | 1207 | .B \-\-scan |
2d465520 | 1208 | is not given and insufficient drives were listed to start a complete |
cd29a5c8 NB |
1209 | (non-degraded) array, then the array is not started (to guard against |
1210 | usage errors). To insist that the array be started in this case (as | |
1a7dfc35 | 1211 | may work for RAID1, 4, 5, 6, or 10), give the |
7e23fc43 | 1212 | .B \-\-run |
cd29a5c8 | 1213 | flag. |
52826846 | 1214 | |
75723446 NB |
1215 | If the md device does not exist, then it will be created providing the |
1216 | intent is clear. i.e. the name must be in a standard form, or the | |
7e23fc43 | 1217 | .B \-\-auto |
75723446 NB |
1218 | option must be given to clarify how and whether the device should be |
1219 | created. | |
dd0781e5 | 1220 | This can be useful for handling partitioned devices (which don't have |
b3f1c093 | 1221 | a stable device number \(em it can change after a reboot) and when using |
dd0781e5 NB |
1222 | "udev" to manage your |
1223 | .B /dev | |
1224 | tree (udev cannot handle md devices because of the unusual device | |
1225 | initialisation conventions). | |
1226 | ||
1227 | If the option to "auto" is "mdp" or "part" or (on the command line | |
1228 | only) "p", then mdadm will create a partitionable array, using the | |
93e790af | 1229 | first free one that is not in use and does not already have an entry |
dd0781e5 NB |
1230 | in /dev (apart from numeric /dev/md* entries). |
1231 | ||
1232 | If the option to "auto" is "yes" or "md" or (on the command line) | |
1233 | nothing, then mdadm will create a traditional, non-partitionable md | |
1234 | array. | |
1235 | ||
1236 | It is expected that the "auto" functionality will be used to create | |
1237 | device entries with meaningful names such as "/dev/md/home" or | |
1238 | "/dev/md/root", rather than names based on the numerical array number. | |
1239 | ||
93e790af | 1240 | When using option "auto" to create a partitionable array, the device |
dd0781e5 NB |
1241 | files for the first 4 partitions are also created. If a different |
1242 | number is required it can be simply appended to the auto option. | |
1243 | e.g. "auto=part8". Partition names are created by appending a digit | |
a9d69660 | 1244 | string to the device name, with an intervening "p" if the device name |
dd0781e5 NB |
1245 | ends with a digit. |
1246 | ||
1247 | The | |
7e23fc43 | 1248 | .B \-\-auto |
dd0781e5 NB |
1249 | option is also available in Build and Create modes. As those modes do |
1250 | not use a config file, the "auto=" config option does not apply to | |
1251 | these modes. | |
52826846 | 1252 | |
41a3b72a NB |
1253 | .SS Auto Assembly |
1254 | When | |
7e23fc43 | 1255 | .B \-\-assemble |
41a3b72a | 1256 | is used with |
7e23fc43 | 1257 | .B \-\-scan |
41a3b72a NB |
1258 | and no devices are listed, |
1259 | .I mdadm | |
1260 | will first attempt to assemble all the arrays listed in the config | |
1261 | file. | |
1262 | ||
1263 | If a | |
1264 | .B homehost | |
1265 | has been specified (either in the config file or on the command line), | |
1266 | .I mdadm | |
1267 | will look further for possible arrays and will try to assemble | |
1268 | anything that it finds which is tagged as belonging to the given | |
1269 | homehost. This is the only situation where | |
1270 | .I mdadm | |
1271 | will assemble arrays without being given specific device name or | |
93e790af | 1272 | identity information for the array. |
41a3b72a NB |
1273 | |
1274 | If | |
1275 | .I mdadm | |
1276 | finds a consistent set of devices that look like they should comprise | |
1277 | an array, and if the superblock is tagged as belonging to the given | |
1278 | home host, it will automatically choose a device name and try to | |
1279 | assemble the array. If the array uses version-0.90 metadata, then the | |
1280 | .B minor | |
1281 | number as recorded in the superblock is used to create a name in | |
1282 | .B /dev/md/ | |
1283 | so for example | |
1284 | .BR /dev/md/3 . | |
1285 | If the array uses version-1 metadata, then the | |
1286 | .B name | |
1287 | from the superblock is used to similarly create a name in | |
93e790af SW |
1288 | .BR /dev/md |
1289 | (the name will have any 'host' prefix stripped first). | |
41a3b72a NB |
1290 | |
1291 | If | |
1292 | .I mdadm | |
1293 | cannot find any array for the given host at all, and if | |
7e23fc43 | 1294 | .B \-\-auto\-update\-homehost |
41a3b72a NB |
1295 | is given, then |
1296 | .I mdadm | |
1297 | will search again for any array (not just an array created for this | |
1298 | host) and will assemble each assuming | |
7e23fc43 | 1299 | .BR \-\-update=homehost . |
41a3b72a NB |
1300 | This will change the host tag in the superblock so that on the next run, |
1301 | these arrays will be found without the second pass. The intention of | |
1302 | this feature is to support transitioning a set of md arrays to using | |
1303 | homehost tagging. | |
1304 | ||
1305 | The reason for requiring arrays to be tagged with the homehost for | |
1306 | auto assembly is to guard against problems that can arise when moving | |
1307 | devices from one host to another. | |
1308 | ||
cd29a5c8 | 1309 | .SH BUILD MODE |
52826846 | 1310 | |
cd29a5c8 NB |
1311 | .HP 12 |
1312 | Usage: | |
7e23fc43 | 1313 | .B mdadm \-\-build |
93e790af | 1314 | .I md-device |
7e23fc43 PS |
1315 | .BI \-\-chunk= X |
1316 | .BI \-\-level= Y | |
1317 | .BI \-\-raid\-devices= Z | |
cd29a5c8 NB |
1318 | .I devices |
1319 | ||
1320 | .PP | |
2ae555c3 | 1321 | This usage is similar to |
7e23fc43 | 1322 | .BR \-\-create . |
a9d69660 | 1323 | The difference is that it creates an array without a superblock. With |
cd29a5c8 | 1324 | these arrays there is no difference between initially creating the array and |
52826846 NB |
1325 | subsequently assembling the array, except that hopefully there is useful |
1326 | data there in the second case. | |
1327 | ||
a9d69660 NB |
1328 | The level may raid0, linear, multipath, or faulty, or one of their |
1329 | synonyms. All devices must be listed and the array will be started | |
1330 | once complete. | |
cd29a5c8 NB |
1331 | |
1332 | .SH CREATE MODE | |
1333 | ||
1334 | .HP 12 | |
1335 | Usage: | |
7e23fc43 | 1336 | .B mdadm \-\-create |
93e790af | 1337 | .I md-device |
7e23fc43 PS |
1338 | .BI \-\-chunk= X |
1339 | .BI \-\-level= Y | |
cd29a5c8 | 1340 | .br |
7e23fc43 | 1341 | .BI \-\-raid\-devices= Z |
cd29a5c8 NB |
1342 | .I devices |
1343 | ||
1344 | .PP | |
1345 | This usage will initialise a new md array, associate some devices with | |
1346 | it, and activate the array. | |
1347 | ||
a9d69660 | 1348 | If the |
7e23fc43 | 1349 | .B \-\-auto |
dd0781e5 NB |
1350 | option is given (as described in more detail in the section on |
1351 | Assemble mode), then the md device will be created with a suitable | |
1352 | device number if necessary. | |
1353 | ||
cd29a5c8 | 1354 | As devices are added, they are checked to see if they contain raid |
2d465520 | 1355 | superblocks or filesystems. They are also checked to see if the variance in |
cd29a5c8 NB |
1356 | device size exceeds 1%. |
1357 | ||
1358 | If any discrepancy is found, the array will not automatically be run, though | |
2ae555c3 | 1359 | the presence of a |
7e23fc43 | 1360 | .B \-\-run |
cd29a5c8 NB |
1361 | can override this caution. |
1362 | ||
2d465520 | 1363 | To create a "degraded" array in which some devices are missing, simply |
d013a55e | 1364 | give the word "\fBmissing\fP" |
2d465520 | 1365 | in place of a device name. This will cause |
51ac42e3 | 1366 | .I mdadm |
2d465520 NB |
1367 | to leave the corresponding slot in the array empty. |
1368 | For a RAID4 or RAID5 array at most one slot can be | |
98c6faba | 1369 | "\fBmissing\fP"; for a RAID6 array at most two slots. |
2d465520 NB |
1370 | For a RAID1 array, only one real device needs to be given. All of the |
1371 | others can be | |
d013a55e | 1372 | "\fBmissing\fP". |
2d465520 | 1373 | |
feb716e9 | 1374 | When creating a RAID5 array, |
51ac42e3 | 1375 | .I mdadm |
feb716e9 NB |
1376 | will automatically create a degraded array with an extra spare drive. |
1377 | This is because building the spare into a degraded array is in general faster than resyncing | |
1378 | the parity on a non-degraded, but not clean, array. This feature can | |
35cc5be4 | 1379 | be overridden with the |
7e23fc43 | 1380 | .B \-\-force |
feb716e9 NB |
1381 | option. |
1382 | ||
0ee4da98 | 1383 | When creating an array with version-1 metadata a name for the array is |
41a3b72a NB |
1384 | required. |
1385 | If this is not given with the | |
7e23fc43 | 1386 | .B \-\-name |
41a3b72a NB |
1387 | option, |
1388 | .I mdadm | |
0ee4da98 | 1389 | will choose a name based on the last component of the name of the |
41a3b72a NB |
1390 | device being created. So if |
1391 | .B /dev/md3 | |
1392 | is being created, then the name | |
1393 | .B 3 | |
1394 | will be chosen. | |
1395 | If | |
1396 | .B /dev/md/home | |
1397 | is being created, then the name | |
1398 | .B home | |
1399 | will be used. | |
1400 | ||
e0f31f50 PC |
1401 | When creating a partition based array, using |
1402 | .I mdadm | |
1403 | with version-1.x metadata, the partition type should be set to | |
1404 | .B 0xDA | |
1405 | (non fs-data). This type selection allows for greater precision since | |
1406 | using any other [RAID auto-detect (0xFD) or a GNU/Linux partition (0x83)], | |
1407 | might create problems in the event of array recovery through a live cdrom. | |
1408 | ||
3d3dd91e NB |
1409 | A new array will normally get a randomly assigned 128bit UUID which is |
1410 | very likely to be unique. If you have a specific need, you can choose | |
1411 | a UUID for the array by giving the | |
7e23fc43 | 1412 | .B \-\-uuid= |
3d3dd91e NB |
1413 | option. Be warned that creating two arrays with the same UUID is a |
1414 | recipe for disaster. Also, using | |
7e23fc43 | 1415 | .B \-\-uuid= |
3d3dd91e | 1416 | when creating a v0.90 array will silently override any |
7e23fc43 | 1417 | .B \-\-homehost= |
3d3dd91e | 1418 | setting. |
e43d0cda NB |
1419 | .\"If the |
1420 | .\".B \-\-size | |
1421 | .\"option is given, it is not necessary to list any component-devices in this command. | |
1422 | .\"They can be added later, before a | |
1423 | .\".B \-\-run. | |
1424 | .\"If no | |
1425 | .\".B \-\-size | |
1426 | .\"is given, the apparent size of the smallest drive given is used. | |
cd29a5c8 | 1427 | |
53e8b987 | 1428 | The General Management options that are valid with |
7e23fc43 | 1429 | .B \-\-create |
53e8b987 | 1430 | are: |
cd29a5c8 | 1431 | .TP |
7e23fc43 | 1432 | .B \-\-run |
dd0781e5 | 1433 | insist on running the array even if some devices look like they might |
cd29a5c8 NB |
1434 | be in use. |
1435 | ||
1436 | .TP | |
7e23fc43 | 1437 | .B \-\-readonly |
b3f1c093 | 1438 | start the array readonly \(em not supported yet. |
52826846 | 1439 | |
2ae555c3 | 1440 | |
e0d19036 | 1441 | .SH MANAGE MODE |
cd29a5c8 NB |
1442 | .HP 12 |
1443 | Usage: | |
e0d19036 NB |
1444 | .B mdadm |
1445 | .I device | |
1446 | .I options... devices... | |
cd29a5c8 NB |
1447 | .PP |
1448 | ||
e0d19036 NB |
1449 | This usage will allow individual devices in an array to be failed, |
1450 | removed or added. It is possible to perform multiple operations with | |
1451 | on command. For example: | |
1452 | .br | |
7e23fc43 | 1453 | .B " mdadm /dev/md0 \-f /dev/hda1 \-r /dev/hda1 \-a /dev/hda1" |
e0d19036 NB |
1454 | .br |
1455 | will firstly mark | |
1456 | .B /dev/hda1 | |
1457 | as faulty in | |
1458 | .B /dev/md0 | |
1459 | and will then remove it from the array and finally add it back | |
2d465520 | 1460 | in as a spare. However only one md array can be affected by a single |
2ae555c3 | 1461 | command. |
e0d19036 NB |
1462 | |
1463 | .SH MISC MODE | |
1464 | .HP 12 | |
1465 | Usage: | |
9a9dab36 | 1466 | .B mdadm |
e0d19036 NB |
1467 | .I options ... |
1468 | .I devices ... | |
1469 | .PP | |
cd29a5c8 | 1470 | |
b5e64645 | 1471 | MISC mode includes a number of distinct operations that |
e0d19036 NB |
1472 | operate on distinct devices. The operations are: |
1473 | .TP | |
962a108f | 1474 | .B \-\-query |
e0d19036 NB |
1475 | The device is examined to see if it is |
1476 | (1) an active md array, or | |
1477 | (2) a component of an md array. | |
1478 | The information discovered is reported. | |
1479 | ||
1480 | .TP | |
962a108f | 1481 | .B \-\-detail |
2d465520 NB |
1482 | The device should be an active md device. |
1483 | .B mdadm | |
1484 | will display a detailed description of the array. | |
7e23fc43 | 1485 | .B \-\-brief |
2d465520 | 1486 | or |
7e23fc43 | 1487 | .B \-\-scan |
2d465520 | 1488 | will cause the output to be less detailed and the format to be |
e0d19036 | 1489 | suitable for inclusion in |
9a9dab36 | 1490 | .BR /etc/mdadm.conf . |
feb716e9 NB |
1491 | The exit status of |
1492 | .I mdadm | |
1493 | will normally be 0 unless | |
1494 | .I mdadm | |
93e790af | 1495 | failed to get useful information about the device(s); however, if the |
7e23fc43 | 1496 | .B \-\-test |
feb716e9 NB |
1497 | option is given, then the exit status will be: |
1498 | .RS | |
1499 | .TP | |
1500 | 0 | |
1501 | The array is functioning normally. | |
1502 | .TP | |
1503 | 1 | |
1504 | The array has at least one failed device. | |
1505 | .TP | |
1506 | 2 | |
a77be586 | 1507 | The array has multiple failed devices such that it is unusable. |
feb716e9 NB |
1508 | .TP |
1509 | 4 | |
1510 | There was an error while trying to get information about the device. | |
1511 | .RE | |
cd29a5c8 | 1512 | |
e0d19036 | 1513 | .TP |
962a108f | 1514 | .B \-\-examine |
2d465520 | 1515 | The device should be a component of an md array. |
51ac42e3 | 1516 | .I mdadm |
2d465520 | 1517 | will read the md superblock of the device and display the contents. |
e0d19036 | 1518 | If |
7e23fc43 | 1519 | .B \-\-brief |
93e790af | 1520 | or |
7e23fc43 | 1521 | .B \-\-scan |
93e790af | 1522 | is given, then multiple devices that are components of the one array |
e0d19036 NB |
1523 | are grouped together and reported in a single entry suitable |
1524 | for inclusion in | |
1525 | .BR /etc/mdadm.conf . | |
1526 | ||
2d465520 | 1527 | Having |
7e23fc43 | 1528 | .B \-\-scan |
e0d19036 NB |
1529 | without listing any devices will cause all devices listed in the |
1530 | config file to be examined. | |
1531 | ||
1532 | .TP | |
962a108f | 1533 | .B \-\-stop |
98c6faba NB |
1534 | The devices should be active md arrays which will be deactivated, as |
1535 | long as they are not currently in use. | |
e0d19036 NB |
1536 | |
1537 | .TP | |
962a108f | 1538 | .B \-\-run |
e0d19036 NB |
1539 | This will fully activate a partially assembled md array. |
1540 | ||
1541 | .TP | |
962a108f | 1542 | .B \-\-readonly |
e0d19036 NB |
1543 | This will mark an active array as read-only, providing that it is |
1544 | not currently being used. | |
1545 | ||
1546 | .TP | |
962a108f | 1547 | .B \-\-readwrite |
e0d19036 NB |
1548 | This will change a |
1549 | .B readonly | |
1550 | array back to being read/write. | |
1551 | ||
2d465520 | 1552 | .TP |
962a108f | 1553 | .B \-\-scan |
2d465520 | 1554 | For all operations except |
7e23fc43 PS |
1555 | .BR \-\-examine , |
1556 | .B \-\-scan | |
2d465520 NB |
1557 | will cause the operation to be applied to all arrays listed in |
1558 | .BR /proc/mdstat . | |
1559 | For | |
7e23fc43 PS |
1560 | .BR \-\-examine, |
1561 | .B \-\-scan | |
2d465520 NB |
1562 | causes all devices listed in the config file to be examined. |
1563 | ||
1564 | ||
e0d19036 NB |
1565 | .SH MONITOR MODE |
1566 | ||
cd29a5c8 NB |
1567 | .HP 12 |
1568 | Usage: | |
7e23fc43 | 1569 | .B mdadm \-\-monitor |
e0d19036 NB |
1570 | .I options... devices... |
1571 | ||
cd29a5c8 | 1572 | .PP |
e0d19036 | 1573 | This usage causes |
51ac42e3 | 1574 | .I mdadm |
e0d19036 NB |
1575 | to periodically poll a number of md arrays and to report on any events |
1576 | noticed. | |
51ac42e3 | 1577 | .I mdadm |
e0d19036 NB |
1578 | will never exit once it decides that there are arrays to be checked, |
1579 | so it should normally be run in the background. | |
1580 | ||
2d465520 | 1581 | As well as reporting events, |
51ac42e3 | 1582 | .I mdadm |
2d465520 NB |
1583 | may move a spare drive from one array to another if they are in the |
1584 | same | |
1585 | .B spare-group | |
a9d69660 | 1586 | and if the destination array has a failed drive but no spares. |
2d465520 | 1587 | |
e0d19036 | 1588 | If any devices are listed on the command line, |
51ac42e3 | 1589 | .I mdadm |
e0d19036 NB |
1590 | will only monitor those devices. Otherwise all arrays listed in the |
1591 | configuration file will be monitored. Further, if | |
7e23fc43 | 1592 | .B \-\-scan |
e0d19036 NB |
1593 | is given, then any other md devices that appear in |
1594 | .B /proc/mdstat | |
1595 | will also be monitored. | |
1596 | ||
1597 | The result of monitoring the arrays is the generation of events. | |
bd526cee | 1598 | These events are passed to a separate program (if specified) and may |
2d465520 | 1599 | be mailed to a given E-mail address. |
e0d19036 | 1600 | |
93e790af SW |
1601 | When passing events to a program, the program is run once for each event, |
1602 | and is given 2 or 3 command-line arguments: the first is the | |
1603 | name of the event (see below), the second is the name of the | |
bd526cee | 1604 | md device which is affected, and the third is the name of a related |
93e790af | 1605 | device if relevant (such as a component device that has failed). |
cd29a5c8 NB |
1606 | |
1607 | If | |
7e23fc43 | 1608 | .B \-\-scan |
e0d19036 NB |
1609 | is given, then a program or an E-mail address must be specified on the |
1610 | command line or in the config file. If neither are available, then | |
51ac42e3 | 1611 | .I mdadm |
e0d19036 NB |
1612 | will not monitor anything. |
1613 | Without | |
93e790af | 1614 | .B \-\-scan, |
51ac42e3 | 1615 | .I mdadm |
2d465520 | 1616 | will continue monitoring as long as something was found to monitor. If |
e0d19036 NB |
1617 | no program or email is given, then each event is reported to |
1618 | .BR stdout . | |
cd29a5c8 | 1619 | |
e0d19036 NB |
1620 | The different events are: |
1621 | ||
1622 | .RS 4 | |
1623 | .TP | |
1624 | .B DeviceDisappeared | |
2d465520 | 1625 | An md array which previously was configured appears to no longer be |
773135f5 | 1626 | configured. (syslog priority: Critical) |
e0d19036 | 1627 | |
b8f72a62 NB |
1628 | If |
1629 | .I mdadm | |
1630 | was told to monitor an array which is RAID0 or Linear, then it will | |
1631 | report | |
1632 | .B DeviceDisappeared | |
1633 | with the extra information | |
1634 | .BR Wrong-Level . | |
1635 | This is because RAID0 and Linear do not support the device-failed, | |
1636 | hot-spare and resync operations which are monitored. | |
1637 | ||
e0d19036 NB |
1638 | .TP |
1639 | .B RebuildStarted | |
773135f5 | 1640 | An md array started reconstruction. (syslog priority: Warning) |
e0d19036 NB |
1641 | |
1642 | .TP | |
1643 | .BI Rebuild NN | |
1644 | Where | |
1645 | .I NN | |
1646 | is 20, 40, 60, or 80, this indicates that rebuild has passed that many | |
773135f5 | 1647 | percentage of the total. (syslog priority: Warning) |
e0d19036 | 1648 | |
98c6faba NB |
1649 | .TP |
1650 | .B RebuildFinished | |
1651 | An md array that was rebuilding, isn't any more, either because it | |
773135f5 | 1652 | finished normally or was aborted. (syslog priority: Warning) |
98c6faba | 1653 | |
e0d19036 NB |
1654 | .TP |
1655 | .B Fail | |
773135f5 NB |
1656 | An active component device of an array has been marked as |
1657 | faulty. (syslog priority: Critical) | |
e0d19036 NB |
1658 | |
1659 | .TP | |
1660 | .B FailSpare | |
1661 | A spare component device which was being rebuilt to replace a faulty | |
93e790af | 1662 | device has failed. (syslog priority: Critical) |
e0d19036 NB |
1663 | |
1664 | .TP | |
1665 | .B SpareActive | |
1666 | A spare component device which was being rebuilt to replace a faulty | |
98b24a2a | 1667 | device has been successfully rebuilt and has been made active. |
773135f5 | 1668 | (syslog priority: Info) |
e0d19036 NB |
1669 | |
1670 | .TP | |
1671 | .B NewArray | |
1672 | A new md array has been detected in the | |
1673 | .B /proc/mdstat | |
773135f5 | 1674 | file. (syslog priority: Info) |
e0d19036 | 1675 | |
aa88f531 NB |
1676 | .TP |
1677 | .B DegradedArray | |
1678 | A newly noticed array appears to be degraded. This message is not | |
1679 | generated when | |
1680 | .I mdadm | |
1681 | notices a drive failure which causes degradation, but only when | |
1682 | .I mdadm | |
1683 | notices that an array is degraded when it first sees the array. | |
93e790af | 1684 | (syslog priority: Critical) |
aa88f531 | 1685 | |
e0d19036 NB |
1686 | .TP |
1687 | .B MoveSpare | |
1688 | A spare drive has been moved from one array in a | |
1689 | .B spare-group | |
1690 | to another to allow a failed drive to be replaced. | |
773135f5 | 1691 | (syslog priority: Info) |
e0d19036 | 1692 | |
b8f72a62 NB |
1693 | .TP |
1694 | .B SparesMissing | |
1695 | If | |
1696 | .I mdadm | |
1697 | has been told, via the config file, that an array should have a certain | |
1698 | number of spare devices, and | |
1699 | .I mdadm | |
93e790af | 1700 | detects that it has fewer than this number when it first sees the |
b8f72a62 NB |
1701 | array, it will report a |
1702 | .B SparesMissing | |
1703 | message. | |
d1732eeb | 1704 | (syslog priority: Warning) |
b8f72a62 | 1705 | |
98c6faba NB |
1706 | .TP |
1707 | .B TestMessage | |
1708 | An array was found at startup, and the | |
7e23fc43 | 1709 | .B \-\-test |
98c6faba | 1710 | flag was given. |
773135f5 | 1711 | (syslog priority: Info) |
e0d19036 NB |
1712 | .RE |
1713 | ||
1714 | Only | |
93e790af SW |
1715 | .B Fail, |
1716 | .B FailSpare, | |
1717 | .B DegradedArray, | |
1718 | .B SparesMissing | |
e0d19036 | 1719 | and |
98c6faba | 1720 | .B TestMessage |
e0d19036 | 1721 | cause Email to be sent. All events cause the program to be run. |
93e790af | 1722 | The program is run with two or three arguments: the event |
e0d19036 NB |
1723 | name, the array device and possibly a second device. |
1724 | ||
1725 | Each event has an associated array device (e.g. | |
1726 | .BR /dev/md1 ) | |
1727 | and possibly a second device. For | |
1728 | .BR Fail , | |
1729 | .BR FailSpare , | |
1730 | and | |
1731 | .B SpareActive | |
1732 | the second device is the relevant component device. | |
1733 | For | |
1734 | .B MoveSpare | |
1735 | the second device is the array that the spare was moved from. | |
1736 | ||
1737 | For | |
51ac42e3 | 1738 | .I mdadm |
e0d19036 | 1739 | to move spares from one array to another, the different arrays need to |
93e790af | 1740 | be labeled with the same |
e0d19036 NB |
1741 | .B spare-group |
1742 | in the configuration file. The | |
1743 | .B spare-group | |
93e790af | 1744 | name can be any string; it is only necessary that different spare |
2d465520 | 1745 | groups use different names. |
e0d19036 NB |
1746 | |
1747 | When | |
51ac42e3 | 1748 | .I mdadm |
93e790af | 1749 | detects that an array in a spare group has fewer active |
e0d19036 NB |
1750 | devices than necessary for the complete array, and has no spare |
1751 | devices, it will look for another array in the same spare group that | |
1752 | has a full complement of working drive and a spare. It will then | |
1753 | attempt to remove the spare from the second drive and add it to the | |
1754 | first. | |
1755 | If the removal succeeds but the adding fails, then it is added back to | |
1756 | the original array. | |
1757 | ||
dd0781e5 NB |
1758 | .SH GROW MODE |
1759 | The GROW mode is used for changing the size or shape of an active | |
1760 | array. | |
1761 | For this to work, the kernel must support the necessary change. | |
2ae555c3 | 1762 | Various types of growth are being added during 2.6 development, |
dd0781e5 NB |
1763 | including restructuring a raid5 array to have more active devices. |
1764 | ||
dfd4d8ee NB |
1765 | Currently the only support available is to |
1766 | .IP \(bu 4 | |
1767 | change the "size" attribute | |
1768 | for RAID1, RAID5 and RAID6. | |
1769 | .IP \(bu 4 | |
e5669f40 | 1770 | increase the "raid\-devices" attribute of RAID1, RAID5, and RAID6. |
dfd4d8ee | 1771 | .IP \(bu 4 |
93e790af | 1772 | add a write-intent bitmap to any array which supports these bitmaps, or |
2ae555c3 | 1773 | remove a write-intent bitmap from such an array. |
dfd4d8ee | 1774 | .PP |
dd0781e5 | 1775 | |
2ae555c3 | 1776 | .SS SIZE CHANGES |
fe80f49b | 1777 | Normally when an array is built the "size" it taken from the smallest |
dd0781e5 NB |
1778 | of the drives. If all the small drives in an arrays are, one at a |
1779 | time, removed and replaced with larger drives, then you could have an | |
1780 | array of large drives with only a small amount used. In this | |
1781 | situation, changing the "size" with "GROW" mode will allow the extra | |
1782 | space to start being used. If the size is increased in this way, a | |
1783 | "resync" process will start to make sure the new parts of the array | |
1784 | are synchronised. | |
1785 | ||
1786 | Note that when an array changes size, any filesystem that may be | |
1787 | stored in the array will not automatically grow to use the space. The | |
1788 | filesystem will need to be explicitly told to use the extra space. | |
1789 | ||
2ae555c3 NB |
1790 | .SS RAID-DEVICES CHANGES |
1791 | ||
dd0781e5 NB |
1792 | A RAID1 array can work with any number of devices from 1 upwards |
1793 | (though 1 is not very useful). There may be times which you want to | |
1794 | increase or decrease the number of active devices. Note that this is | |
1795 | different to hot-add or hot-remove which changes the number of | |
1796 | inactive devices. | |
1797 | ||
1798 | When reducing the number of devices in a RAID1 array, the slots which | |
1799 | are to be removed from the array must already be vacant. That is, the | |
93e790af | 1800 | devices which were in those slots must be failed and removed. |
dd0781e5 NB |
1801 | |
1802 | When the number of devices is increased, any hot spares that are | |
a9d69660 | 1803 | present will be activated immediately. |
dd0781e5 | 1804 | |
2ae555c3 NB |
1805 | Increasing the number of active devices in a RAID5 is much more |
1806 | effort. Every block in the array will need to be read and written | |
1807 | back to a new location. From 2.6.17, the Linux Kernel is able to do | |
1808 | this safely, including restart and interrupted "reshape". | |
1809 | ||
1810 | When relocating the first few stripes on a raid5, it is not possible | |
1811 | to keep the data on disk completely consistent and crash-proof. To | |
1812 | provide the required safety, mdadm disables writes to the array while | |
1813 | this "critical section" is reshaped, and takes a backup of the data | |
1814 | that is in that section. This backup is normally stored in any spare | |
1815 | devices that the array has, however it can also be stored in a | |
1816 | separate file specified with the | |
7e23fc43 | 1817 | .B \-\-backup\-file |
2ae555c3 NB |
1818 | option. If this option is used, and the system does crash during the |
1819 | critical period, the same file must be passed to | |
7e23fc43 | 1820 | .B \-\-assemble |
2ae555c3 NB |
1821 | to restore the backup and reassemble the array. |
1822 | ||
1823 | .SS BITMAP CHANGES | |
1824 | ||
1825 | A write-intent bitmap can be added to, or removed from, an active | |
93e790af | 1826 | array. Either internal bitmaps, or bitmaps stored in a separate file, |
fe80f49b NB |
1827 | can be added. Note that if you add a bitmap stored in a file which is |
1828 | in a filesystem that is on the raid array being affected, the system | |
1829 | will deadlock. The bitmap must be on a separate filesystem. | |
1830 | ||
8382f19b NB |
1831 | .SH INCREMENTAL MODE |
1832 | ||
1833 | .HP 12 | |
1834 | Usage: | |
7e23fc43 PS |
1835 | .B mdadm \-\-incremental |
1836 | .RB [ \-\-run ] | |
1837 | .RB [ \-\-quiet ] | |
8382f19b NB |
1838 | .I component-device |
1839 | .HP 12 | |
1840 | Usage: | |
7e23fc43 | 1841 | .B mdadm \-\-incremental \-\-rebuild |
8382f19b NB |
1842 | .HP 12 |
1843 | Usage: | |
7e23fc43 | 1844 | .B mdadm \-\-incremental \-\-run \-\-scan |
8382f19b NB |
1845 | |
1846 | ||
1847 | .PP | |
1848 | This mode is designed to be used in conjunction with a device | |
1849 | discovery system. As devices are found in a system, they can be | |
1850 | passed to | |
7e23fc43 | 1851 | .B "mdadm \-\-incremental" |
8382f19b NB |
1852 | to be conditionally added to an appropriate array. |
1853 | ||
1854 | .I mdadm | |
1855 | performs a number of tests to determine if the device is part of an | |
93e790af | 1856 | array, and which array it should be part of. If an appropriate array |
8382f19b NB |
1857 | is found, or can be created, |
1858 | .I mdadm | |
1859 | adds the device to the array and conditionally starts the array. | |
1860 | ||
1861 | Note that | |
1862 | .I mdadm | |
1863 | will only add devices to an array which were previously working | |
1864 | (active or spare) parts of that array. It does not currently support | |
1865 | automatic inclusion of a new drive as a spare in some array. | |
1866 | ||
7e23fc43 | 1867 | .B "mdadm \-\-incremental" |
93e790af SW |
1868 | requires a bug-fix in all kernels through 2.6.19. |
1869 | Hopefully, this will be fixed in 2.6.20; alternately, apply the patch | |
8382f19b NB |
1870 | which is included with the mdadm source distribution. If |
1871 | .I mdadm | |
1872 | detects that this bug is present, it will abort any attempt to use | |
7e23fc43 | 1873 | .BR \-\-incremental . |
8382f19b NB |
1874 | |
1875 | The tests that | |
1876 | .I mdadm | |
1877 | makes are as follow: | |
1878 | .IP + | |
1879 | Is the device permitted by | |
1880 | .BR mdadm.conf ? | |
1881 | That is, is it listed in a | |
1882 | .B DEVICES | |
1883 | line in that file. If | |
1884 | .B DEVICES | |
1885 | is absent then the default it to allow any device. Similar if | |
1886 | .B DEVICES | |
1887 | contains the special word | |
1888 | .B partitions | |
1889 | then any device is allowed. Otherwise the device name given to | |
1890 | .I mdadm | |
1891 | must match one of the names or patterns in a | |
1892 | .B DEVICES | |
1893 | line. | |
1894 | ||
1895 | .IP + | |
1896 | Does the device have a valid md superblock. If a specific metadata | |
1897 | version is request with | |
7e23fc43 | 1898 | .B \-\-metadata |
8382f19b | 1899 | or |
7e23fc43 | 1900 | .B \-e |
8382f19b NB |
1901 | then only that style of metadata is accepted, otherwise |
1902 | .I mdadm | |
1903 | finds any known version of metadata. If no | |
1904 | .I md | |
1905 | metadata is found, the device is rejected. | |
1906 | ||
1907 | .IP + | |
1908 | Does the metadata match an expected array? | |
1909 | The metadata can match in two ways. Either there is an array listed | |
1910 | in | |
1911 | .B mdadm.conf | |
1912 | which identifies the array (either by UUID, by name, by device list, | |
93e790af | 1913 | or by minor-number), or the array was created with a |
8382f19b | 1914 | .B homehost |
93e790af | 1915 | specified and that |
8382f19b | 1916 | .B homehost |
93e790af | 1917 | matches the one in |
8382f19b NB |
1918 | .B mdadm.conf |
1919 | or on the command line. | |
1920 | If | |
1921 | .I mdadm | |
1922 | is not able to positively identify the array as belonging to the | |
1923 | current host, the device will be rejected. | |
1924 | ||
1925 | .IP + | |
1926 | .I mdadm | |
93e790af | 1927 | keeps a list of arrays that it has partially assembled in |
8382f19b NB |
1928 | .B /var/run/mdadm/map |
1929 | (or | |
1930 | .B /var/run/mdadm.map | |
1931 | if the directory doesn't exist). If no array exists which matches | |
1932 | the metadata on the new device, | |
1933 | .I mdadm | |
1934 | must choose a device name and unit number. It does this based on any | |
1935 | name given in | |
1936 | .B mdadm.conf | |
1937 | or any name information stored in the metadata. If this name | |
1938 | suggests a unit number, that number will be used, otherwise a free | |
1939 | unit number will be chosen. Normally | |
1940 | .I mdadm | |
1941 | will prefer to create a partitionable array, however if the | |
1942 | .B CREATE | |
1943 | line in | |
1944 | .B mdadm.conf | |
1945 | suggests that a non-partitionable array is preferred, that will be | |
1946 | honoured. | |
1947 | ||
1948 | .IP + | |
1949 | Once an appropriate array is found or created and the device is added, | |
1950 | .I mdadm | |
1951 | must decide if the array is ready to be started. It will | |
1952 | normally compare the number of available (non-spare) devices to the | |
1953 | number of devices that the metadata suggests need to be active. If | |
1954 | there are at least that many, the array will be started. This means | |
1955 | that if any devices are missing the array will not be restarted. | |
1956 | ||
1957 | As an alternative, | |
7e23fc43 | 1958 | .B \-\-run |
8382f19b | 1959 | may be passed to |
51ac42e3 | 1960 | .I mdadm |
8382f19b NB |
1961 | in which case the array will be run as soon as there are enough |
1962 | devices present for the data to be accessible. For a raid1, that | |
1963 | means one device will start the array. For a clean raid5, the array | |
1964 | will be started as soon as all but one drive is present. | |
1965 | ||
93e790af | 1966 | Note that neither of these approaches is really ideal. If it can |
8382f19b NB |
1967 | be known that all device discovery has completed, then |
1968 | .br | |
7e23fc43 | 1969 | .B " mdadm \-IRs" |
8382f19b NB |
1970 | .br |
1971 | can be run which will try to start all arrays that are being | |
1972 | incrementally assembled. They are started in "read-auto" mode in | |
1973 | which they are read-only until the first write request. This means | |
1974 | that no metadata updates are made and no attempt at resync or recovery | |
1975 | happens. Further devices that are found before the first write can | |
1976 | still be added safely. | |
1977 | ||
5545fa6d DW |
1978 | |
1979 | .SH ENVIRONMENT | |
1980 | This section describes environment variables that affect how mdadm | |
1981 | operates. | |
1982 | ||
1983 | .TP | |
1984 | .B MDADM_NO_MDMON | |
1985 | Setting this value to 1 will prevent mdadm from automatically launching | |
1986 | mdmon. This variable is intended primarily for debugging mdadm/mdmon. | |
1987 | ||
2d465520 NB |
1988 | .SH EXAMPLES |
1989 | ||
7e23fc43 | 1990 | .B " mdadm \-\-query /dev/name-of-device" |
2d465520 | 1991 | .br |
5787fa49 NB |
1992 | This will find out if a given device is a raid array, or is part of |
1993 | one, and will provide brief information about the device. | |
2d465520 | 1994 | |
7e23fc43 | 1995 | .B " mdadm \-\-assemble \-\-scan" |
2d465520 | 1996 | .br |
93e790af | 1997 | This will assemble and start all arrays listed in the standard config |
5787fa49 | 1998 | file. This command will typically go in a system startup file. |
2d465520 | 1999 | |
7e23fc43 | 2000 | .B " mdadm \-\-stop \-\-scan" |
5787fa49 | 2001 | .br |
93e790af | 2002 | This will shut down all arrays that can be shut down (i.e. are not |
19f8b8fc | 2003 | currently in use). This will typically go in a system shutdown script. |
2d465520 | 2004 | |
7e23fc43 | 2005 | .B " mdadm \-\-follow \-\-scan \-\-delay=120" |
2d465520 | 2006 | .br |
5787fa49 NB |
2007 | If (and only if) there is an Email address or program given in the |
2008 | standard config file, then | |
2009 | monitor the status of all arrays listed in that file by | |
2010 | polling them ever 2 minutes. | |
2d465520 | 2011 | |
7e23fc43 | 2012 | .B " mdadm \-\-create /dev/md0 \-\-level=1 \-\-raid\-devices=2 /dev/hd[ac]1" |
2d465520 | 2013 | .br |
5787fa49 | 2014 | Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1. |
2d465520 | 2015 | |
2d465520 | 2016 | .br |
7e23fc43 | 2017 | .B " echo 'DEVICE /dev/hd*[0\-9] /dev/sd*[0\-9]' > mdadm.conf" |
2d465520 | 2018 | .br |
7e23fc43 | 2019 | .B " mdadm \-\-detail \-\-scan >> mdadm.conf" |
2d465520 | 2020 | .br |
5787fa49 NB |
2021 | This will create a prototype config file that describes currently |
2022 | active arrays that are known to be made from partitions of IDE or SCSI drives. | |
2d465520 NB |
2023 | This file should be reviewed before being used as it may |
2024 | contain unwanted detail. | |
2025 | ||
7e23fc43 | 2026 | .B " echo 'DEVICE /dev/hd[a\-z] /dev/sd*[a\-z]' > mdadm.conf" |
2d465520 | 2027 | .br |
7e23fc43 | 2028 | .B " mdadm \-\-examine \-\-scan \-\-config=mdadm.conf >> mdadm.conf" |
93e790af SW |
2029 | .br |
2030 | This will find arrays which could be assembled from existing IDE and | |
2031 | SCSI whole drives (not partitions), and store the information in the | |
5787fa49 | 2032 | format of a config file. |
2d465520 NB |
2033 | This file is very likely to contain unwanted detail, particularly |
2034 | the | |
2035 | .B devices= | |
5787fa49 NB |
2036 | entries. It should be reviewed and edited before being used as an |
2037 | actual config file. | |
2d465520 | 2038 | |
7e23fc43 | 2039 | .B " mdadm \-\-examine \-\-brief \-\-scan \-\-config=partitions" |
2d465520 | 2040 | .br |
7e23fc43 | 2041 | .B " mdadm \-Ebsc partitions" |
5787fa49 NB |
2042 | .br |
2043 | Create a list of devices by reading | |
2044 | .BR /proc/partitions , | |
2045 | scan these for RAID superblocks, and printout a brief listing of all | |
93e790af | 2046 | that were found. |
2d465520 | 2047 | |
7e23fc43 | 2048 | .B " mdadm \-Ac partitions \-m 0 /dev/md0" |
2d465520 | 2049 | .br |
5787fa49 NB |
2050 | Scan all partitions and devices listed in |
2051 | .BR /proc/partitions | |
2052 | and assemble | |
2053 | .B /dev/md0 | |
2054 | out of all such devices with a RAID superblock with a minor number of 0. | |
2d465520 | 2055 | |
7e23fc43 | 2056 | .B " mdadm \-\-monitor \-\-scan \-\-daemonise > /var/run/mdadm" |
d013a55e NB |
2057 | .br |
2058 | If config file contains a mail address or alert program, run mdadm in | |
2059 | the background in monitor mode monitoring all md devices. Also write | |
2060 | pid of mdadm daemon to | |
2061 | .BR /var/run/mdadm . | |
2062 | ||
7e23fc43 | 2063 | .B " mdadm \-Iq /dev/somedevice" |
8382f19b NB |
2064 | .br |
2065 | Try to incorporate newly discovered device into some array as | |
2066 | appropriate. | |
2067 | ||
7e23fc43 | 2068 | .B " mdadm \-\-incremental \-\-rebuild \-\-run \-\-scan" |
8382f19b NB |
2069 | .br |
2070 | Rebuild the array map from any current arrays, and then start any that | |
2071 | can be started. | |
2072 | ||
b80da661 NB |
2073 | .B " mdadm /dev/md4 --fail detached --remove detached" |
2074 | .br | |
2075 | Any devices which are components of /dev/md4 will be marked as faulty | |
2076 | and then remove from the array. | |
2077 | ||
7e23fc43 | 2078 | .B " mdadm \-\-create \-\-help" |
2d465520 | 2079 | .br |
2ae555c3 | 2080 | Provide help about the Create mode. |
2d465520 | 2081 | |
7e23fc43 | 2082 | .B " mdadm \-\-config \-\-help" |
5787fa49 NB |
2083 | .br |
2084 | Provide help about the format of the config file. | |
2d465520 | 2085 | |
7e23fc43 | 2086 | .B " mdadm \-\-help" |
5787fa49 NB |
2087 | .br |
2088 | Provide general help. | |
cd29a5c8 | 2089 | |
cd29a5c8 NB |
2090 | |
2091 | .SH FILES | |
2092 | ||
2093 | .SS /proc/mdstat | |
2094 | ||
2ae555c3 NB |
2095 | If you're using the |
2096 | .B /proc | |
cd29a5c8 NB |
2097 | filesystem, |
2098 | .B /proc/mdstat | |
2d465520 | 2099 | lists all active md devices with information about them. |
51ac42e3 | 2100 | .I mdadm |
2d465520 | 2101 | uses this to find arrays when |
7e23fc43 | 2102 | .B \-\-scan |
2d465520 NB |
2103 | is given in Misc mode, and to monitor array reconstruction |
2104 | on Monitor mode. | |
2105 | ||
cd29a5c8 | 2106 | |
9a9dab36 | 2107 | .SS /etc/mdadm.conf |
cd29a5c8 | 2108 | |
11a3e71d NB |
2109 | The config file lists which devices may be scanned to see if |
2110 | they contain MD super block, and gives identifying information | |
2111 | (e.g. UUID) about known MD arrays. See | |
2112 | .BR mdadm.conf (5) | |
2113 | for more details. | |
cd29a5c8 | 2114 | |
8382f19b NB |
2115 | .SS /var/run/mdadm/map |
2116 | When | |
7e23fc43 | 2117 | .B \-\-incremental |
93e790af | 2118 | mode is used, this file gets a list of arrays currently being created. |
8382f19b NB |
2119 | If |
2120 | .B /var/run/mdadm | |
2121 | does not exist as a directory, then | |
2122 | .B /var/run/mdadm.map | |
2123 | is used instead. | |
2124 | ||
48f7b27a NB |
2125 | .SH DEVICE NAMES |
2126 | ||
2127 | While entries in the /dev directory can have any format you like, | |
2128 | .I mdadm | |
2129 | has an understanding of 'standard' formats which it uses to guide its | |
2130 | behaviour when creating device files via the | |
7e23fc43 | 2131 | .B \-\-auto |
48f7b27a NB |
2132 | option. |
2133 | ||
2134 | The standard names for non-partitioned arrays (the only sort of md | |
93e790af | 2135 | array available in 2.4 and earlier) are either of |
48f7b27a NB |
2136 | .IP |
2137 | /dev/mdNN | |
2138 | .br | |
2139 | /dev/md/NN | |
2140 | .PP | |
2141 | where NN is a number. | |
2142 | The standard names for partitionable arrays (as available from 2.6 | |
93e790af | 2143 | onwards) are either of |
48f7b27a NB |
2144 | .IP |
2145 | /dev/md/dNN | |
2146 | .br | |
2147 | /dev/md_dNN | |
2148 | .PP | |
2149 | Partition numbers should be indicated by added "pMM" to these, thus "/dev/md/d1p2". | |
52826846 | 2150 | |
2d465520 | 2151 | .SH NOTE |
51ac42e3 | 2152 | .I mdadm |
2d465520 | 2153 | was previously known as |
51ac42e3 | 2154 | .IR mdctl . |
a9d69660 | 2155 | .P |
51ac42e3 | 2156 | .I mdadm |
a9d69660 | 2157 | is completely separate from the |
51ac42e3 | 2158 | .I raidtools |
a9d69660 NB |
2159 | package, and does not use the |
2160 | .I /etc/raidtab | |
2161 | configuration file at all. | |
2162 | ||
52826846 | 2163 | .SH SEE ALSO |
75f74377 | 2164 | For further information on mdadm usage, MD and the various levels of |
3cdfb6a7 | 2165 | RAID, see: |
3cdfb6a7 | 2166 | .IP |
11cd8b79 | 2167 | .B http://linux\-raid.osdl.org/ |
75f74377 DG |
2168 | .PP |
2169 | (based upon Jakob \(/Ostergaard's Software\-RAID.HOWTO) | |
e43d0cda NB |
2170 | .\".PP |
2171 | .\"for new releases of the RAID driver check out: | |
2172 | .\" | |
2173 | .\".IP | |
2174 | .\".UR ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches | |
2175 | .\"ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches | |
2176 | .\".UE | |
2177 | .\".PP | |
2178 | .\"or | |
2179 | .\".IP | |
2180 | .\".UR http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/ | |
2181 | .\"http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/ | |
2182 | .\".UE | |
cd29a5c8 | 2183 | .PP |
2ae555c3 | 2184 | The latest version of |
a9d69660 NB |
2185 | .I mdadm |
2186 | should always be available from | |
cd29a5c8 | 2187 | .IP |
11cd8b79 N |
2188 | .B http://www.kernel.org/pub/linux/utils/raid/mdadm/ |
2189 | .PP | |
2190 | Related man pages: | |
cd29a5c8 | 2191 | .PP |
a9d69660 NB |
2192 | .IR mdadm.conf (5), |
2193 | .IR md (4). | |
56eb10c0 | 2194 | .PP |
52826846 NB |
2195 | .IR raidtab (5), |
2196 | .IR raid0run (8), | |
2197 | .IR raidstop (8), | |
a9d69660 | 2198 | .IR mkraid (8). |