1MDADM(8) System Manager's Manual MDADM(8)
2
3
4
6 mdadm - manage MD devices aka Linux Software RAID
7
8
10 mdadm [mode] <raiddevice> [options] <component-devices>
11
12
14 RAID devices are virtual devices created from two or more real block
15 devices. This allows multiple devices (typically disk drives or parti‐
16 tions thereof) to be combined into a single device to hold (for exam‐
17 ple) a single filesystem. Some RAID levels include redundancy and so
18 can survive some degree of device failure.
19
20 Linux Software RAID devices are implemented through the md (Multiple
21 Devices) device driver.
22
23 Currently, Linux supports LINEAR md devices, RAID0 (striping), RAID1
24 (mirroring), RAID4, RAID5, RAID6, RAID10, MULTIPATH, FAULTY, and CON‐
25 TAINER.
26
27 MULTIPATH is not a Software RAID mechanism, but does involve multiple
28 devices: each device is a path to one common physical storage device.
29 New installations should not use md/multipath as it is not well sup‐
30 ported and has no ongoing development. Use the Device Mapper based
31 multipath-tools instead.
32
33 FAULTY is also not true RAID, and it only involves one device. It pro‐
34 vides a layer over a true device that can be used to inject faults.
35
36 CONTAINER is different again. A CONTAINER is a collection of devices
37 that are managed as a set. This is similar to the set of devices con‐
38 nected to a hardware RAID controller. The set of devices may contain a
39 number of different RAID arrays each utilising some (or all) of the
40 blocks from a number of the devices in the set. For example, two
41 devices in a 5-device set might form a RAID1 using the whole devices.
42 The remaining three might have a RAID5 over the first half of each
43 device, and a RAID0 over the second half.
44
45 With a CONTAINER, there is one set of metadata that describes all of
46 the arrays in the container. So when mdadm creates a CONTAINER device,
47 the device just represents the metadata. Other normal arrays (RAID1
48 etc) can be created inside the container.
49
50
52 mdadm has several major modes of operation:
53
54 Assemble
55 Assemble the components of a previously created array into an
56 active array. Components can be explicitly given or can be
57 searched for. mdadm checks that the components do form a bona
58 fide array, and can, on request, fiddle superblock information
59 so as to assemble a faulty array.
60
61
62 Build Build an array that doesn't have per-device metadata
63 (superblocks). For these sorts of arrays, mdadm cannot differ‐
64 entiate between initial creation and subsequent assembly of an
65 array. It also cannot perform any checks that appropriate com‐
66 ponents have been requested. Because of this, the Build mode
67 should only be used together with a complete understanding of
68 what you are doing.
69
70
71 Create Create a new array with per-device metadata (superblocks).
72 Appropriate metadata is written to each device, and then the
73 array comprising those devices is activated. A 'resync' process
74 is started to make sure that the array is consistent (e.g. both
75 sides of a mirror contain the same data) but the content of the
76 device is left otherwise untouched. The array can be used as
77 soon as it has been created. There is no need to wait for the
78 initial resync to finish.
79
80
81 Follow or Monitor
82 Monitor one or more md devices and act on any state changes.
83 This is only meaningful for RAID1, 4, 5, 6, 10 or multipath
84 arrays, as only these have interesting state. RAID0 or Linear
85 never have missing, spare, or failed drives, so there is nothing
86 to monitor.
87
88
89 Grow Grow (or shrink) an array, or otherwise reshape it in some way.
90 Currently supported growth options including changing the active
91 size of component devices and changing the number of active
92 devices in RAID levels 1/4/5/6, changing the RAID level between
93 1, 5, and 6, changing the chunk size and layout for RAID5 and
94 RAID5, as well as adding or removing a write-intent bitmap.
95
96
97 Incremental Assembly
98 Add a single device to an appropriate array. If the addition of
99 the device makes the array runnable, the array will be started.
100 This provides a convenient interface to a hot-plug system. As
101 each device is detected, mdadm has a chance to include it in
102 some array as appropriate. Optionally, when the --fail flag is
103 passed in we will remove the device from any active array
104 instead of adding it.
105
106 If a CONTAINER is passed to mdadm in this mode, then any arrays
107 within that container will be assembled and started.
108
109
110 Manage This is for doing things to specific components of an array such
111 as adding new spares and removing faulty devices.
112
113
114 Misc This is an 'everything else' mode that supports operations on
115 active arrays, operations on component devices such as erasing
116 old superblocks, and information gathering operations.
117
118
119 Auto-detect
120 This mode does not act on a specific device or array, but rather
121 it requests the Linux Kernel to activate any auto-detected
122 arrays.
123
126 -A, --assemble
127 Assemble a pre-existing array.
128
129
130 -B, --build
131 Build a legacy array without superblocks.
132
133
134 -C, --create
135 Create a new array.
136
137
138 -F, --follow, --monitor
139 Select Monitor mode.
140
141
142 -G, --grow
143 Change the size or shape of an active array.
144
145
146 -I, --incremental
147 Add/remove a single device to/from an appropriate array, and
148 possibly start the array.
149
150
151 --auto-detect
152 Request that the kernel starts any auto-detected arrays. This
153 can only work if md is compiled into the kernel — not if it is a
154 module. Arrays can be auto-detected by the kernel if all the
155 components are in primary MS-DOS partitions with partition type
156 FD, and all use v0.90 metadata. In-kernel autodetect is not
157 recommended for new installations. Using mdadm to detect and
158 assemble arrays — possibly in an initrd — is substantially more
159 flexible and should be preferred.
160
161
162 If a device is given before any options, or if the first option is
163 --add, --fail, or --remove, then the MANAGE mode is assumed. Anything
164 other than these will cause the Misc mode to be assumed.
165
166
168 -h, --help
169 Display general help message or, after one of the above options,
170 a mode-specific help message.
171
172
173 --help-options
174 Display more detailed help about command line parsing and some
175 commonly used options.
176
177
178 -V, --version
179 Print version information for mdadm.
180
181
182 -v, --verbose
183 Be more verbose about what is happening. This can be used twice
184 to be extra-verbose. The extra verbosity currently only affects
185 --detail --scan and --examine --scan.
186
187
188 -q, --quiet
189 Avoid printing purely informative messages. With this, mdadm
190 will be silent unless there is something really important to
191 report.
192
193
194 -f, --force
195 Be more forceful about certain operations. See the various
196 modes for the exact meaning of this option in different con‐
197 texts.
198
199
200 -c, --config=
201 Specify the config file. Default is to use /etc/mdadm.conf, or
202 if that is missing then /etc/mdadm/mdadm.conf. If the config
203 file given is partitions then nothing will be read, but mdadm
204 will act as though the config file contained exactly DEVICE par‐
205 titions containers and will read /proc/partitions to find a list
206 of devices to scan, and /proc/mdstat to find a list of contain‐
207 ers to examine. If the word none is given for the config file,
208 then mdadm will act as though the config file were empty.
209
210
211 -s, --scan
212 Scan config file or /proc/mdstat for missing information. In
213 general, this option gives mdadm permission to get any missing
214 information (like component devices, array devices, array iden‐
215 tities, and alert destination) from the configuration file (see
216 previous option); one exception is MISC mode when using --detail
217 or --stop, in which case --scan says to get a list of array
218 devices from /proc/mdstat.
219
220
221 -e, --metadata=
222 Declare the style of RAID metadata (superblock) to be used. The
223 default is 1.2 for --create, and to guess for other operations.
224 The default can be overridden by setting the metadata value for
225 the CREATE keyword in mdadm.conf.
226
227 Options are:
228
229
230 0, 0.90
231 Use the original 0.90 format superblock. This format
232 limits arrays to 28 component devices and limits compo‐
233 nent devices of levels 1 and greater to 2 terabytes.
234
235
236 1, 1.0, 1.1, 1.2 default
237 Use the new version-1 format superblock. This has few
238 restrictions. The different sub-versions store the
239 superblock at different locations on the device, either
240 at the end (for 1.0), at the start (for 1.1) or 4K from
241 the start (for 1.2). "1" is equivalent to "1.0".
242 "default" is equivalent to "1.2".
243
244 ddf Use the "Industry Standard" DDF (Disk Data Format) format
245 defined by SNIA. When creating a DDF array a CONTAINER
246 will be created, and normal arrays can be created in that
247 container.
248
249 imsm Use the Intel(R) Matrix Storage Manager metadata format.
250 This creates a CONTAINER which is managed in a similar
251 manner to DDF, and is supported by an option-rom on some
252 platforms:
253
254 http://www.intel.com/design/chipsets/matrixstorage_sb.htm
255
256 --homehost=
257 This will override any HOMEHOST setting in the config file and
258 provides the identity of the host which should be considered the
259 home for any arrays.
260
261 When creating an array, the homehost will be recorded in the
262 metadata. For version-1 superblocks, it will be prefixed to the
263 array name. For version-0.90 superblocks, part of the SHA1 hash
264 of the hostname will be stored in the later half of the UUID.
265
266 When reporting information about an array, any array which is
267 tagged for the given homehost will be reported as such.
268
269 When using Auto-Assemble, only arrays tagged for the given home‐
270 host will be allowed to use 'local' names (i.e. not ending in
271 '_' followed by a digit string). See below under Auto Assembly.
272
273
275 -n, --raid-devices=
276 Specify the number of active devices in the array. This, plus
277 the number of spare devices (see below) must equal the number of
278 component-devices (including "missing" devices) that are listed
279 on the command line for --create. Setting a value of 1 is prob‐
280 ably a mistake and so requires that --force be specified first.
281 A value of 1 will then be allowed for linear, multipath, RAID0
282 and RAID1. It is never allowed for RAID4, RAID5 or RAID6.
283 This number can only be changed using --grow for RAID1, RAID4,
284 RAID5 and RAID6 arrays, and only on kernels which provide the
285 necessary support.
286
287
288 -x, --spare-devices=
289 Specify the number of spare (eXtra) devices in the initial
290 array. Spares can also be added and removed later. The number
291 of component devices listed on the command line must equal the
292 number of RAID devices plus the number of spare devices.
293
294
295 -z, --size=
296 Amount (in Kibibytes) of space to use from each drive in RAID
297 levels 1/4/5/6. This must be a multiple of the chunk size, and
298 must leave about 128Kb of space at the end of the drive for the
299 RAID superblock. If this is not specified (as it normally is
300 not) the smallest drive (or partition) sets the size, though if
301 there is a variance among the drives of greater than 1%, a warn‐
302 ing is issued.
303
304 This value can be set with --grow for RAID level 1/4/5/6. If
305 the array was created with a size smaller than the currently
306 active drives, the extra space can be accessed using --grow.
307 The size can be given as max which means to choose the largest
308 size that fits on all current drives.
309
310 This value can not be used with CONTAINER metadata such as DDF
311 and IMSM.
312
313
314 -Z, --array-size=
315 This is only meaningful with --grow and its effect is not per‐
316 sistent: when the array is stopped an restarted the default
317 array size will be restored.
318
319 Setting the array-size causes the array to appear smaller to
320 programs that access the data. This is particularly needed
321 before reshaping an array so that it will be smaller. As the
322 reshape is not reversible, but setting the size with --array-
323 size is, it is required that the array size is reduced as appro‐
324 priate before the number of devices in the array is reduced.
325
326
327 -c, --chunk=
328 Specify chunk size of kibibytes. The default when creating an
329 array is 512KB. To ensure compatibility with earlier versions,
330 the default when Building and array with no persistent metadata
331 is 64KB. This is only meaningful for RAID0, RAID4, RAID5,
332 RAID6, and RAID10.
333
334
335 --rounding=
336 Specify rounding factor for a Linear array. The size of each
337 component will be rounded down to a multiple of this size. This
338 is a synonym for --chunk but highlights the different meaning
339 for Linear as compared to other RAID levels. The default is 64K
340 if a kernel earlier than 2.6.16 is in use, and is 0K (i.e. no
341 rounding) in later kernels.
342
343
344 -l, --level=
345 Set RAID level. When used with --create, options are: linear,
346 raid0, 0, stripe, raid1, 1, mirror, raid4, 4, raid5, 5, raid6,
347 6, raid10, 10, multipath, mp, faulty, container. Obviously some
348 of these are synonymous.
349
350 When a CONTAINER metadata type is requested, only the container
351 level is permitted, and it does not need to be explicitly given.
352
353 When used with --build, only linear, stripe, raid0, 0, raid1,
354 multipath, mp, and faulty are valid.
355
356 Can be used with --grow to change the RAID level in some cases.
357 See LEVEL CHANGES below.
358
359
360 -p, --layout=
361 This option configures the fine details of data layout for
362 RAID5, RAID6, and RAID10 arrays, and controls the failure modes
363 for faulty.
364
365 The layout of the RAID5 parity block can be one of left-asymmet‐
366 ric, left-symmetric, right-asymmetric, right-symmetric, la, ra,
367 ls, rs. The default is left-symmetric.
368
369 It is also possibly to cause RAID5 to use a RAID4-like layout by
370 choosing parity-first, or parity-last.
371
372 Finally for RAID5 there are DDF-compatible layouts,
373 ddf-zero-restart, ddf-N-restart, and ddf-N-continue.
374
375 These same layouts are available for RAID6. There are also 4
376 layouts that will provide an intermediate stage for converting
377 between RAID5 and RAID6. These provide a layout which is iden‐
378 tical to the corresponding RAID5 layout on the first N-1
379 devices, and has the 'Q' syndrome (the second 'parity' block
380 used by RAID6) on the last device. These layouts are: left-sym‐
381 metric-6, right-symmetric-6, left-asymmetric-6, right-asymmet‐
382 ric-6, and parity-first-6.
383
384 When setting the failure mode for level faulty, the options are:
385 write-transient, wt, read-transient, rt, write-persistent, wp,
386 read-persistent, rp, write-all, read-fixable, rf, clear, flush,
387 none.
388
389 Each failure mode can be followed by a number, which is used as
390 a period between fault generation. Without a number, the fault
391 is generated once on the first relevant request. With a number,
392 the fault will be generated after that many requests, and will
393 continue to be generated every time the period elapses.
394
395 Multiple failure modes can be current simultaneously by using
396 the --grow option to set subsequent failure modes.
397
398 "clear" or "none" will remove any pending or periodic failure
399 modes, and "flush" will clear any persistent faults.
400
401 Finally, the layout options for RAID10 are one of 'n', 'o' or
402 'f' followed by a small number. The default is 'n2'. The sup‐
403 ported options are:
404
405 'n' signals 'near' copies. Multiple copies of one data block
406 are at similar offsets in different devices.
407
408 'o' signals 'offset' copies. Rather than the chunks being
409 duplicated within a stripe, whole stripes are duplicated but are
410 rotated by one device so duplicate blocks are on different
411 devices. Thus subsequent copies of a block are in the next
412 drive, and are one chunk further down.
413
414 'f' signals 'far' copies (multiple copies have very different
415 offsets). See md(4) for more detail about 'near', 'offset', and
416 'far'.
417
418 The number is the number of copies of each datablock. 2 is nor‐
419 mal, 3 can be useful. This number can be at most equal to the
420 number of devices in the array. It does not need to divide
421 evenly into that number (e.g. it is perfectly legal to have an
422 'n2' layout for an array with an odd number of devices).
423
424 When an array is converted between RAID5 and RAID6 an intermedi‐
425 ate RAID6 layout is used in which the second parity block (Q) is
426 always on the last device. To convert a RAID5 to RAID6 and
427 leave it in this new layout (which does not require re-striping)
428 use --layout=preserve. This will try to avoid any restriping.
429
430 The converse of this is --layout=normalise which will change a
431 non-standard RAID6 layout into a more standard arrangement.
432
433
434 --parity=
435 same as --layout (thus explaining the p of -p).
436
437
438 -b, --bitmap=
439 Specify a file to store a write-intent bitmap in. The file
440 should not exist unless --force is also given. The same file
441 should be provided when assembling the array. If the word
442 internal is given, then the bitmap is stored with the metadata
443 on the array, and so is replicated on all devices. If the word
444 none is given with --grow mode, then any bitmap that is present
445 is removed.
446
447 To help catch typing errors, the filename must contain at least
448 one slash ('/') if it is a real file (not 'internal' or 'none').
449
450 Note: external bitmaps are only known to work on ext2 and ext3.
451 Storing bitmap files on other filesystems may result in serious
452 problems.
453
454
455 --bitmap-chunk=
456 Set the chunksize of the bitmap. Each bit corresponds to that
457 many Kilobytes of storage. When using a file based bitmap, the
458 default is to use the smallest size that is at-least 4 and
459 requires no more than 2^21 chunks. When using an internal bit‐
460 map, the chunksize defaults to 64Meg, or larger if necessary to
461 fit the bitmap into the available space.
462
463
464 -W, --write-mostly
465 subsequent devices listed in a --build, --create, or --add com‐
466 mand will be flagged as 'write-mostly'. This is valid for RAID1
467 only and means that the 'md' driver will avoid reading from
468 these devices if at all possible. This can be useful if mirror‐
469 ing over a slow link.
470
471
472 --write-behind=
473 Specify that write-behind mode should be enabled (valid for
474 RAID1 only). If an argument is specified, it will set the maxi‐
475 mum number of outstanding writes allowed. The default value is
476 256. A write-intent bitmap is required in order to use write-
477 behind mode, and write-behind is only attempted on drives marked
478 as write-mostly.
479
480
481 --assume-clean
482 Tell mdadm that the array pre-existed and is known to be clean.
483 It can be useful when trying to recover from a major failure as
484 you can be sure that no data will be affected unless you actu‐
485 ally write to the array. It can also be used when creating a
486 RAID1 or RAID10 if you want to avoid the initial resync, however
487 this practice — while normally safe — is not recommended. Use
488 this only if you really know what you are doing.
489
490 When the devices that will be part of a new array were filled
491 with zeros before creation the operator knows the array is actu‐
492 ally clean. If that is the case, such as after running bad‐
493 blocks, this argument can be used to tell mdadm the facts the
494 operator knows.
495
496
497 --backup-file=
498 This is needed when --grow is used to increase the number of
499 raid-devices in a RAID5 if there are no spare devices available.
500 See the GROW MODE section below on RAID-DEVICES CHANGES. The
501 file should be stored on a separate device, not on the RAID
502 array being reshaped.
503
504
505 --array-size=, -Z
506 Set the size of the array which is seen by users of the device
507 such as filesystems. This can be less that the real size, but
508 never greater. The size set this way does not persist across
509 restarts of the array.
510
511 This is most useful when reducing the number of devices in a
512 RAID5 or RAID6. Such arrays require the array-size to be
513 reduced before a reshape can be performed that reduces the real
514 size.
515
516 A value of max restores the apparent size of the array to be
517 whatever the real amount of available space is.
518
519
520 -N, --name=
521 Set a name for the array. This is currently only effective when
522 creating an array with a version-1 superblock, or an array in a
523 DDF container. The name is a simple textual string that can be
524 used to identify array components when assembling. If name is
525 needed but not specified, it is taken from the basename of the
526 device that is being created. e.g. when creating /dev/md/home
527 the name will default to home.
528
529
530 -R, --run
531 Insist that mdadm run the array, even if some of the components
532 appear to be active in another array or filesystem. Normally
533 mdadm will ask for confirmation before including such components
534 in an array. This option causes that question to be suppressed.
535
536
537 -f, --force
538 Insist that mdadm accept the geometry and layout specified with‐
539 out question. Normally mdadm will not allow creation of an
540 array with only one device, and will try to create a RAID5 array
541 with one missing drive (as this makes the initial resync work
542 faster). With --force, mdadm will not try to be so clever.
543
544
545 -a, --auto{=yes,md,mdp,part,p}{NN}
546 Instruct mdadm how to create the device file if needed, possibly
547 allocating an unused minor number. "md" causes a non-partition‐
548 able array to be used (though since Linux 2.6.28, these array
549 devices are in fact partitionable). "mdp", "part" or "p" causes
550 a partitionable array (2.6 and later) to be used. "yes"
551 requires the named md device to have a 'standard' format, and
552 the type and minor number will be determined from this. With
553 mdadm 3.0, device creation is normally left up to udev so this
554 option is unlikely to be needed. See DEVICE NAMES below.
555
556 The argument can also come immediately after "-a". e.g. "-ap".
557
558 If --auto is not given on the command line or in the config
559 file, then the default will be --auto=yes.
560
561 If --scan is also given, then any auto= entries in the config
562 file will override the --auto instruction given on the command
563 line.
564
565 For partitionable arrays, mdadm will create the device file for
566 the whole array and for the first 4 partitions. A different
567 number of partitions can be specified at the end of this option
568 (e.g. --auto=p7). If the device name ends with a digit, the
569 partition names add a 'p', and a number, e.g. /dev/md/home1p3.
570 If there is no trailing digit, then the partition names just
571 have a number added, e.g. /dev/md/scratch3.
572
573 If the md device name is in a 'standard' format as described in
574 DEVICE NAMES, then it will be created, if necessary, with the
575 appropriate device number based on that name. If the device
576 name is not in one of these formats, then a unused device number
577 will be allocated. The device number will be considered unused
578 if there is no active array for that number, and there is no
579 entry in /dev for that number and with a non-standard name.
580 Names that are not in 'standard' format are only allowed in
581 "/dev/md/".
582
583
584
586 -u, --uuid=
587 uuid of array to assemble. Devices which don't have this uuid
588 are excluded
589
590
591 -m, --super-minor=
592 Minor number of device that array was created for. Devices
593 which don't have this minor number are excluded. If you create
594 an array as /dev/md1, then all superblocks will contain the
595 minor number 1, even if the array is later assembled as
596 /dev/md2.
597
598 Giving the literal word "dev" for --super-minor will cause mdadm
599 to use the minor number of the md device that is being assem‐
600 bled. e.g. when assembling /dev/md0, --super-minor=dev will
601 look for super blocks with a minor number of 0.
602
603 --super-minor is only relevant for v0.90 metadata, and should
604 not normally be used. Using --uuid is much safer.
605
606
607 -N, --name=
608 Specify the name of the array to assemble. This must be the
609 name that was specified when creating the array. It must either
610 match the name stored in the superblock exactly, or it must
611 match with the current homehost prefixed to the start of the
612 given name.
613
614
615 -f, --force
616 Assemble the array even if the metadata on some devices appears
617 to be out-of-date. If mdadm cannot find enough working devices
618 to start the array, but can find some devices that are recorded
619 as having failed, then it will mark those devices as working so
620 that the array can be started. An array which requires --force
621 to be started may contain data corruption. Use it carefully.
622
623
624 -R, --run
625 Attempt to start the array even if fewer drives were given than
626 were present last time the array was active. Normally if not
627 all the expected drives are found and --scan is not used, then
628 the array will be assembled but not started. With --run an
629 attempt will be made to start it anyway.
630
631
632 --no-degraded
633 This is the reverse of --run in that it inhibits the startup of
634 array unless all expected drives are present. This is only
635 needed with --scan, and can be used if the physical connections
636 to devices are not as reliable as you would like.
637
638
639 -a, --auto{=no,yes,md,mdp,part}
640 See this option under Create and Build options.
641
642
643 -b, --bitmap=
644 Specify the bitmap file that was given when the array was cre‐
645 ated. If an array has an internal bitmap, there is no need to
646 specify this when assembling the array.
647
648
649 --backup-file=
650 If --backup-file was used to grow the number of raid-devices in
651 a RAID5, and the system crashed during the critical section,
652 then the same --backup-file must be presented to --assemble to
653 allow possibly corrupted data to be restored.
654
655
656 -U, --update=
657 Update the superblock on each device while assembling the array.
658 The argument given to this flag can be one of sparc2.2, sum‐
659 maries, uuid, name, homehost, resync, byteorder, devicesize, or
660 super-minor.
661
662 The sparc2.2 option will adjust the superblock of an array what
663 was created on a Sparc machine running a patched 2.2 Linux ker‐
664 nel. This kernel got the alignment of part of the superblock
665 wrong. You can use the --examine --sparc2.2 option to mdadm to
666 see what effect this would have.
667
668 The super-minor option will update the preferred minor field on
669 each superblock to match the minor number of the array being
670 assembled. This can be useful if --examine reports a different
671 "Preferred Minor" to --detail. In some cases this update will
672 be performed automatically by the kernel driver. In particular
673 the update happens automatically at the first write to an array
674 with redundancy (RAID level 1 or greater) on a 2.6 (or later)
675 kernel.
676
677 The uuid option will change the uuid of the array. If a UUID is
678 given with the --uuid option that UUID will be used as a new
679 UUID and will NOT be used to help identify the devices in the
680 array. If no --uuid is given, a random UUID is chosen.
681
682 The name option will change the name of the array as stored in
683 the superblock. This is only supported for version-1
684 superblocks.
685
686 The homehost option will change the homehost as recorded in the
687 superblock. For version-0 superblocks, this is the same as
688 updating the UUID. For version-1 superblocks, this involves
689 updating the name.
690
691 The resync option will cause the array to be marked dirty mean‐
692 ing that any redundancy in the array (e.g. parity for RAID5,
693 copies for RAID1) may be incorrect. This will cause the RAID
694 system to perform a "resync" pass to make sure that all redun‐
695 dant information is correct.
696
697 The byteorder option allows arrays to be moved between machines
698 with different byte-order. When assembling such an array for
699 the first time after a move, giving --update=byteorder will
700 cause mdadm to expect superblocks to have their byteorder
701 reversed, and will correct that order before assembling the
702 array. This is only valid with original (Version 0.90)
703 superblocks.
704
705 The summaries option will correct the summaries in the
706 superblock. That is the counts of total, working, active,
707 failed, and spare devices.
708
709 The devicesize will rarely be of use. It applies to version 1.1
710 and 1.2 metadata only (where the metadata is at the start of the
711 device) and is only useful when the component device has changed
712 size (typically become larger). The version 1 metadata records
713 the amount of the device that can be used to store data, so if a
714 device in a version 1.1 or 1.2 array becomes larger, the meta‐
715 data will still be visible, but the extra space will not. In
716 this case it might be useful to assemble the array with
717 --update=devicesize. This will cause mdadm to determine the
718 maximum usable amount of space on each device and update the
719 relevant field in the metadata.
720
721
722
724 -t, --test
725 Unless a more serious error occurred, mdadm will exit with a
726 status of 2 if no changes were made to the array and 0 if at
727 least one change was made. This can be useful when an indirect
728 specifier such as missing, detached or faulty is used in
729 requesting an operation on the array. --test will report fail‐
730 ure if these specifiers didn't find any match.
731
732
733 -a, --add
734 hot-add listed devices. If a device appears to have recently
735 been part of the array (possibly it failed or was removed) the
736 device is re-added as describe in the next point. If that fails
737 or the device was never part of the array, the device is added
738 as a hot-spare. If the array is degraded, it will immediately
739 start to rebuild data onto that spare.
740
741 Note that this and the following options are only meaningful on
742 array with redundancy. They don't apply to RAID0 or Linear.
743
744
745 --re-add
746 re-add a device that was previous removed from an array. If the
747 metadata on the device reports that it is a member of the array,
748 and the slot that it used is still vacant, then the device will
749 be added back to the array in the same position. This will nor‐
750 mally cause the data for that device to be recovered. However
751 based on the event count on the device, the recovery may only
752 require sections that are flagged a write-intent bitmap to be
753 recovered or may not require any recovery at all.
754
755 When used on an array that has no metadata (i.e. it was built
756 with --build) it will be assumed that bitmap-based recovery is
757 enough to make the device fully consistent with the array.
758
759 If the device name given is missing then mdadm will try to find
760 any device that looks like it should be part of the array but
761 isn't and will try to re-add all such devices.
762
763
764 -r, --remove
765 remove listed devices. They must not be active. i.e. they
766 should be failed or spare devices. As well as the name of a
767 device file (e.g. /dev/sda1) the words failed and detached can
768 be given to --remove. The first causes all failed device to be
769 removed. The second causes any device which is no longer con‐
770 nected to the system (i.e an 'open' returns ENXIO) to be
771 removed. This will only succeed for devices that are spares or
772 have already been marked as failed.
773
774
775 -f, --fail
776 mark listed devices as faulty. As well as the name of a device
777 file, the word detached can be given. This will cause any
778 device that has been detached from the system to be marked as
779 failed. It can then be removed.
780
781
782 --set-faulty
783 same as --fail.
784
785
786 --write-mostly
787 Subsequent devices that are added or re-added will have the
788 'write-mostly' flag set. This is only valid for RAID1 and means
789 that the 'md' driver will avoid reading from these devices if
790 possible.
791
792 --readwrite
793 Subsequent devices that are added or re-added will have the
794 'write-mostly' flag cleared.
795
796
797 Each of these options requires that the first device listed is the
798 array to be acted upon, and the remainder are component devices to be
799 added, removed, marked as faulty, etc. Several different operations
800 can be specified for different devices, e.g.
801 mdadm /dev/md0 --add /dev/sda1 --fail /dev/sdb1 --remove /dev/sdb1
802 Each operation applies to all devices listed until the next operation.
803
804 If an array is using a write-intent bitmap, then devices which have
805 been removed can be re-added in a way that avoids a full reconstruction
806 but instead just updates the blocks that have changed since the device
807 was removed. For arrays with persistent metadata (superblocks) this is
808 done automatically. For arrays created with --build mdadm needs to be
809 told that this device we removed recently with --re-add.
810
811 Devices can only be removed from an array if they are not in active
812 use, i.e. that must be spares or failed devices. To remove an active
813 device, it must first be marked as faulty.
814
815
817 -Q, --query
818 Examine a device to see (1) if it is an md device and (2) if it
819 is a component of an md array. Information about what is dis‐
820 covered is presented.
821
822
823 -D, --detail
824 Print details of one or more md devices.
825
826
827 --detail-platform
828 Print details of the platform's RAID capabilities (firmware /
829 hardware topology) for a given metadata format.
830
831
832 -Y, --export
833 When used with --detail or --examine, output will be formatted
834 as key=value pairs for easy import into the environment.
835
836
837 -E, --examine
838 Print contents of the metadata stored on the named device(s).
839 Note the contrast between --examine and --detail. --examine
840 applies to devices which are components of an array, while
841 --detail applies to a whole array which is currently active.
842
843 --sparc2.2
844 If an array was created on a SPARC machine with a 2.2 Linux ker‐
845 nel patched with RAID support, the superblock will have been
846 created incorrectly, or at least incompatibly with 2.4 and later
847 kernels. Using the --sparc2.2 flag with --examine will fix the
848 superblock before displaying it. If this appears to do the
849 right thing, then the array can be successfully assembled using
850 --assemble --update=sparc2.2.
851
852
853 -X, --examine-bitmap
854 Report information about a bitmap file. The argument is either
855 an external bitmap file or an array component in case of an
856 internal bitmap. Note that running this on an array device
857 (e.g. /dev/md0) does not report the bitmap for that array.
858
859
860 -R, --run
861 start a partially assembled array. If --assemble did not find
862 enough devices to fully start the array, it might leaving it
863 partially assembled. If you wish, you can then use --run to
864 start the array in degraded mode.
865
866
867 -S, --stop
868 deactivate array, releasing all resources.
869
870
871 -o, --readonly
872 mark array as readonly.
873
874
875 -w, --readwrite
876 mark array as readwrite.
877
878
879 --zero-superblock
880 If the device contains a valid md superblock, the block is over‐
881 written with zeros. With --force the block where the superblock
882 would be is overwritten even if it doesn't appear to be valid.
883
884
885 --kill-subarray=
886 If the device is a container and the argument to --kill-subarray
887 specifies an inactive subarray in the container, then the subar‐
888 ray is deleted. Deleting all subarrays will leave an 'empty-
889 container' or spare superblock on the drives. See
890 --zero-superblock for completely removing a superblock. Note
891 that some formats depend on the subarray index for generating a
892 UUID, this command will fail if it would change the UUID of an
893 active subarray.
894
895
896 --update-subarray=
897 If the device is a container and the argument to --update-subar‐
898 ray specifies a subarray in the container, then attempt to
899 update the given superblock field in the subarray. See below in
900 MISC MODE for details.
901
902
903 -t, --test
904 When used with --detail, the exit status of mdadm is set to
905 reflect the status of the device. See below in MISC MODE for
906 details.
907
908
909 -W, --wait
910 For each md device given, wait for any resync, recovery, or
911 reshape activity to finish before returning. mdadm will return
912 with success if it actually waited for every device listed, oth‐
913 erwise it will return failure.
914
915
916 --wait-clean
917 For each md device given, or each device in /proc/mdstat if
918 --scan is given, arrange for the array to be marked clean as
919 soon as possible. mdadm will return with success if the array
920 uses external metadata and we successfully waited. For native
921 arrays this returns immediately as the kernel handles dirty-
922 clean transitions at shutdown. No action is taken if safe-mode
923 handling is disabled.
924
925
927 --rebuild-map, -r
928 Rebuild the map file (/var/run/mdadm/map) that mdadm uses to
929 help track which arrays are currently being assembled.
930
931
932 --run, -R
933 Run any array assembled as soon as a minimal number of devices
934 are available, rather than waiting until all expected devices
935 are present.
936
937
938 --scan, -s
939 Only meaningful with -R this will scan the map file for arrays
940 that are being incrementally assembled and will try to start any
941 that are not already started. If any such array is listed in
942 mdadm.conf as requiring an external bitmap, that bitmap will be
943 attached first.
944
945
946 --fail, -f
947 This allows the hot-plug system to remove devices that have
948 fully disappeared from the kernel. It will first fail and then
949 remove the device from any array it belongs to. The device name
950 given should be a kernel device name such as "sda", not a name
951 in /dev.
952
953
955 -m, --mail
956 Give a mail address to send alerts to.
957
958
959 -p, --program, --alert
960 Give a program to be run whenever an event is detected.
961
962
963 -y, --syslog
964 Cause all events to be reported through 'syslog'. The messages
965 have facility of 'daemon' and varying priorities.
966
967
968 -d, --delay
969 Give a delay in seconds. mdadm polls the md arrays and then
970 waits this many seconds before polling again. The default is 60
971 seconds. Since 2.6.16, there is no need to reduce this as the
972 kernel alerts mdadm immediately when there is any change.
973
974
975 -r, --increment
976 Give a percentage increment. mdadm will generate RebuildNN
977 events with the given percentage increment.
978
979
980 -f, --daemonise
981 Tell mdadm to run as a background daemon if it decides to moni‐
982 tor anything. This causes it to fork and run in the child, and
983 to disconnect from the terminal. The process id of the child is
984 written to stdout. This is useful with --scan which will only
985 continue monitoring if a mail address or alert program is found
986 in the config file.
987
988
989 -i, --pid-file
990 When mdadm is running in daemon mode, write the pid of the dae‐
991 mon process to the specified file, instead of printing it on
992 standard output.
993
994
995 -1, --oneshot
996 Check arrays only once. This will generate NewArray events and
997 more significantly DegradedArray and SparesMissing events. Run‐
998 ning
999 mdadm --monitor --scan -1
1000 from a cron script will ensure regular notification of any
1001 degraded arrays.
1002
1003
1004 -t, --test
1005 Generate a TestMessage alert for every array found at startup.
1006 This alert gets mailed and passed to the alert program. This
1007 can be used for testing that alert message do get through suc‐
1008 cessfully.
1009
1010
1012 Usage: mdadm --assemble md-device options-and-component-devices...
1013
1014 Usage: mdadm --assemble --scan md-devices-and-options...
1015
1016 Usage: mdadm --assemble --scan options...
1017
1018
1019 This usage assembles one or more RAID arrays from pre-existing compo‐
1020 nents. For each array, mdadm needs to know the md device, the identity
1021 of the array, and a number of component-devices. These can be found in
1022 a number of ways.
1023
1024 In the first usage example (without the --scan) the first device given
1025 is the md device. In the second usage example, all devices listed are
1026 treated as md devices and assembly is attempted. In the third (where
1027 no devices are listed) all md devices that are listed in the configura‐
1028 tion file are assembled. If not arrays are described by the configura‐
1029 tion file, then any arrays that can be found on unused devices will be
1030 assembled.
1031
1032 If precisely one device is listed, but --scan is not given, then mdadm
1033 acts as though --scan was given and identity information is extracted
1034 from the configuration file.
1035
1036 The identity can be given with the --uuid option, the --name option, or
1037 the --super-minor option, will be taken from the md-device record in
1038 the config file, or will be taken from the super block of the first
1039 component-device listed on the command line.
1040
1041 Devices can be given on the --assemble command line or in the config
1042 file. Only devices which have an md superblock which contains the
1043 right identity will be considered for any array.
1044
1045 The config file is only used if explicitly named with --config or
1046 requested with (a possibly implicit) --scan. In the later case,
1047 /etc/mdadm.conf or /etc/mdadm/mdadm.conf is used.
1048
1049 If --scan is not given, then the config file will only be used to find
1050 the identity of md arrays.
1051
1052 Normally the array will be started after it is assembled. However if
1053 --scan is not given and not all expected drives were listed, then the
1054 array is not started (to guard against usage errors). To insist that
1055 the array be started in this case (as may work for RAID1, 4, 5, 6, or
1056 10), give the --run flag.
1057
1058 If udev is active, mdadm does not create any entries in /dev but leaves
1059 that to udev. It does record information in /var/run/mdadm/map which
1060 will allow udev to choose the correct name.
1061
1062 If mdadm detects that udev is not configured, it will create the
1063 devices in /dev itself.
1064
1065 In Linux kernels prior to version 2.6.28 there were two distinctly dif‐
1066 ferent types of md devices that could be created: one that could be
1067 partitioned using standard partitioning tools and one that could not.
1068 Since 2.6.28 that distinction is no longer relevant as both type of
1069 devices can be partitioned. mdadm will normally create the type that
1070 originally could not be partitioned as it has a well defined major num‐
1071 ber (9).
1072
1073 Prior to 2.6.28, it is important that mdadm chooses the correct type of
1074 array device to use. This can be controlled with the --auto option.
1075 In particular, a value of "mdp" or "part" or "p" tells mdadm to use a
1076 partitionable device rather than the default.
1077
1078 In the no-udev case, the value given to --auto can be suffixed by a
1079 number. This tells mdadm to create that number of partition devices
1080 rather than the default of 4.
1081
1082 The value given to --auto can also be given in the configuration file
1083 as a word starting auto= on the ARRAY line for the relevant array.
1084
1085
1086 Auto Assembly
1087 When --assemble is used with --scan and no devices are listed, mdadm
1088 will first attempt to assemble all the arrays listed in the config
1089 file.
1090
1091 In no array at listed in the config (other than those marked <ignore>)
1092 it will look through the available devices for possible arrays and will
1093 try to assemble anything that it finds. Arrays which are tagged as
1094 belonging to the given homehost will be assembled and started normally.
1095 Arrays which do not obviously belong to this host are given names that
1096 are expected not to conflict with anything local, and are started
1097 "read-auto" so that nothing is written to any device until the array is
1098 written to. i.e. automatic resync etc is delayed.
1099
1100 If mdadm finds a consistent set of devices that look like they should
1101 comprise an array, and if the superblock is tagged as belonging to the
1102 given home host, it will automatically choose a device name and try to
1103 assemble the array. If the array uses version-0.90 metadata, then the
1104 minor number as recorded in the superblock is used to create a name in
1105 /dev/md/ so for example /dev/md/3. If the array uses version-1 meta‐
1106 data, then the name from the superblock is used to similarly create a
1107 name in /dev/md/ (the name will have any 'host' prefix stripped first).
1108
1109 This behaviour can be modified by the AUTO line in the mdadm.conf con‐
1110 figuration file. This line can indicate that specific metadata type
1111 should, or should not, be automatically assembled. If an array is
1112 found which is not listed in mdadm.conf and has a metadata format that
1113 is denied by the AUTO line, then it will not be assembled. The AUTO
1114 line can also request that all arrays identified as being for this
1115 homehost should be assembled regardless of their metadata type. See
1116 mdadm.conf(5) for further details.
1117
1118
1119
1121 Usage: mdadm --build md-device --chunk=X --level=Y --raid-devices=Z
1122 devices
1123
1124
1125 This usage is similar to --create. The difference is that it creates
1126 an array without a superblock. With these arrays there is no differ‐
1127 ence between initially creating the array and subsequently assembling
1128 the array, except that hopefully there is useful data there in the sec‐
1129 ond case.
1130
1131 The level may raid0, linear, raid1, raid10, multipath, or faulty, or
1132 one of their synonyms. All devices must be listed and the array will
1133 be started once complete. It will often be appropriate to use
1134 --assume-clean with levels raid1 or raid10.
1135
1136
1138 Usage: mdadm --create md-device --chunk=X --level=Y
1139 --raid-devices=Z devices
1140
1141
1142 This usage will initialise a new md array, associate some devices with
1143 it, and activate the array.
1144
1145 The named device will normally not exist when mdadm --create is run,
1146 but will be created by udev once the array becomes active.
1147
1148 As devices are added, they are checked to see if they contain RAID
1149 superblocks or filesystems. They are also checked to see if the vari‐
1150 ance in device size exceeds 1%.
1151
1152 If any discrepancy is found, the array will not automatically be run,
1153 though the presence of a --run can override this caution.
1154
1155 To create a "degraded" array in which some devices are missing, simply
1156 give the word "missing" in place of a device name. This will cause
1157 mdadm to leave the corresponding slot in the array empty. For a RAID4
1158 or RAID5 array at most one slot can be "missing"; for a RAID6 array at
1159 most two slots. For a RAID1 array, only one real device needs to be
1160 given. All of the others can be "missing".
1161
1162 When creating a RAID5 array, mdadm will automatically create a degraded
1163 array with an extra spare drive. This is because building the spare
1164 into a degraded array is in general faster than resyncing the parity on
1165 a non-degraded, but not clean, array. This feature can be overridden
1166 with the --force option.
1167
1168 When creating an array with version-1 metadata a name for the array is
1169 required. If this is not given with the --name option, mdadm will
1170 choose a name based on the last component of the name of the device
1171 being created. So if /dev/md3 is being created, then the name 3 will
1172 be chosen. If /dev/md/home is being created, then the name home will
1173 be used.
1174
1175 When creating a partition based array, using mdadm with version-1.x
1176 metadata, the partition type should be set to 0xDA (non fs-data). This
1177 type selection allows for greater precision since using any other [RAID
1178 auto-detect (0xFD) or a GNU/Linux partition (0x83)], might create prob‐
1179 lems in the event of array recovery through a live cdrom.
1180
1181 A new array will normally get a randomly assigned 128bit UUID which is
1182 very likely to be unique. If you have a specific need, you can choose
1183 a UUID for the array by giving the --uuid= option. Be warned that cre‐
1184 ating two arrays with the same UUID is a recipe for disaster. Also,
1185 using --uuid= when creating a v0.90 array will silently override any
1186 --homehost= setting.
1187
1188 When creating an array within a CONTAINER mdadm can be given either the
1189 list of devices to use, or simply the name of the container. The for‐
1190 mer case gives control over which devices in the container will be used
1191 for the array. The latter case allows mdadm to automatically choose
1192 which devices to use based on how much spare space is available.
1193
1194 The General Management options that are valid with --create are:
1195
1196 --run insist on running the array even if some devices look like they
1197 might be in use.
1198
1199
1200 --readonly
1201 start the array readonly — not supported yet.
1202
1203
1205 Usage: mdadm device options... devices...
1206
1207 This usage will allow individual devices in an array to be failed,
1208 removed or added. It is possible to perform multiple operations with
1209 on command. For example:
1210 mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 -a /dev/hda1
1211 will firstly mark /dev/hda1 as faulty in /dev/md0 and will then remove
1212 it from the array and finally add it back in as a spare. However only
1213 one md array can be affected by a single command.
1214
1215 When a device is added to an active array, mdadm checks to see if it
1216 has metadata on it which suggests that it was recently a member of the
1217 array. If it does, it tries to "re-add" the device. If there have
1218 been no changes since the device was removed, or if the array has a
1219 write-intent bitmap which has recorded whatever changes there were,
1220 then the device will immediately become a full member of the array and
1221 those differences recorded in the bitmap will be resolved.
1222
1223
1225 Usage: mdadm options ... devices ...
1226
1227 MISC mode includes a number of distinct operations that operate on dis‐
1228 tinct devices. The operations are:
1229
1230 --query
1231 The device is examined to see if it is (1) an active md array,
1232 or (2) a component of an md array. The information discovered
1233 is reported.
1234
1235
1236 --detail
1237 The device should be an active md device. mdadm will display a
1238 detailed description of the array. --brief or --scan will cause
1239 the output to be less detailed and the format to be suitable for
1240 inclusion in /etc/mdadm.conf. The exit status of mdadm will
1241 normally be 0 unless mdadm failed to get useful information
1242 about the device(s); however, if the --test option is given,
1243 then the exit status will be:
1244
1245 0 The array is functioning normally.
1246
1247 1 The array has at least one failed device.
1248
1249 2 The array has multiple failed devices such that it is
1250 unusable.
1251
1252 4 There was an error while trying to get information about
1253 the device.
1254
1255
1256 --detail-platform
1257 Print detail of the platform's RAID capabilities (firmware /
1258 hardware topology). If the metadata is specified with -e or
1259 --metadata= then the return status will be:
1260
1261 0 metadata successfully enumerated its platform components
1262 on this system
1263
1264 1 metadata is platform independent
1265
1266 2 metadata failed to find its platform components on this
1267 system
1268
1269
1270 --update-subarray=
1271 If the device is a container and the argument to --update-subar‐
1272 ray specifies a subarray in the container, then attempt to
1273 update the given superblock field in the subarray. Similar to
1274 updating an array in "assemble" mode, the field to update is
1275 selected by -U or --update= option. Currently only name is sup‐
1276 ported.
1277
1278 The name option updates the subarray name in the metadata, it
1279 may not affect the device node name or the device node symlink
1280 until the subarray is re-assembled. If updating name would
1281 change the UUID of an active subarray this operation is blocked,
1282 and the command will end in an error.
1283
1284
1285 --examine
1286 The device should be a component of an md array. mdadm will
1287 read the md superblock of the device and display the contents.
1288 If --brief or --scan is given, then multiple devices that are
1289 components of the one array are grouped together and reported in
1290 a single entry suitable for inclusion in /etc/mdadm.conf.
1291
1292 Having --scan without listing any devices will cause all devices
1293 listed in the config file to be examined.
1294
1295
1296 --stop The devices should be active md arrays which will be deacti‐
1297 vated, as long as they are not currently in use.
1298
1299
1300 --run This will fully activate a partially assembled md array.
1301
1302
1303 --readonly
1304 This will mark an active array as read-only, providing that it
1305 is not currently being used.
1306
1307
1308 --readwrite
1309 This will change a readonly array back to being read/write.
1310
1311
1312 --scan For all operations except --examine, --scan will cause the oper‐
1313 ation to be applied to all arrays listed in /proc/mdstat. For
1314 --examine, --scan causes all devices listed in the config file
1315 to be examined.
1316
1317
1318 -b, --brief
1319 Be less verbose. This is used with --detail and --examine.
1320 Using --brief with --verbose gives an intermediate level of ver‐
1321 bosity.
1322
1323
1325 Usage: mdadm --monitor options... devices...
1326
1327
1328 This usage causes mdadm to periodically poll a number of md arrays and
1329 to report on any events noticed. mdadm will never exit once it decides
1330 that there are arrays to be checked, so it should normally be run in
1331 the background.
1332
1333 As well as reporting events, mdadm may move a spare drive from one
1334 array to another if they are in the same spare-group and if the desti‐
1335 nation array has a failed drive but no spares.
1336
1337 If any devices are listed on the command line, mdadm will only monitor
1338 those devices. Otherwise all arrays listed in the configuration file
1339 will be monitored. Further, if --scan is given, then any other md
1340 devices that appear in /proc/mdstat will also be monitored.
1341
1342 The result of monitoring the arrays is the generation of events. These
1343 events are passed to a separate program (if specified) and may be
1344 mailed to a given E-mail address.
1345
1346 When passing events to a program, the program is run once for each
1347 event, and is given 2 or 3 command-line arguments: the first is the
1348 name of the event (see below), the second is the name of the md device
1349 which is affected, and the third is the name of a related device if
1350 relevant (such as a component device that has failed).
1351
1352 If --scan is given, then a program or an E-mail address must be speci‐
1353 fied on the command line or in the config file. If neither are avail‐
1354 able, then mdadm will not monitor anything. Without --scan, mdadm will
1355 continue monitoring as long as something was found to monitor. If no
1356 program or email is given, then each event is reported to stdout.
1357
1358 The different events are:
1359
1360
1361 DeviceDisappeared
1362 An md array which previously was configured appears to no
1363 longer be configured. (syslog priority: Critical)
1364
1365 If mdadm was told to monitor an array which is RAID0 or Lin‐
1366 ear, then it will report DeviceDisappeared with the extra
1367 information Wrong-Level. This is because RAID0 and Linear
1368 do not support the device-failed, hot-spare and resync oper‐
1369 ations which are monitored.
1370
1371
1372 RebuildStarted
1373 An md array started reconstruction. (syslog priority: Warn‐
1374 ing)
1375
1376
1377 RebuildNN
1378 Where NN is a two-digit number (ie. 05, 48). This indicates
1379 that rebuild has passed that many percent of the total. The
1380 events are generated with fixed increment since 0. Increment
1381 size may be specified with a commandline option (default is
1382 20). (syslog priority: Warning)
1383
1384
1385 RebuildFinished
1386 An md array that was rebuilding, isn't any more, either
1387 because it finished normally or was aborted. (syslog prior‐
1388 ity: Warning)
1389
1390
1391 Fail An active component device of an array has been marked as
1392 faulty. (syslog priority: Critical)
1393
1394
1395 FailSpare
1396 A spare component device which was being rebuilt to replace
1397 a faulty device has failed. (syslog priority: Critical)
1398
1399
1400 SpareActive
1401 A spare component device which was being rebuilt to replace
1402 a faulty device has been successfully rebuilt and has been
1403 made active. (syslog priority: Info)
1404
1405
1406 NewArray
1407 A new md array has been detected in the /proc/mdstat file.
1408 (syslog priority: Info)
1409
1410
1411 DegradedArray
1412 A newly noticed array appears to be degraded. This message
1413 is not generated when mdadm notices a drive failure which
1414 causes degradation, but only when mdadm notices that an
1415 array is degraded when it first sees the array. (syslog
1416 priority: Critical)
1417
1418
1419 MoveSpare
1420 A spare drive has been moved from one array in a spare-group
1421 to another to allow a failed drive to be replaced. (syslog
1422 priority: Info)
1423
1424
1425 SparesMissing
1426 If mdadm has been told, via the config file, that an array
1427 should have a certain number of spare devices, and mdadm
1428 detects that it has fewer than this number when it first
1429 sees the array, it will report a SparesMissing message.
1430 (syslog priority: Warning)
1431
1432
1433 TestMessage
1434 An array was found at startup, and the --test flag was
1435 given. (syslog priority: Info)
1436
1437 Only Fail, FailSpare, DegradedArray, SparesMissing and TestMessage
1438 cause Email to be sent. All events cause the program to be run. The
1439 program is run with two or three arguments: the event name, the array
1440 device and possibly a second device.
1441
1442 Each event has an associated array device (e.g. /dev/md1) and possibly
1443 a second device. For Fail, FailSpare, and SpareActive the second
1444 device is the relevant component device. For MoveSpare the second
1445 device is the array that the spare was moved from.
1446
1447 For mdadm to move spares from one array to another, the different
1448 arrays need to be labeled with the same spare-group in the configura‐
1449 tion file. The spare-group name can be any string; it is only neces‐
1450 sary that different spare groups use different names.
1451
1452 When mdadm detects that an array in a spare group has fewer active
1453 devices than necessary for the complete array, and has no spare
1454 devices, it will look for another array in the same spare group that
1455 has a full complement of working drive and a spare. It will then
1456 attempt to remove the spare from the second drive and add it to the
1457 first. If the removal succeeds but the adding fails, then it is added
1458 back to the original array.
1459
1460
1462 The GROW mode is used for changing the size or shape of an active
1463 array. For this to work, the kernel must support the necessary change.
1464 Various types of growth are being added during 2.6 development, includ‐
1465 ing restructuring a RAID5 array to have more active devices.
1466
1467 Currently the only support available is to
1468
1469 · change the "size" attribute for RAID1, RAID5 and RAID6.
1470
1471 · increase or decrease the "raid-devices" attribute of RAID1, RAID5,
1472 and RAID6.
1473
1474 change the chunk-size and layout of RAID5 and RAID6.
1475
1476 convert between RAID1 and RAID5, and between RAID5 and RAID6.
1477
1478 · add a write-intent bitmap to any array which supports these bit‐
1479 maps, or remove a write-intent bitmap from such an array.
1480
1481 GROW mode is not currently supported for CONTAINERS or arrays inside
1482 containers.
1483
1484
1485 SIZE CHANGES
1486 Normally when an array is built the "size" it taken from the smallest
1487 of the drives. If all the small drives in an arrays are, one at a
1488 time, removed and replaced with larger drives, then you could have an
1489 array of large drives with only a small amount used. In this situa‐
1490 tion, changing the "size" with "GROW" mode will allow the extra space
1491 to start being used. If the size is increased in this way, a "resync"
1492 process will start to make sure the new parts of the array are synchro‐
1493 nised.
1494
1495 Note that when an array changes size, any filesystem that may be stored
1496 in the array will not automatically grow to use the space. The
1497 filesystem will need to be explicitly told to use the extra space.
1498
1499 Also the size of an array cannot be changed while it has an active bit‐
1500 map. If an array has a bitmap, it must be removed before the size can
1501 be changed. Once the change it complete a new bitmap can be created.
1502
1503
1504 RAID-DEVICES CHANGES
1505 A RAID1 array can work with any number of devices from 1 upwards
1506 (though 1 is not very useful). There may be times which you want to
1507 increase or decrease the number of active devices. Note that this is
1508 different to hot-add or hot-remove which changes the number of inactive
1509 devices.
1510
1511 When reducing the number of devices in a RAID1 array, the slots which
1512 are to be removed from the array must already be vacant. That is, the
1513 devices which were in those slots must be failed and removed.
1514
1515 When the number of devices is increased, any hot spares that are
1516 present will be activated immediately.
1517
1518 Changing the number of active devices in a RAID5 or RAID6 is much more
1519 effort. Every block in the array will need to be read and written back
1520 to a new location. From 2.6.17, the Linux Kernel is able to increase
1521 the number of devices in a RAID5 safely, including restarting an inter‐
1522 rupted "reshape". From 2.6.31, the Linux Kernel is able to increase or
1523 decrease the number of devices in a RAID5 or RAID6.
1524
1525 When decreasing the number of devices, the size of the array will also
1526 decrease. If there was data in the array, it could get destroyed and
1527 this is not reversible. To help prevent accidents, mdadm requires that
1528 the size of the array be decreased first with mdadm --grow --array-
1529 size. This is a reversible change which simply makes the end of the
1530 array inaccessible. The integrity of any data can then be checked
1531 before the non-reversible reduction in the number of devices is
1532 request.
1533
1534 When relocating the first few stripes on a RAID5, it is not possible to
1535 keep the data on disk completely consistent and crash-proof. To pro‐
1536 vide the required safety, mdadm disables writes to the array while this
1537 "critical section" is reshaped, and takes a backup of the data that is
1538 in that section. This backup is normally stored in any spare devices
1539 that the array has, however it can also be stored in a separate file
1540 specified with the --backup-file option. If this option is used, and
1541 the system does crash during the critical period, the same file must be
1542 passed to --assemble to restore the backup and reassemble the array.
1543
1544
1545 LEVEL CHANGES
1546 Changing the RAID level of any array happens instantaneously. However
1547 in the RAID to RAID6 case this requires a non-standard layout of the
1548 RAID6 data, and in the RAID6 to RAID5 case that non-standard layout is
1549 required before the change can be accomplish. So while the level
1550 change is instant, the accompanying layout change can take quite a long
1551 time.
1552
1553
1554 CHUNK-SIZE AND LAYOUT CHANGES
1555 Changing the chunk-size of layout without also changing the number of
1556 devices as the same time will involve re-writing all blocks in-place.
1557 To ensure against data loss in the case of a crash, a --backup-file
1558 must be provided for these changes. Small sections of the array will
1559 be copied to the backup file while they are being rearranged.
1560
1561 If the reshape is interrupted for any reason, this backup file must be
1562 make available to mdadm --assemble so the array can be reassembled.
1563 Consequently the file cannot be stored on the device being reshaped.
1564
1565
1566
1567 BITMAP CHANGES
1568 A write-intent bitmap can be added to, or removed from, an active
1569 array. Either internal bitmaps, or bitmaps stored in a separate file,
1570 can be added. Note that if you add a bitmap stored in a file which is
1571 in a filesystem that is on the RAID array being affected, the system
1572 will deadlock. The bitmap must be on a separate filesystem.
1573
1574
1576 Usage: mdadm --incremental [--run] [--quiet] component-device
1577
1578 Usage: mdadm --incremental --fail component-device
1579
1580 Usage: mdadm --incremental --rebuild-map
1581
1582 Usage: mdadm --incremental --run --scan
1583
1584
1585 This mode is designed to be used in conjunction with a device discovery
1586 system. As devices are found in a system, they can be passed to mdadm
1587 --incremental to be conditionally added to an appropriate array.
1588
1589 Conversely, it can also be used with the --fail flag to do just the
1590 opposite and find whatever array a particular device is part of and
1591 remove the device from that array.
1592
1593 If the device passed is a CONTAINER device created by a previous call
1594 to mdadm, then rather than trying to add that device to an array, all
1595 the arrays described by the metadata of the container will be started.
1596
1597 mdadm performs a number of tests to determine if the device is part of
1598 an array, and which array it should be part of. If an appropriate
1599 array is found, or can be created, mdadm adds the device to the array
1600 and conditionally starts the array.
1601
1602 Note that mdadm will only add devices to an array which were previously
1603 working (active or spare) parts of that array. It does not currently
1604 support automatic inclusion of a new drive as a spare in some array.
1605
1606 The tests that mdadm makes are as follow:
1607
1608 + Is the device permitted by mdadm.conf? That is, is it listed in
1609 a DEVICES line in that file. If DEVICES is absent then the
1610 default it to allow any device. Similar if DEVICES contains the
1611 special word partitions then any device is allowed. Otherwise
1612 the device name given to mdadm must match one of the names or
1613 patterns in a DEVICES line.
1614
1615
1616 + Does the device have a valid md superblock. If a specific meta‐
1617 data version is request with --metadata or -e then only that
1618 style of metadata is accepted, otherwise mdadm finds any known
1619 version of metadata. If no md metadata is found, the device is
1620 rejected.
1621
1622
1623 mdadm keeps a list of arrays that it has partially assembled in
1624 /var/run/mdadm/map (or /var/run/mdadm.map if the directory
1625 doesn't exist. Or maybe even /dev/.mdadm.map). If no array
1626 exists which matches the metadata on the new device, mdadm must
1627 choose a device name and unit number. It does this based on any
1628 name given in mdadm.conf or any name information stored in the
1629 metadata. If this name suggests a unit number, that number will
1630 be used, otherwise a free unit number will be chosen. Normally
1631 mdadm will prefer to create a partitionable array, however if
1632 the CREATE line in mdadm.conf suggests that a non-partitionable
1633 array is preferred, that will be honoured.
1634
1635 If the array is not found in the config file and its metadata
1636 does not identify it as belonging to the "homehost", then mdadm
1637 will choose a name for the array which is certain not to con‐
1638 flict with any array which does belong to this host. It does
1639 this be adding an underscore and a small number to the name pre‐
1640 ferred by the metadata.
1641
1642 Once an appropriate array is found or created and the device is
1643 added, mdadm must decide if the array is ready to be started.
1644 It will normally compare the number of available (non-spare)
1645 devices to the number of devices that the metadata suggests need
1646 to be active. If there are at least that many, the array will
1647 be started. This means that if any devices are missing the
1648 array will not be restarted.
1649
1650 As an alternative, --run may be passed to mdadm in which case
1651 the array will be run as soon as there are enough devices
1652 present for the data to be accessible. For a RAID1, that means
1653 one device will start the array. For a clean RAID5, the array
1654 will be started as soon as all but one drive is present.
1655
1656 Note that neither of these approaches is really ideal. If it
1657 can be known that all device discovery has completed, then
1658 mdadm -IRs
1659 can be run which will try to start all arrays that are being
1660 incrementally assembled. They are started in "read-auto" mode
1661 in which they are read-only until the first write request. This
1662 means that no metadata updates are made and no attempt at resync
1663 or recovery happens. Further devices that are found before the
1664 first write can still be added safely.
1665
1666
1668 This section describes environment variables that affect how mdadm
1669 operates.
1670
1671
1672 MDADM_NO_MDMON
1673 Setting this value to 1 will prevent mdadm from automatically
1674 launching mdmon. This variable is intended primarily for debug‐
1675 ging mdadm/mdmon.
1676
1677
1678 MDADM_NO_UDEV
1679 Normally, mdadm does not create any device nodes in /dev, but
1680 leaves that task to udev. If udev appears not to be configured,
1681 or if this environment variable is set to '1', the mdadm will
1682 create and devices that are needed.
1683
1684
1686 mdadm --query /dev/name-of-device
1687 This will find out if a given device is a RAID array, or is part of
1688 one, and will provide brief information about the device.
1689
1690 mdadm --assemble --scan
1691 This will assemble and start all arrays listed in the standard config
1692 file. This command will typically go in a system startup file.
1693
1694 mdadm --stop --scan
1695 This will shut down all arrays that can be shut down (i.e. are not cur‐
1696 rently in use). This will typically go in a system shutdown script.
1697
1698 mdadm --follow --scan --delay=120
1699 If (and only if) there is an Email address or program given in the
1700 standard config file, then monitor the status of all arrays listed in
1701 that file by polling them ever 2 minutes.
1702
1703 mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1
1704 Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1.
1705
1706 echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > mdadm.conf
1707 mdadm --detail --scan >> mdadm.conf
1708 This will create a prototype config file that describes currently
1709 active arrays that are known to be made from partitions of IDE or SCSI
1710 drives. This file should be reviewed before being used as it may con‐
1711 tain unwanted detail.
1712
1713 echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' > mdadm.conf
1714 mdadm --examine --scan --config=mdadm.conf >> mdadm.conf
1715 This will find arrays which could be assembled from existing IDE and
1716 SCSI whole drives (not partitions), and store the information in the
1717 format of a config file. This file is very likely to contain unwanted
1718 detail, particularly the devices= entries. It should be reviewed and
1719 edited before being used as an actual config file.
1720
1721 mdadm --examine --brief --scan --config=partitions
1722 mdadm -Ebsc partitions
1723 Create a list of devices by reading /proc/partitions, scan these for
1724 RAID superblocks, and printout a brief listing of all that were found.
1725
1726 mdadm -Ac partitions -m 0 /dev/md0
1727 Scan all partitions and devices listed in /proc/partitions and assemble
1728 /dev/md0 out of all such devices with a RAID superblock with a minor
1729 number of 0.
1730
1731 mdadm --monitor --scan --daemonise > /var/run/mdadm
1732 If config file contains a mail address or alert program, run mdadm in
1733 the background in monitor mode monitoring all md devices. Also write
1734 pid of mdadm daemon to /var/run/mdadm.
1735
1736 mdadm -Iq /dev/somedevice
1737 Try to incorporate newly discovered device into some array as appropri‐
1738 ate.
1739
1740 mdadm --incremental --rebuild-map --run --scan
1741 Rebuild the array map from any current arrays, and then start any that
1742 can be started.
1743
1744 mdadm /dev/md4 --fail detached --remove detached
1745 Any devices which are components of /dev/md4 will be marked as faulty
1746 and then remove from the array.
1747
1748 mdadm --grow /dev/md4 --level=6 --backup-file=/root/backup-md4
1749 The array /dev/md4 which is currently a RAID5 array will be converted
1750 to RAID6. There should normally already be a spare drive attached to
1751 the array as a RAID6 needs one more drive than a matching RAID5.
1752
1753 mdadm --create /dev/md/ddf --metadata=ddf --raid-disks 6 /dev/sd[a-f]
1754 Create a DDF array over 6 devices.
1755
1756 mdadm --create /dev/md/home -n3 -l5 -z 30000000 /dev/md/ddf
1757 Create a RAID5 array over any 3 devices in the given DDF set. Use only
1758 30 gigabytes of each device.
1759
1760 mdadm -A /dev/md/ddf1 /dev/sd[a-f]
1761 Assemble a pre-exist ddf array.
1762
1763 mdadm -I /dev/md/ddf1
1764 Assemble all arrays contained in the ddf array, assigning names as
1765 appropriate.
1766
1767 mdadm --create --help
1768 Provide help about the Create mode.
1769
1770 mdadm --config --help
1771 Provide help about the format of the config file.
1772
1773 mdadm --help
1774 Provide general help.
1775
1776
1778 /proc/mdstat
1779 If you're using the /proc filesystem, /proc/mdstat lists all active md
1780 devices with information about them. mdadm uses this to find arrays
1781 when --scan is given in Misc mode, and to monitor array reconstruction
1782 on Monitor mode.
1783
1784
1785 /etc/mdadm.conf
1786 The config file lists which devices may be scanned to see if they con‐
1787 tain MD super block, and gives identifying information (e.g. UUID)
1788 about known MD arrays. See mdadm.conf(5) for more details.
1789
1790
1791 /var/run/mdadm/map
1792 When --incremental mode is used, this file gets a list of arrays cur‐
1793 rently being created. If /var/run/mdadm does not exist as a directory,
1794 then /var/run/mdadm.map is used instead. If /var/run is not available
1795 (as may be the case during early boot), /dev/.mdadm.map is used on the
1796 basis that /dev is usually available very early in boot.
1797
1798
1800 mdadm understand two sorts of names for array devices.
1801
1802 The first is the so-called 'standard' format name, which matches the
1803 names used by the kernel and which appear in /proc/mdstat.
1804
1805 The second sort can be freely chosen, but must reside in /dev/md/.
1806 When giving a device name to mdadm to create or assemble an array,
1807 either full path name such as /dev/md0 or /dev/md/home can be given, or
1808 just the suffix of the second sort of name, such as home can be given.
1809
1810 When mdadm chooses device names during auto-assembly or incremental
1811 assembly, it will sometimes add a small sequence number to the end of
1812 the name to avoid conflicted between multiple arrays that have the same
1813 name. If mdadm can reasonably determine that the array really is meant
1814 for this host, either by a hostname in the metadata, or by the presence
1815 of the array in /etc/mdadm.conf, then it will leave off the suffix if
1816 possible. Also if the homehost is specified as <ignore> mdadm will
1817 only use a suffix if a different array of the same name already exists
1818 or is listed in the config file.
1819
1820 The standard names for non-partitioned arrays (the only sort of md
1821 array available in 2.4 and earlier) are of the form
1822
1823 /dev/mdNN
1824
1825 where NN is a number. The standard names for partitionable arrays (as
1826 available from 2.6 onwards) are of the form
1827
1828 /dev/md_dNN
1829
1830 Partition numbers should be indicated by added "pMM" to these, thus
1831 "/dev/md/d1p2".
1832
1833 From kernel version, 2.6.28 the "non-partitioned array" can actually be
1834 partitioned. So the "md_dNN" names are no longer needed, and parti‐
1835 tions such as "/dev/mdNNpXX" are possible.
1836
1837
1839 mdadm was previously known as mdctl.
1840
1841 mdadm is completely separate from the raidtools package, and does not
1842 use the /etc/raidtab configuration file at all.
1843
1844
1846 For further information on mdadm usage, MD and the various levels of
1847 RAID, see:
1848
1849 http://linux-raid.osdl.org/
1850
1851 (based upon Jakob Østergaard's Software-RAID.HOWTO)
1852
1853 The latest version of mdadm should always be available from
1854
1855 http://www.kernel.org/pub/linux/utils/raid/mdadm/
1856
1857 Related man pages:
1858
1859 mdmon(8), mdadm.conf(5), md(4).
1860
1861 raidtab(5), raid0run(8), raidstop(8), mkraid(8).
1862
1863
1864
1865v3.1.2 MDADM(8)