4 mdadm \- manage MD devices
10 .BI mdadm " [mode] <raiddevice> [options] <component-devices>"
13 RAID devices are virtual devices created from two or more
14 real block devices. This allows multiple devices (typically disk
15 drives or partitions there-of) to be combined into a single device to
16 hold (for example) a single filesystem.
17 Some RAID levels include redundancy and so can survive some degree of
20 Linux Software RAID devices are implemented through the md (Multiple
21 Devices) device driver.
23 Currently, Linux supports
34 Recent kernels (2002) also support a mode known as
37 only provides limited support for MULTIPATH as yet.
40 is a program that can be used to create, manage, and monitor
42 such it provides a similar set of functionality to the
45 The key differences between
52 is a single program and not a collection of programs.
55 can perform (almost) all of its functions without having a
56 configuration file. Also
58 helps with management of the configuration
62 can provide information about your arrays (through Query, Detail, and Examine)
68 mdadm has 6 major modes of operation:
71 Assemble the parts of a previously created
72 array into an active array. Components can be explicitly given
73 or can be searched for.
75 checks that the components
76 do form a bona fide array, and can, on request, fiddle superblock
77 information so as to assemble a faulty array.
81 Build a legacy array without per-device superblocks.
85 Create a new array with per-device superblocks.
87 '''in several step create-add-add-run or it can all happen with one command.
91 This is for doing things to specific components of an array such as
92 adding new spares and removing faulty devices.
96 This mode allows operations on independent devices such as examine MD
97 superblocks, erasing old superblocks and stopping active arrays.
100 .B "Follow or Monitor"
101 Monitor one or more md devices and act on any state changes.
105 Available options are:
108 .BR -A ", " --assemble
109 Assemble a pre-existing array.
113 Build a legacy array without superblocks.
121 Examine a device to see
122 (1) if it is an md device and (2) if it is a component of an md
124 Information about what is discovered is presented.
128 Print detail of one or more md devices.
131 .BR -E ", " --examine
132 Print content of md superblock on device(s).
135 .BR -F ", " --follow ", " --monitor
142 Display help message or, after above option, mode specific help message.
145 .BR -V ", " --version
146 Print version information for mdadm.
149 .BR -v ", " --verbose
150 Be more verbose about what is happening.
154 Be less verbose. This is used with
161 Be more forceful about certain operations. See the various modes of
162 the exact meaning of this option in different contexts.
165 .BR -c ", " --config=
166 Specify the config file. Default is
167 .BR /etc/mdadm.conf .
173 for missing information.
174 In general, this option gives
176 permission to get any missing information, like component devices,
177 array devices, array identities, and alert destination from the
179 .BR /etc/mdadm.conf .
180 One exception is MISC mode when using
186 says to get a list of array devices from
189 .SH For create or build:
193 Specify chunk size of kibibytes. The default is 64.
197 Specify rounding factor for linear array (==chunk size)
201 Set raid level. Options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid5, 4,
202 raid5, 5, multipath, mp. Obviously some of these are synonymous.
203 Only the first 4 are valid when Building.
206 .BR -p ", " --parity=
207 Set raid5 parity algorithm. Options are:
212 la, ra, ls, rs. The default is left-symmetric.
219 .BR -n ", " --raid-devices=
220 number of active devices in array.
223 .BR -x ", " --spare-devices=
224 number of spare (eXtra) devices in initial array. Spares can be added
229 Amount (in Kibibytes) of space to use from each drive in RAID1/4/5.
230 This must be a multiple of the chunk size, and must leave about 128Kb
231 of space at the end of the drive for the RAID superblock.
232 If this is not specified
233 (as it normally is not) the smallest drive (or partition) sets the
234 size, though if there is a variance among the drives of greater than 1%, a warning is
241 uuid of array to assemble. Devices which don't have this uuid are
245 .BR -m ", " --super-minor=
246 Minor number of device that array was created for. Devices which
247 don't have this minor number are excluded. If you create an array as
248 /dev/md1, then all superblocks will contain the minor number 1, even if
249 the array is later assembled as /dev/md2.
253 Assemble the array even if some superblocks appear out-of-date
257 Attempt to start the array even if fewer drives were given than are
258 needed for a full array. Normally if not all drives are found and
260 is not used, then the array will be assembled but not started.
263 an attempt will be made to start it anyway.
270 hotadd listed devices.
274 remove listed devices. They must not be active. i.e. they should
275 be failed or spare devices.
279 mark listed devices as faulty.
289 start a partially built array.
293 deactivate array, releasing all resources.
296 .BR -o ", " --readonly
297 mark array as readonly.
300 .BR -w ", " --readwrite
301 mark array as readwrite.
305 If the device contains a valid md superblock, the block is
306 over-written with zeros. With
308 the block where the superblock would be is over-written even if it
309 doesn't appear to be valid.
311 .SH For Monitor mode:
314 Give a mail address to send alerts to.
317 .BR -p ", " --program ", " --alert
318 Give a program to be run whenever an event is detected.
322 Give a delay in seconds.
324 polls the md arrays and then waits this many seconds before polling
325 again. The default is 60 seconds.
335 .B mdadm --assemble --scan
339 This usage assembles one or more raid arrays from pre-existing components.
340 For each array, mdadm needs to know the md device, the identity of the
341 array, and a number of component-devices. These can be found in a number of ways.
343 The md device is either given before
345 or is found from the config file. In the latter case, multiple md devices
346 can be started with a single mdadm command.
348 The identity can be given with the
352 option, can be found in in the config file, or will be taken from the
353 super block on the first component-device listed on the command line.
355 Devices can be given on the
357 command line or from the config file. Only devices which have an md
358 superblock which contains the right identity will be considered for any device.
360 The config file is only used if explicitly named with
370 is not given, then the config file will only be used to find the
371 identity of md arrays.
373 Normally the array will be started after it is assembled. However if
375 is not given and insufficient drives were listed to start a complete
376 (non-degraded) array, then the array is not started (to guard against
377 usage errors). To insist that the array be started in this case (as
378 may work for RAID1 or RAID5), give the
391 .BI --raid-devices= Z
395 This usage is similar to
397 The difference is that it creates a legacy array without a superblock. With
398 these arrays there is no difference between initially creating the array and
399 subsequently assembling the array, except that hopefully there is useful
400 data there in the second case.
402 The level may only be 0, raid0, or linear. All devices must be listed
403 and the array will be started once complete.
414 .BI --raid-devices= Z
418 This usage will initialise a new md array, associate some devices with
419 it, and activate the array.
421 As devices are added, they are checked to see if they contain raid
422 superblocks or filesystems. They are also checked to see if the variance in
423 device size exceeds 1%.
425 If any discrepancy is found, the array will not automatically be run, though
428 can override this caution.
430 To create a "degraded" array in which some devices are missing, simply
433 in place of a device name. This will cause
435 to leave the corresponding slot in the array empty.
436 For a RAID4 or RAID5 array at most one slot can be
438 For a RAID1 array, only one real device needs to be given. All of the
444 '''option is given, it is not necessary to list any component-devices in this command.
445 '''They can be added later, before a
449 '''is given, the apparent size of the smallest drive given is used.
451 The General Management options that are valid with --create are:
454 insist of running the array even if some devices look like they might
459 start the array readonly - not supported yet.
466 .I options... devices...
469 This usage will allow individual devices in an array to be failed,
470 removed or added. It is possible to perform multiple operations with
471 on command. For example:
473 .B " mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 /a /dev/hda1"
479 and will then remove it from the array and finally add it back
480 in as a spare. However only one md array can be affected by a single
491 MISC mode includes a number if distinct operations that
492 operate on distinct devices. The operations are:
495 The device is examined to see if it is
496 (1) an active md array, or
497 (2) a component of an md array.
498 The information discovered is reported.
502 The device should be an active md device.
504 will display a detailed description of the array.
508 will cause the output to be less detailed and the format to be
509 suitable for inclusion in
510 .BR /etc/mdadm.conf .
514 The device should be a component of an md array.
516 will read the md superblock of the device and display the contents.
521 then multiple devices that are components of the one array
522 are grouped together and reported in a single entry suitable
524 .BR /etc/mdadm.conf .
528 without listing any devices will cause all devices listed in the
529 config file to be examined.
533 This devices should active md arrays which will be deactivated, if
534 they are not currently in use.
538 This will fully activate a partially assembled md array.
542 This will mark an active array as read-only, providing that it is
543 not currently being used.
549 array back to being read/write.
553 For all operations except
556 will cause the operation to be applied to all arrays listed in
561 causes all devices listed in the config file to be examined.
569 .I options... devices...
574 to periodically poll a number of md arrays and to report on any events
577 will never exit once it decides that there are arrays to be checked,
578 so it should normally be run in the background.
580 As well as reporting events,
582 may move a spare drive from one array to another if they are in the
585 and if the destination array has a failed drive but not spares.
587 If any devices are listed on the command line,
589 will only monitor those devices. Otherwise all arrays listed in the
590 configuration file will be monitored. Further, if
592 is given, then any other md devices that appear in
594 will also be monitored.
596 The result of monitoring the arrays is the generation of events.
597 These events are passed to a separate program (is specified) and may
598 be mailed to a given E-mail address.
603 is given, then a program or an E-mail address must be specified on the
604 command line or in the config file. If neither are available, then
606 will not monitor anything.
610 will continue monitoring as long as something was found to monitor. If
611 no program or email is given, then each event is reported to
614 The different events are:
619 An md array which previously was configured appears to no longer be
624 An md array started reconstruction.
630 is 20, 40, 60, or 80, this indicates that rebuild has passed that many
631 percentage of the total.
635 An active component device of an array has been marked as faulty.
639 A spare component device which was being rebuilt to replace a faulty
644 A spare component device which was being rebuilt to replace a faulty
645 device as been successfully rebuild and has been made active.
649 A new md array has been detected in the
655 A spare drive has been moved from one array in a
657 to another to allow a failed drive to be replaced.
665 cause Email to be sent. All events cause the program to be run.
666 The program is run with two or three arguments, they being the event
667 name, the array device and possibly a second device.
669 Each event has an associated array device (e.g.
671 and possibly a second device. For
676 the second device is the relevant component device.
679 the second device is the array that the spare was moved from.
683 to move spares from one array to another, the different arrays need to
684 be labelled with the same
686 in the configuration file. The
688 name can be any string. It is only necessary that different spare
689 groups use different names.
693 detects that an array which is in a spare group has fewer active
694 devices than necessary for the complete array, and has no spare
695 devices, it will look for another array in the same spare group that
696 has a full complement of working drive and a spare. It will then
697 attempt to remove the spare from the second drive and add it to the
699 If the removal succeeds but the adding fails, then it is added back to
704 To find out if a devices is a raid array or part of one:
706 .B " mdadm -Q /dev/name-of-device"
708 To assemble and start all array listed in the standard config file:
712 To shut down all arrays (that are not still in used):
714 .B " mdadm --stop --scan"
716 To monitor all arrays if (and only if) an email address or program
717 was given in the config file, but poll every 2 minutes:
719 .B " mdadm -Fs --delay=120"
721 To create /dev/md0 as a RAID1 array with /dev/hda1 and /dev/hdc1:
723 .B " mdadm -C /dev/md0 -l1 -n2 /dev/hd[ac]1"
725 To create prototype a config file that describes currently
726 active arrays that are known to be made from partitions of
729 .B " echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > mdadm.conf"
731 .B " mdadm --detail --scan >> mdadm.conf"
733 This file should be reviewed before being used as it may
734 contain unwanted detail.
736 To find out what raid arrays could be assembled from existing
737 IDE and SCSI whole drives (not partitions):
739 .B " echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' > mdadm.conf"
741 .B " mdadm -Es -c mdadm.conf >> mdadm.conf"
742 This file is very likely to contain unwanted detail, particularly
747 To get help about Create mode:
749 .B " mdadm --create --help"
751 To get help about the format of the config file:
753 .B " mdadm --config --help"
770 lists all active md devices with information about them.
772 uses this to find arrays when
774 is given in Misc mode, and to monitor array reconstruction
780 The config file lists which devices may be scanned to see if
781 they contain MD super block, and gives identifying information
782 (e.g. UUID) about known MD arrays. See
789 was previously known as
793 For information on the various levels of
797 .UR http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/
798 http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/
801 for new releases of the RAID driver check out:
804 .UR ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches
805 ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches
810 .UR http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/
811 http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/