2 .\" Copyright Neil Brown and others.
3 .\" This program is free software; you can redistribute it and/or modify
4 .\" it under the terms of the GNU General Public License as published by
5 .\" the Free Software Foundation; either version 2 of the License, or
6 .\" (at your option) any later version.
7 .\" See file COPYING in distribution for details.
8 .TH MDADM 8 "" v3.0-devel1
10 mdadm \- manage MD devices
16 .BI mdadm " [mode] <raiddevice> [options] <component-devices>"
19 RAID devices are virtual devices created from two or more
20 real block devices. This allows multiple devices (typically disk
21 drives or partitions thereof) to be combined into a single device to
22 hold (for example) a single filesystem.
23 Some RAID levels include redundancy and so can survive some degree of
26 Linux Software RAID devices are implemented through the md (Multiple
27 Devices) device driver.
29 Currently, Linux supports
46 is not a Software RAID mechanism, but does involve
48 each device is a path to one common physical storage device.
51 is also not true RAID, and it only involves one device. It
52 provides a layer over a true device that can be used to inject faults.
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
64 With a CONTAINER, there is one set of metadata the describes
68 .\"is a program that can be used to create, manage, and monitor
70 .\"such it provides a similar set of functionality to the
73 .\"The key differences between
80 .\"is a single program and not a collection of programs.
83 .\"can perform (almost) all of its functions without having a
84 .\"configuration file and does not use one by default. Also
86 .\"helps with management of the configuration
90 .\"can provide information about your arrays (through Query, Detail, and Examine)
100 .\"configuration file, at all. It has a different configuration file
101 .\"with a different format and a different purpose.
104 mdadm has several major modes of operation:
107 Assemble the components of a previously created
108 array into an active array. Components can be explicitly given
109 or can be searched for.
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.
117 Build an array that doesn't have per-device superblocks. For these
120 cannot differentiate between initial creation and subsequent assembly
121 of an array. It also cannot perform any checks that appropriate
122 components have been requested. Because of this, the
124 mode should only be used together with a complete understanding of
129 Create a new array with per-device superblocks.
131 .\"in several step create-add-add-run or it can all happen with one command.
134 .B "Follow or Monitor"
135 Monitor one or more md devices and act on any state changes. This is
136 only meaningful for raid1, 4, 5, 6, 10 or multipath arrays, as
137 only these have interesting state. raid0 or linear never have
138 missing, spare, or failed drives, so there is nothing to monitor.
142 Grow (or shrink) an array, or otherwise reshape it in some way.
143 Currently supported growth options including changing the active size
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.
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
153 system. As each device is detected,
155 has a chance to include it in some array as appropriate.
159 This is for doing things to specific components of an array such as
160 adding new spares and removing faulty devices.
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.
167 .\"This mode allows operations on independent devices such as examine MD
168 .\"superblocks, erasing old superblocks and stopping active arrays.
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.
176 .SH Options for selecting a mode are:
179 .BR \-A ", " \-\-assemble
180 Assemble a pre-existing array.
183 .BR \-B ", " \-\-build
184 Build a legacy array without superblocks.
187 .BR \-C ", " \-\-create
191 .BR \-F ", " \-\-follow ", " \-\-monitor
197 .BR \-G ", " \-\-grow
198 Change the size or shape of an active array.
201 .BR \-I ", " \-\-incremental
202 Add a single device into an appropriate array, and possibly start the array.
206 Request that the kernel starts any auto-detected arrays. This can only
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
213 In-kernel autodetect is not recommended for new installations. Using
215 to detect and assemble arrays \(em possibly in an
217 \(em is substantially more flexible and should be preferred.
220 If a device is given before any options, or if the first option is
225 then the MANAGE mode is assume.
226 Anything other than these will cause the
230 .SH Options that are not mode-specific are:
233 .BR \-h ", " \-\-help
234 Display general help message or, after one of the above options, a
235 mode-specific help message.
239 Display more detailed help about command line parsing and some commonly
243 .BR \-V ", " \-\-version
244 Print version information for mdadm.
247 .BR \-v ", " \-\-verbose
248 Be more verbose about what is happening. This can be used twice to be
250 The extra verbosity currently only affects
251 .B \-\-detail \-\-scan
253 .BR "\-\-examine \-\-scan" .
256 .BR \-q ", " \-\-quiet
257 Avoid printing purely informative messages. With this,
259 will be silent unless there is something really important to report.
262 .BR \-b ", " \-\-brief
263 Be less verbose. This is used with
271 gives an intermediate level of verbosity.
274 .BR \-f ", " \-\-force
275 Be more forceful about certain operations. See the various modes for
276 the exact meaning of this option in different contexts.
279 .BR \-c ", " \-\-config=
280 Specify the config file. Default is to use
281 .BR /etc/mdadm.conf ,
282 or if that is missing then
283 .BR /etc/mdadm/mdadm.conf .
284 If the config file given is
286 then nothing will be read, but
288 will act as though the config file contained exactly
289 .B "DEVICE partitions"
292 to find a list of devices to scan.
295 is given for the config file, then
297 will act as though the config file were empty.
300 .BR \-s ", " \-\-scan
303 for missing information.
304 In general, this option gives
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
315 says to get a list of array devices from
319 .B \-e ", " \-\-metadata=
320 Declare the style of superblock (raid metadata) to be used. The
323 and to guess for other operations.
324 The default can be overridden by setting the
333 .IP "0, 0.90, default"
334 Use the original 0.90 format superblock. This format limits arrays to
335 28 component devices and limits component devices of levels 1 and
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.
339 The different sub-versions store the superblock at different locations
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).
346 This will override any
348 setting in the config file and provides the identity of the host which
349 should be considered the home for any arrays.
351 When creating an array, the
353 will be recorded in the superblock. For version-1 superblocks, it will
354 be prefixed to the array name. For version-0.90 superblocks, part of
355 the SHA1 hash of the hostname will be stored in the later half of the
358 When reporting information about an array, any array which is tagged
359 for the given homehost will be reported as such.
361 When using Auto-Assemble, only arrays tagged for the given homehost
364 .SH For create, build, or grow:
367 .BR \-n ", " \-\-raid\-devices=
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
371 (including "\fBmissing\fP" devices)
372 that are listed on the command line for
374 Setting a value of 1 is probably
375 a mistake and so requires that
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.
380 This number can only be changed using
382 for RAID1, RAID5 and RAID6 arrays, and only on kernels which provide
386 .BR \-x ", " \-\-spare\-devices=
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.
395 .BR \-z ", " \-\-size=
396 Amount (in Kibibytes) of space to use from each drive in RAID level 1/4/5/6.
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
404 This value can be set with
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
410 The size can be given as
412 which means to choose the largest size that fits on all current drives.
415 .BR \-c ", " \-\-chunk=
416 Specify chunk size of kibibytes. The default is 64.
420 Specify rounding factor for linear array (==chunk size)
423 .BR \-l ", " \-\-level=
424 Set raid level. When used with
426 options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4,
427 raid5, 5, raid6, 6, raid10, 10, multipath, mp, faulty. Obviously some of these are synonymous.
431 only linear, stripe, raid0, 0, raid1, multipath, mp, and faulty are valid.
433 Not yet supported with
437 .BR \-p ", " \-\-layout=
438 This option configures the fine details of data layout for raid5,
439 and raid10 arrays, and controls the failure modes for
442 The layout of the raid5 parity block can be one of
443 .BR left\-asymmetric ,
444 .BR left\-symmetric ,
445 .BR right\-asymmetric ,
446 .BR right\-symmetric ,
447 .BR la ", " ra ", " ls ", " rs .
449 .BR left\-symmetric .
451 When setting the failure mode for level
454 .BR write\-transient ", " wt ,
455 .BR read\-transient ", " rt ,
456 .BR write\-persistent ", " wp ,
457 .BR read\-persistent ", " rp ,
459 .BR read\-fixable ", " rf ,
460 .BR clear ", " flush ", " none .
462 Each failure mode can be followed by a number, which is used as a period
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
465 generated after that many requests, and will continue to be generated
466 every time the period elapses.
468 Multiple failure modes can be current simultaneously by using the
470 option to set subsequent failure modes.
472 "clear" or "none" will remove any pending or periodic failure modes,
473 and "flush" will clear any persistent faults.
475 To set the parity with
477 the level of the array ("faulty")
478 must be specified before the fault mode is specified.
480 Finally, the layout options for RAID10 are one of 'n', 'o' or 'f' followed
481 by a small number. The default is 'n2'. The supported options are:
484 signals 'near' copies. Multiple copies of one data block are at
485 similar offsets in different devices.
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
496 (multiple copies have very different offsets).
497 See md(4) for more detail about 'near' and 'far'.
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).
509 (thus explaining the p of
513 .BR \-b ", " \-\-bitmap=
514 Specify a file to store a write-intent bitmap in. The file should not
517 is also given. The same file should be provided
518 when assembling the array. If the word
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
525 mode, then any bitmap that is present is removed.
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').
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.
534 .BR \-\-bitmap\-chunk=
535 Set the chunksize of the bitmap. Each bit corresponds to that many
536 Kilobytes of storage.
537 When using a file based bitmap, the default is to use the smallest
538 size that is at-least 4 and requires no more than 2^21 chunks.
541 bitmap, the chunksize is automatically determined to make best use of
546 .BR \-W ", " \-\-write\-mostly
547 subsequent devices lists in a
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
558 .BR \-\-write\-behind=
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
567 .BR \-\-assume\-clean
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
574 initial resync, however this practice \(em while normally safe \(em is not
575 recommended. Use this only if you really know what you are doing.
578 .BR \-\-backup\-file=
581 is used to increase the number of
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.
587 .BR \-N ", " \-\-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.
598 run the array, even if some of the components
599 appear to be active in another array or filesystem. Normally
601 will ask for confirmation before including such components in an
602 array. This option causes that question to be suppressed.
605 .BR \-f ", " \-\-force
608 accept the geometry and layout specified without question. Normally
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
615 will not try to be so clever.
618 .BR \-a ", " "\-\-auto{=no,yes,md,mdp,part,p}{NN}"
619 Instruct mdadm to create the device file if needed, possibly allocating
620 an unused minor number. "md" causes a non-partitionable array
621 to be used. "mdp", "part" or "p" causes a partitionable array (2.6 and
622 later) to be used. "yes" requires the named md device to have
623 a 'standard' format, and the type and minor number will be determined
624 from this. See DEVICE NAMES below.
626 The argument can also come immediately after
631 is not given on the command line or in the config file, then
637 is also given, then any
639 entries in the config file will override the
641 instruction given on the command line.
643 For partitionable arrays,
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.
649 If the device name ends with a digit, the partition names add a 'p',
650 and a number, e.g. "/dev/home1p3". If there is no
651 trailing digit, then the partition names just have a number added,
652 e.g. "/dev/scratch3".
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
657 formats, then a unused minor number will be allocated. The minor
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
670 it will also create symlinks from
672 with names starting with
680 to enforce this even if it is suppressing
687 .BR \-u ", " \-\-uuid=
688 uuid of array to assemble. Devices which don't have this uuid are
692 .BR \-m ", " \-\-super\-minor=
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
695 /dev/md1, then all superblocks will contain the minor number 1, even if
696 the array is later assembled as /dev/md2.
698 Giving the literal word "dev" for
702 to use the minor number of the md device that is being assembled.
705 .B \-\-super\-minor=dev
706 will look for super blocks with a minor number of 0.
709 .BR \-N ", " \-\-name=
710 Specify the name of the array to assemble. This must be the name
711 that was specified when creating the array. It must either match
712 the name stored in the superblock exactly, or it must match
715 prefixed to the start of the given name.
718 .BR \-f ", " \-\-force
719 Assemble the array even if some superblocks appear out-of-date
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
727 is not used, then the array will be assembled but not started.
730 an attempt will be made to start it anyway.
734 This is the reverse of
736 in that it inhibits the startup of array unless all expected drives
737 are present. This is only needed with
739 and can be used if the physical connections to devices are
740 not as reliable as you would like.
743 .BR \-a ", " "\-\-auto{=no,yes,md,mdp,part}"
744 See this option under Create and Build options.
747 .BR \-b ", " \-\-bitmap=
748 Specify the bitmap file that was given when the array was created. If
751 bitmap, there is no need to specify this when assembling the array.
754 .BR \-\-backup\-file=
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
762 to allow possibly corrupted data to be restored.
765 .BR \-U ", " \-\-update=
766 Update the superblock on each device while assembling the array. The
767 argument given to this flag can be one of
781 option will adjust the superblock of an array what was created on a Sparc
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
784 .B "\-\-examine \-\-sparc2.2"
787 to see what effect this would have.
791 option will update the
793 field on each superblock to match the minor number of the array being
795 This can be useful if
797 reports a different "Preferred Minor" to
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.
806 option will change the uuid of the array. If a UUID is given with the
808 option that UUID will be used as a new UUID and will
810 be used to help identify the devices in the array.
813 is given, a random UUID is chosen.
817 option will change the
819 of the array as stored in the superblock. This is only supported for
820 version-1 superblocks.
824 option will change the
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.
832 option will cause the array to be marked
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
841 option allows arrays to be moved between machines with different
843 When assembling such an array for the first time after a move, giving
844 .B "\-\-update=byteorder"
847 to expect superblocks to have their byteorder reversed, and will
848 correct that order before assembling the array. This is only valid
849 with original (Version 0.90) superblocks.
853 option will correct the summaries in the superblock. That is the
854 counts of total, working, active, failed, and spare devices.
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
866 .BR \-\-update=devicesize .
869 to determine the maximum usable amount of space on each device and
870 update the relevant field in the metadata.
873 .B \-\-auto\-update\-homehost
874 This flag is only meaningful with auto-assembly (see discussion below).
875 In that situation, if no suitable arrays are found for this homehost,
877 will rescan for any arrays at all and will assemble them and update the
878 homehost to match the current host.
884 hot-add listed devices.
888 re-add a device that was recently removed from an array.
891 .BR \-r ", " \-\-remove
892 remove listed devices. They must not be active. i.e. they should
893 be failed or spare devices. As well as the name of a device file
902 The first causes all failed device to be removed. The second causes
903 any device which is no longer connected to the system (i.e an 'open'
906 to be removed. This will only succeed for devices that are spares or
907 have already been marked as failed.
910 .BR \-f ", " \-\-fail
911 mark listed devices as faulty.
912 As well as the name of a device file, the word
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.
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.
929 Subsequent devices that are added or re-added will have the 'write-mostly'
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
937 specified for different devices, e.g.
939 mdadm /dev/md0 \-\-add /dev/sda1 \-\-fail /dev/sdb1 \-\-remove /dev/sdb1
941 Each operation applies to all devices listed until the next
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
946 reconstruction but instead just updates the blocks that have changed
947 since the device was removed. For arrays with persistent metadata
948 (superblocks) this is done automatically. For arrays created with
950 mdadm needs to be told that this device we removed recently with
953 Devices can only be removed from an array if they are not in active
954 use, i.e. that must be spares or failed devices. To remove an active
955 device, it must first be marked as
961 .BR \-Q ", " \-\-query
962 Examine a device to see
963 (1) if it is an md device and (2) if it is a component of an md
965 Information about what is discovered is presented.
968 .BR \-D ", " \-\-detail
969 Print detail of one or more md devices.
972 .BR \-Y ", " \-\-export
977 output will be formatted as
979 pairs for easy import into the environment.
982 .BR \-E ", " \-\-examine
983 Print content of md superblock on device(s).
986 If an array was created on a 2.2 Linux kernel patched with RAID
987 support, the superblock will have been created incorrectly, or at
988 least incompatibly with 2.4 and later kernels. Using the
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
994 .BR "\-\-assemble \-\-update=sparc2.2" .
997 .BR \-X ", " \-\-examine\-bitmap
998 Report information about a bitmap file.
999 The argument is either an external bitmap file or an array component
1000 in case of an internal bitmap.
1003 .BR \-R ", " \-\-run
1004 start a partially built array.
1007 .BR \-S ", " \-\-stop
1008 deactivate array, releasing all resources.
1011 .BR \-o ", " \-\-readonly
1012 mark array as readonly.
1015 .BR \-w ", " \-\-readwrite
1016 mark array as readwrite.
1019 .B \-\-zero\-superblock
1020 If the device contains a valid md superblock, the block is
1021 overwritten with zeros. With
1023 the block where the superblock would be is overwritten even if it
1024 doesn't appear to be valid.
1027 .BR \-t ", " \-\-test
1032 is set to reflect the status of the device.
1035 .BR \-W ", " \-\-wait
1036 For each md device given, wait for any resync, recovery, or reshape
1037 activity to finish before returning.
1039 will return with success if it actually waited for every device
1040 listed, otherwise it will return failure.
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
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
1055 .SH For Incremental Assembly mode:
1057 .BR \-\-rebuild\-map ", " \-r
1058 Rebuild the map file
1059 .RB ( /var/run/mdadm/map )
1062 uses to help track which arrays are currently being assembled.
1065 .BR \-\-run ", " \-R
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.
1070 .BR \-\-scan ", " \-s
1071 Only meaningful with
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
1079 as requiring an external bitmap, that bitmap will be attached first.
1081 .SH For Monitor mode:
1083 .BR \-m ", " \-\-mail
1084 Give a mail address to send alerts to.
1087 .BR \-p ", " \-\-program ", " \-\-alert
1088 Give a program to be run whenever an event is detected.
1091 .BR \-y ", " \-\-syslog
1092 Cause all events to be reported through 'syslog'. The messages have
1093 facility of 'daemon' and varying priorities.
1096 .BR \-d ", " \-\-delay
1097 Give a delay in seconds.
1099 polls the md arrays and then waits this many seconds before polling
1100 again. The default is 60 seconds.
1103 .BR \-f ", " \-\-daemonise
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.
1111 which will only continue monitoring if a mail address or alert program
1112 is found in the config file.
1115 .BR \-i ", " \-\-pid\-file
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.
1122 .BR \-1 ", " \-\-oneshot
1123 Check arrays only once. This will generate
1125 events and more significantly
1131 .B " mdadm \-\-monitor \-\-scan \-1"
1133 from a cron script will ensure regular notification of any degraded arrays.
1136 .BR \-t ", " \-\-test
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
1141 message do get through successfully.
1147 .B mdadm \-\-assemble
1148 .I md-device options-and-component-devices...
1151 .B mdadm \-\-assemble \-\-scan
1152 .I md-devices-and-options...
1155 .B mdadm \-\-assemble \-\-scan
1159 This usage assembles one or more raid arrays from pre-existing components.
1160 For each array, mdadm needs to know the md device, the identity of the
1161 array, and a number of component-devices. These can be found in a number of ways.
1163 In the first usage example (without the
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.
1171 If precisely one device is listed, but
1177 was given and identity information is extracted from the configuration file.
1179 The identity can be given with the
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.
1187 Devices can be given on the
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
1193 The config file is only used if explicitly named with
1195 or requested with (a possibly implicit)
1203 is not given, then the config file will only be used to find the
1204 identity of md arrays.
1206 Normally the array will be started after it is assembled. However if
1208 is not given and insufficient drives were listed to start a complete
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
1211 may work for RAID1, 4, 5, 6, or 10), give the
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
1218 option must be given to clarify how and whether the device should be
1220 This can be useful for handling partitioned devices (which don't have
1221 a stable device number \(em it can change after a reboot) and when using
1222 "udev" to manage your
1224 tree (udev cannot handle md devices because of the unusual device
1225 initialisation conventions).
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
1229 first free one that is not in use and does not already have an entry
1230 in /dev (apart from numeric /dev/md* entries).
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
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.
1240 When using option "auto" to create a partitionable array, the device
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
1244 string to the device name, with an intervening "p" if the device name
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
1258 and no devices are listed,
1260 will first attempt to assemble all the arrays listed in the config
1265 has been specified (either in the config file or on the command line),
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
1271 will assemble arrays without being given specific device name or
1272 identity information for the array.
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
1281 number as recorded in the superblock is used to create a name in
1285 If the array uses version-1 metadata, then the
1287 from the superblock is used to similarly create a name in
1289 (the name will have any 'host' prefix stripped first).
1293 cannot find any array for the given host at all, and if
1294 .B \-\-auto\-update\-homehost
1297 will search again for any array (not just an array created for this
1298 host) and will assemble each assuming
1299 .BR \-\-update=homehost .
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
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.
1317 .BI \-\-raid\-devices= Z
1321 This usage is similar to
1323 The difference is that it creates an array without a superblock. With
1324 these arrays there is no difference between initially creating the array and
1325 subsequently assembling the array, except that hopefully there is useful
1326 data there in the second case.
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
1341 .BI \-\-raid\-devices= Z
1345 This usage will initialise a new md array, associate some devices with
1346 it, and activate the array.
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.
1354 As devices are added, they are checked to see if they contain raid
1355 superblocks or filesystems. They are also checked to see if the variance in
1356 device size exceeds 1%.
1358 If any discrepancy is found, the array will not automatically be run, though
1361 can override this caution.
1363 To create a "degraded" array in which some devices are missing, simply
1364 give the word "\fBmissing\fP"
1365 in place of a device name. This will cause
1367 to leave the corresponding slot in the array empty.
1368 For a RAID4 or RAID5 array at most one slot can be
1369 "\fBmissing\fP"; for a RAID6 array at most two slots.
1370 For a RAID1 array, only one real device needs to be given. All of the
1374 When creating a RAID5 array,
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
1379 be overridden with the
1383 When creating an array with version-1 metadata a name for the array is
1385 If this is not given with the
1389 will choose a name based on the last component of the name of the
1390 device being created. So if
1392 is being created, then the name
1397 is being created, then the name
1401 When creating a partition based array, using
1403 with version-1.x metadata, the partition type should be set to
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.
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
1413 option. Be warned that creating two arrays with the same UUID is a
1414 recipe for disaster. Also, using
1416 when creating a v0.90 array will silently override any
1421 .\"option is given, it is not necessary to list any component-devices in this command.
1422 .\"They can be added later, before a
1426 .\"is given, the apparent size of the smallest drive given is used.
1428 The General Management options that are valid with
1433 insist on running the array even if some devices look like they might
1438 start the array readonly \(em not supported yet.
1446 .I options... devices...
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:
1453 .B " mdadm /dev/md0 \-f /dev/hda1 \-r /dev/hda1 \-a /dev/hda1"
1459 and will then remove it from the array and finally add it back
1460 in as a spare. However only one md array can be affected by a single
1471 MISC mode includes a number of distinct operations that
1472 operate on distinct devices. The operations are:
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.
1482 The device should be an active md device.
1484 will display a detailed description of the array.
1488 will cause the output to be less detailed and the format to be
1489 suitable for inclusion in
1490 .BR /etc/mdadm.conf .
1493 will normally be 0 unless
1495 failed to get useful information about the device(s); however, if the
1497 option is given, then the exit status will be:
1501 The array is functioning normally.
1504 The array has at least one failed device.
1507 The array has multiple failed devices such that it is unusable.
1510 There was an error while trying to get information about the device.
1515 The device should be a component of an md array.
1517 will read the md superblock of the device and display the contents.
1522 is given, then multiple devices that are components of the one array
1523 are grouped together and reported in a single entry suitable
1525 .BR /etc/mdadm.conf .
1529 without listing any devices will cause all devices listed in the
1530 config file to be examined.
1534 The devices should be active md arrays which will be deactivated, as
1535 long as they are not currently in use.
1539 This will fully activate a partially assembled md array.
1543 This will mark an active array as read-only, providing that it is
1544 not currently being used.
1550 array back to being read/write.
1554 For all operations except
1557 will cause the operation to be applied to all arrays listed in
1562 causes all devices listed in the config file to be examined.
1569 .B mdadm \-\-monitor
1570 .I options... devices...
1575 to periodically poll a number of md arrays and to report on any events
1578 will never exit once it decides that there are arrays to be checked,
1579 so it should normally be run in the background.
1581 As well as reporting events,
1583 may move a spare drive from one array to another if they are in the
1586 and if the destination array has a failed drive but no spares.
1588 If any devices are listed on the command line,
1590 will only monitor those devices. Otherwise all arrays listed in the
1591 configuration file will be monitored. Further, if
1593 is given, then any other md devices that appear in
1595 will also be monitored.
1597 The result of monitoring the arrays is the generation of events.
1598 These events are passed to a separate program (if specified) and may
1599 be mailed to a given E-mail address.
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
1604 md device which is affected, and the third is the name of a related
1605 device if relevant (such as a component device that has failed).
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
1612 will not monitor anything.
1616 will continue monitoring as long as something was found to monitor. If
1617 no program or email is given, then each event is reported to
1620 The different events are:
1624 .B DeviceDisappeared
1625 An md array which previously was configured appears to no longer be
1626 configured. (syslog priority: Critical)
1630 was told to monitor an array which is RAID0 or Linear, then it will
1632 .B DeviceDisappeared
1633 with the extra information
1635 This is because RAID0 and Linear do not support the device-failed,
1636 hot-spare and resync operations which are monitored.
1640 An md array started reconstruction. (syslog priority: Warning)
1646 is 20, 40, 60, or 80, this indicates that rebuild has passed that many
1647 percentage of the total. (syslog priority: Warning)
1651 An md array that was rebuilding, isn't any more, either because it
1652 finished normally or was aborted. (syslog priority: Warning)
1656 An active component device of an array has been marked as
1657 faulty. (syslog priority: Critical)
1661 A spare component device which was being rebuilt to replace a faulty
1662 device has failed. (syslog priority: Critical)
1666 A spare component device which was being rebuilt to replace a faulty
1667 device has been successfully rebuilt and has been made active.
1668 (syslog priority: Info)
1672 A new md array has been detected in the
1674 file. (syslog priority: Info)
1678 A newly noticed array appears to be degraded. This message is not
1681 notices a drive failure which causes degradation, but only when
1683 notices that an array is degraded when it first sees the array.
1684 (syslog priority: Critical)
1688 A spare drive has been moved from one array in a
1690 to another to allow a failed drive to be replaced.
1691 (syslog priority: Info)
1697 has been told, via the config file, that an array should have a certain
1698 number of spare devices, and
1700 detects that it has fewer than this number when it first sees the
1701 array, it will report a
1704 (syslog priority: Warning)
1708 An array was found at startup, and the
1711 (syslog priority: Info)
1721 cause Email to be sent. All events cause the program to be run.
1722 The program is run with two or three arguments: the event
1723 name, the array device and possibly a second device.
1725 Each event has an associated array device (e.g.
1727 and possibly a second device. For
1732 the second device is the relevant component device.
1735 the second device is the array that the spare was moved from.
1739 to move spares from one array to another, the different arrays need to
1740 be labeled with the same
1742 in the configuration file. The
1744 name can be any string; it is only necessary that different spare
1745 groups use different names.
1749 detects that an array in a spare group has fewer active
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
1755 If the removal succeeds but the adding fails, then it is added back to
1759 The GROW mode is used for changing the size or shape of an active
1761 For this to work, the kernel must support the necessary change.
1762 Various types of growth are being added during 2.6 development,
1763 including restructuring a raid5 array to have more active devices.
1765 Currently the only support available is to
1767 change the "size" attribute
1768 for RAID1, RAID5 and RAID6.
1770 increase the "raid\-devices" attribute of RAID1, RAID5, and RAID6.
1772 add a write-intent bitmap to any array which supports these bitmaps, or
1773 remove a write-intent bitmap from such an array.
1777 Normally when an array is built the "size" it taken from the smallest
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
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.
1790 .SS RAID-DEVICES CHANGES
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
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
1800 devices which were in those slots must be failed and removed.
1802 When the number of devices is increased, any hot spares that are
1803 present will be activated immediately.
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".
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
1818 option. If this option is used, and the system does crash during the
1819 critical period, the same file must be passed to
1821 to restore the backup and reassemble the array.
1825 A write-intent bitmap can be added to, or removed from, an active
1826 array. Either internal bitmaps, or bitmaps stored in a separate file,
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.
1831 .SH INCREMENTAL MODE
1835 .B mdadm \-\-incremental
1841 .B mdadm \-\-incremental \-\-rebuild
1844 .B mdadm \-\-incremental \-\-run \-\-scan
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
1851 .B "mdadm \-\-incremental"
1852 to be conditionally added to an appropriate array.
1855 performs a number of tests to determine if the device is part of an
1856 array, and which array it should be part of. If an appropriate array
1857 is found, or can be created,
1859 adds the device to the array and conditionally starts the array.
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.
1867 .B "mdadm \-\-incremental"
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
1870 which is included with the mdadm source distribution. If
1872 detects that this bug is present, it will abort any attempt to use
1873 .BR \-\-incremental .
1877 makes are as follow:
1879 Is the device permitted by
1881 That is, is it listed in a
1883 line in that file. If
1885 is absent then the default it to allow any device. Similar if
1887 contains the special word
1889 then any device is allowed. Otherwise the device name given to
1891 must match one of the names or patterns in a
1896 Does the device have a valid md superblock. If a specific metadata
1897 version is request with
1901 then only that style of metadata is accepted, otherwise
1903 finds any known version of metadata. If no
1905 metadata is found, the device is rejected.
1908 Does the metadata match an expected array?
1909 The metadata can match in two ways. Either there is an array listed
1912 which identifies the array (either by UUID, by name, by device list,
1913 or by minor-number), or the array was created with a
1919 or on the command line.
1922 is not able to positively identify the array as belonging to the
1923 current host, the device will be rejected.
1927 keeps a list of arrays that it has partially assembled in
1928 .B /var/run/mdadm/map
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,
1934 must choose a device name and unit number. It does this based on any
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
1941 will prefer to create a partitionable array, however if the
1945 suggests that a non-partitionable array is preferred, that will be
1949 Once an appropriate array is found or created and the device is added,
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.
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.
1966 Note that neither of these approaches is really ideal. If it can
1967 be known that all device discovery has completed, then
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.
1980 This section describes environment variables that affect how mdadm
1985 Setting this value to 1 will prevent mdadm from automatically launching
1986 mdmon. This variable is intended primarily for debugging mdadm/mdmon.
1990 .B " mdadm \-\-query /dev/name-of-device"
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.
1995 .B " mdadm \-\-assemble \-\-scan"
1997 This will assemble and start all arrays listed in the standard config
1998 file. This command will typically go in a system startup file.
2000 .B " mdadm \-\-stop \-\-scan"
2002 This will shut down all arrays that can be shut down (i.e. are not
2003 currently in use). This will typically go in a system shutdown script.
2005 .B " mdadm \-\-follow \-\-scan \-\-delay=120"
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.
2012 .B " mdadm \-\-create /dev/md0 \-\-level=1 \-\-raid\-devices=2 /dev/hd[ac]1"
2014 Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1.
2017 .B " echo 'DEVICE /dev/hd*[0\-9] /dev/sd*[0\-9]' > mdadm.conf"
2019 .B " mdadm \-\-detail \-\-scan >> mdadm.conf"
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.
2023 This file should be reviewed before being used as it may
2024 contain unwanted detail.
2026 .B " echo 'DEVICE /dev/hd[a\-z] /dev/sd*[a\-z]' > mdadm.conf"
2028 .B " mdadm \-\-examine \-\-scan \-\-config=mdadm.conf >> mdadm.conf"
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
2032 format of a config file.
2033 This file is very likely to contain unwanted detail, particularly
2036 entries. It should be reviewed and edited before being used as an
2039 .B " mdadm \-\-examine \-\-brief \-\-scan \-\-config=partitions"
2041 .B " mdadm \-Ebsc partitions"
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
2048 .B " mdadm \-Ac partitions \-m 0 /dev/md0"
2050 Scan all partitions and devices listed in
2051 .BR /proc/partitions
2054 out of all such devices with a RAID superblock with a minor number of 0.
2056 .B " mdadm \-\-monitor \-\-scan \-\-daemonise > /var/run/mdadm"
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 .
2063 .B " mdadm \-Iq /dev/somedevice"
2065 Try to incorporate newly discovered device into some array as
2068 .B " mdadm \-\-incremental \-\-rebuild \-\-run \-\-scan"
2070 Rebuild the array map from any current arrays, and then start any that
2073 .B " mdadm /dev/md4 --fail detached --remove detached"
2075 Any devices which are components of /dev/md4 will be marked as faulty
2076 and then remove from the array.
2078 .B " mdadm \-\-create \-\-help"
2080 Provide help about the Create mode.
2082 .B " mdadm \-\-config \-\-help"
2084 Provide help about the format of the config file.
2086 .B " mdadm \-\-help"
2088 Provide general help.
2099 lists all active md devices with information about them.
2101 uses this to find arrays when
2103 is given in Misc mode, and to monitor array reconstruction
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
2115 .SS /var/run/mdadm/map
2118 mode is used, this file gets a list of arrays currently being created.
2121 does not exist as a directory, then
2122 .B /var/run/mdadm.map
2127 While entries in the /dev directory can have any format you like,
2129 has an understanding of 'standard' formats which it uses to guide its
2130 behaviour when creating device files via the
2134 The standard names for non-partitioned arrays (the only sort of md
2135 array available in 2.4 and earlier) are either of
2141 where NN is a number.
2142 The standard names for partitionable arrays (as available from 2.6
2143 onwards) are either of
2149 Partition numbers should be indicated by added "pMM" to these, thus "/dev/md/d1p2".
2153 was previously known as
2157 is completely separate from the
2159 package, and does not use the
2161 configuration file at all.
2164 For further information on mdadm usage, MD and the various levels of
2167 .B http://linux\-raid.osdl.org/
2169 (based upon Jakob \(/Ostergaard's Software\-RAID.HOWTO)
2171 .\"for new releases of the RAID driver check out:
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
2180 .\".UR http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/
2181 .\"http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/
2184 The latest version of
2186 should always be available from
2188 .B http://www.kernel.org/pub/linux/utils/raid/mdadm/