1MDADM(8)                    System Manager's Manual                   MDADM(8)
2
3
4

NAME

6       mdadm - manage MD devices aka Linux Software Raid.
7
8

SYNOPSIS

10       mdadm [mode] <raiddevice> [options] <component-devices>
11
12

DESCRIPTION

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, and FAULTY.
25
26       MULTIPATH  is  not a Software RAID mechanism, but does involve multiple
27       devices.  For MULTIPATH each device is a path to  one  common  physical
28       storage device.
29
30       FAULTY is also not true RAID, and it only involves one device.  It pro‐
31       vides a layer over a true device that can be used to inject faults.
32
33
34

MODES

36       mdadm has several major modes of operation:
37
38       Assemble
39              Assemble the parts of a previously created array into an  active
40              array.  Components  can  be  explicitly given or can be searched
41              for.  mdadm checks that the  components  do  form  a  bona  fide
42              array,  and can, on request, fiddle superblock information so as
43              to assemble a faulty array.
44
45
46       Build  Build an array that doesn't have  per-device  superblocks.   For
47              these  sorts  of arrays, mdadm cannot differentiate between ini‐
48              tial creation and subsequent assembly of an array.  It also can‐
49              not  perform  any  checks  that  appropriate  devices  have been
50              requested.  Because of this, the Build mode should only be  used
51              together with a complete understanding of what you are doing.
52
53
54       Create Create a new array with per-device superblocks.
55
56
57       Follow or Monitor
58              Monitor  one  or  more  md devices and act on any state changes.
59              This is only meaningful for raid1, 4,  5,  6,  10  or  multipath
60              arrays  as  only  these have interesting state.  raid0 or linear
61              never have missing, spare, or failed drives, so there is nothing
62              to monitor.
63
64
65       Grow   Grow  (or shrink) an array, or otherwise reshape it in some way.
66              Currently supported growth options including changing the active
67              size of component devices in RAID level 1/4/5/6 and changing the
68              number of active devices in RAID1/5/6.
69
70
71       Incremental Assembly
72              Add a single device to an appropriate array.  If the addition of
73              the  device makes the array runnable, the array will be started.
74              This provides a convenient interface to a hot-plug  system.   As
75              each  device  is  detected,  mdadm has a chance to include it in
76              some array as appropriate.
77
78
79       Manage This is for doing things to specific components of an array such
80              as adding new spares and removing faulty devices.
81
82
83       Misc   This  is  an  'everything else' mode that supports operations on
84              active arrays, operations on component devices such  as  erasing
85              old superblocks, and information gathering operations.
86
87
88       Auto-detect
89              This mode does not act on a specific device or array, but rather
90              it requests the  Linux  Kernel  to  activate  any  auto-detected
91              arrays.
92

OPTIONS

Options for selecting a mode are:

95       -A, --assemble
96              Assemble a pre-existing array.
97
98
99       -B, --build
100              Build a legacy array without superblocks.
101
102
103       -C, --create
104              Create a new array.
105
106
107       -F, --follow, --monitor
108              Select Monitor mode.
109
110
111       -G, --grow
112              Change the size or shape of an active array.
113
114
115       -I, --incremental
116              Add  a  single  device  into  an appropriate array, and possibly
117              start the array.
118
119
120       --auto-detect
121              Request that the kernel starts any auto-detected  arrays.   This
122              can only work if md is compiled into the kernel — not if it is a
123              module.  Arrays can be auto-detected by the kernel  if  all  the
124              components  are in primary MS-DOS partitions with partition type
125              FD.  In-kernel autodetect is not recommended for  new  installa‐
126              tions.   Using mdadm to detect and assemble arrays — possibly in
127              an initrd — is substantially more flexible and  should  be  pre‐
128              ferred.
129
130
131       If  a  device  is  given  before any options, or if the first option is
132       --add, --fail, or --remove, then the MANAGE mode is  assume.   Anything
133       other than these will cause the Misc mode to be assumed.
134
135

Options that are not mode-specific are:

137       -h, --help
138              Display general help message or, after one of the above options,
139              a mode specific help message.
140
141
142       --help-options
143              Display more detailed help about command line parsing  and  some
144              commonly used options.
145
146
147       -V, --version
148              Print version information for mdadm.
149
150
151       -v, --verbose
152              Be more verbose about what is happening.  This can be used twice
153              to be extra-verbose.  The extra verbosity currently only affects
154              --detail --scan and --examine --scan.
155
156
157       -q, --quiet
158              Avoid  printing  purely  informative messages.  With this, mdadm
159              will be silent unless there is  something  really  important  to
160              report.
161
162
163       -b, --brief
164              Be  less  verbose.   This  is  used with --detail and --examine.
165              Using --brief with --verbose gives an intermediate level of ver‐
166              bosity.
167
168
169       -f, --force
170              Be  more  forceful  about  certain  operations.  See the various
171              modes of the exact meaning of this option in different contexts.
172
173
174       -c, --config=
175              Specify the config file.  Default is to use /etc/mdadm.conf,  or
176              if  that  is missing, then /etc/mdadm/mdadm.conf.  If the config
177              file given is partitions then nothing will be  read,  but  mdadm
178              will act as though the config file contained exactly DEVICE par‐
179              titions and will read /proc/partitions to find a list of devices
180              to  scan.   If  the word none is given for the config file, then
181              mdadm will act as though the config file were empty.
182
183
184       -s, --scan
185              scan config file or /proc/mdstat for  missing  information.   In
186              general,  this  option gives mdadm permission to get any missing
187              information, like component devices, array devices, array  iden‐
188              tities,  and  alert  destination  from  the  configuration file:
189              /etc/mdadm.conf.  One exception is MISC mode when using --detail
190              or  --stop  in  which  case  --scan  says to get a list of array
191              devices from /proc/mdstat.
192
193
194       -e ,  --metadata=
195              Declare the style of superblock (raid metadata) to be used.  The
196              default is 0.90 for --create, and to guess for other operations.
197              The default can be overridden by setting the metadata value  for
198              the CREATE keyword in mdadm.conf.
199
200              Options are:
201
202              0, 0.90, default
203                     Use  the  original  0.90  format superblock.  This format
204                     limits arrays to 28 componenet devices and limits  compo‐
205                     nent devices of levels 1 and greater to 2 terabytes.
206
207              1, 1.0, 1.1, 1.2
208                     Use  the  new  version-1 format superblock.  This has few
209                     restrictions.   The  different   subversion   store   the
210                     superblock  at  different locations on the device, either
211                     at the end (for 1.0), at the start (for 1.1) or  4K  from
212                     the start (for 1.2).
213
214
215       --homehost=
216              This  will  override any HOMEHOST setting in the config file and
217              provides the identify of the host which should be considered the
218              home for any arrays.
219
220              When  creating  an  array,  the homehost will be recorded in the
221              superblock.  For version-1 superblocks, it will be  prefixed  to
222              the  array  name.  For version-0.90 superblocks part of the SHA1
223              hash of the hostname will be stored in the  later  half  of  the
224              UUID.
225
226              When  reporting  information  about an array, any array which is
227              tagged for the given homehost will be reported as such.
228
229              When using Auto-Assemble, only arrays tagged for the given home‐
230              host will be assembled.
231
232

For create, build, or grow:

234       -n, --raid-devices=
235              Specify  the  number of active devices in the array.  This, plus
236              the number of spare devices (see below) must equal the number of
237              component-devices  (including "missing" devices) that are listed
238              on the command line for --create.  Setting a value of 1 is prob‐
239              ably  a mistake and so requires that --force be specified first.
240              A value of 1 will then be allowed for linear,  multipath,  raid0
241              and raid1.  It is never allowed for raid4 or raid5.
242              This  number  can  only be changed using --grow for RAID1, RAID5
243              and RAID6 arrays, and only on kernels  which  provide  necessary
244              support.
245
246
247       -x, --spare-devices=
248              Specify  the  number  of  spare  (eXtra)  devices in the initial
249              array.  Spares can also be added and removed later.  The  number
250              of  component  devices listed on the command line must equal the
251              number of raid devices plus the number of spare devices.
252
253
254
255       -z, --size=
256              Amount (in Kibibytes)  of  space  to  use  from  each  drive  in
257              RAID1/4/5/6.   This  must  be  a multiple of the chunk size, and
258              must leave about 128Kb of space at the end of the drive for  the
259              RAID  superblock.   If  this is not specified (as it normally is
260              not) the smallest drive (or partition) sets the size, though  if
261              there is a variance among the drives of greater than 1%, a warn‐
262              ing is issued.
263
264              This value can be set with --grow for RAID level 1/4/5/6. If the
265              array  was created with a size smaller than the currently active
266              drives, the extra space can be accessed using --grow.  The  size
267              can  be given as max which means to choose the largest size that
268              fits on all current drives.
269
270
271       -c, --chunk=
272              Specify chunk size of kibibytes.  The default is 64.
273
274
275       --rounding=
276              Specify rounding factor for linear array (==chunk size)
277
278
279       -l, --level=
280              Set raid level.  When used with --create, options  are:  linear,
281              raid0,  0,  stripe, raid1, 1, mirror, raid4, 4, raid5, 5, raid6,
282              6, raid10, 10, multipath, mp, faulty.  Obviously some  of  these
283              are synonymous.
284
285              When  used  with  --build, only linear, stripe, raid0, 0, raid1,
286              multipath, mp, and faulty are valid.
287
288              Not yet supported with --grow.
289
290
291       -p, --layout=
292              This option configures the  fine  details  of  data  layout  for
293              raid5,  and  raid10  arrays,  and controls the failure modes for
294              faulty.
295
296              The layout of the raid5 parity block can be one of left-asymmet‐
297              ric,  left-symmetric, right-asymmetric, right-symmetric, la, ra,
298              ls, rs.  The default is left-symmetric.
299
300              When setting the  failure  mode  for  faulty  the  options  are:
301              write-transient,  wt,  read-transient, rt, write-persistent, wp,
302              read-persistent, rp, write-all, read-fixable, rf, clear,  flush,
303              none.
304
305              Each  mode can be followed by a number which is used as a period
306              between fault generation.  Without a number, the fault is gener‐
307              ated  once  on  the  first relevant request.  With a number, the
308              fault will be generated after that many request, and  will  con‐
309              tinue to be generated every time the period elapses.
310
311              Multiple  failure  modes  can be current simultaneously by using
312              the --grow option to set subsequent failure modes.
313
314              "clear" or "none" will remove any pending  or  periodic  failure
315              modes, and "flush" will clear any persistent faults.
316
317              To set the parity with --grow, the level of the array ("faulty")
318              must be specified before the fault mode is specified.
319
320              Finally, the layout options for RAID10 are one of  'n',  'o'  or
321              'f' followed by a small number.  The default is 'n2'.
322
323              n  signals  'near' copies. Multiple copies of one data block are
324              at similar offsets in different devices.
325
326              o signals 'offset' copies.  Rather than the chunks being  dupli‐
327              cated  within  a  stripe,  whole  stripes are duplicated but are
328              rotated by one device  so  duplicate  blocks  are  on  different
329              devices.   Thus  subsequent  copies  of  a block are in the next
330              drive, and are one chunk further down.
331
332              f signals 'far' copies (multiple copies have very different off‐
333              sets).  See md(4) for more detail about 'near' and 'far'.
334
335              The number is the number of copies of each datablock.  2 is nor‐
336              mal, 3 can be useful.  This number can be at most equal  to  the
337              number  of  devices  in  the  array.  It does not need to divide
338              evenly into that number (e.g. it is perfectly legal to  have  an
339              'n2' layout for an array with an odd number of devices).
340
341
342       --parity=
343              same as --layout (thus explaining the p of -p).
344
345
346       -b, --bitmap=
347              Specify  a  file  to  store  a write-intent bitmap in.  The file
348              should not exist unless --force is also given.   The  same  file
349              should  be  provided  when  assembling  the  array.  If the word
350              internal is given, then the bitmap is stored with  the  metadata
351              on  the array, and so is replicated on all devices.  If the word
352              none is given with --grow mode, then any bitmap that is  present
353              is removed.
354
355              To  help catch typing errors, the filename must contain at least
356              one slash ('/') if it is a real file (not 'internal' or 'none').
357
358              Note: external bitmaps are only known to work on ext2 and  ext3.
359              Storing  bitmap files on other filesystems may result in serious
360              problems.
361
362
363       --bitmap-chunk=
364              Set the chunksize of the bitmap. Each bit  corresponds  to  that
365              many  Kilobytes of storage.  When using a file based bitmap, the
366              default is to use the  smallest  size  that  is  atleast  4  and
367              requires  no more than 2^21 chunks.  When using an internal bit‐
368              map, the chunksize is automatically determined to make best  use
369              of available space.
370
371
372
373       -W, --write-mostly
374              subsequent  devices  lists in a --build, --create, or --add com‐
375              mand will be flagged as 'write-mostly'.  This is valid for RAID1
376              only  and  means  that  the  'md' driver will avoid reading from
377              these devices if at all possible.  This can be useful if mirror‐
378              ing over a slow link.
379
380
381       --write-behind=
382              Specify  that  write-behind  mode  should  be enabled (valid for
383              RAID1 only). If an argument is specified, it will set the  maxi‐
384              mum  number  of outstanding writes allowed. The default value is
385              256.  A write-intent bitmap is required in order to  use  write-
386              behind mode, and write-behind is only attempted on drives marked
387              as write-mostly.
388
389
390       --assume-clean
391              Tell mdadm that the array pre-existed and is known to be  clean.
392              It  can be useful when trying to recover from a major failure as
393              you can be sure that no data will be affected unless  you  actu‐
394              ally  write  to  the array.  It can also be used when creating a
395              RAID1 or RAID10 if you want to avoid the initial resync, however
396              this  practice — while normally safe — is not recommended.   Use
397              this ony if you really know what you are doing.
398
399
400       --backup-file=
401              This is needed when --grow is used to  increase  the  number  of
402              raid-devices  in  a  RAID5 if there  are no spare devices avail‐
403              able.  See the section below on RAID_DEVICE CHANGES.   The  file
404              should  be  stored  on  a separate device, not on the raid array
405              being reshaped.
406
407
408       -N, --name=
409              Set a name for the array.  This is currently only effective when
410              creating  an  array  with a version-1 superblock.  The name is a
411              simple textual string that can be used to identify array  compo‐
412              nents when assembling.
413
414
415       -R, --run
416              Insist  that mdadm run the array, even if some of the components
417              appear to be active in another array  or  filesystem.   Normally
418              mdadm will ask for confirmation before including such components
419              in an array.  This option causes that question to be suppressed.
420
421
422       -f, --force
423              Insist that mdadm accept the geometry and layout specified with‐
424              out  question.   Normally  mdadm  will  not allow creation of an
425              array with only one device, and will try to create a raid5 array
426              with  one  missing  drive (as this makes the initial resync work
427              faster).  With --force, mdadm will not try to be so clever.
428
429
430       -a, --auto{=no,yes,md,mdp,part,p}{NN}
431              Instruct mdadm to create the device  file  if  needed,  possibly
432              allocating an unused minor number.  "md" causes a non-partition‐
433              able array to be used.  "mdp", "part" or "p" causes a partition‐
434              able array (2.6 and later) to be used.  "yes" requires the named
435              md device to have a 'standard' format, and the  type  and  minor
436              number will be determined from this.  See DEVICE NAMES below.
437
438              The argument can also come immediately after "-a".  e.g. "-ap".
439
440              If  --auto  is  not  given  on the command line or in the config
441              file, then the default will be --auto=yes.
442
443              If --scan is also given, then any auto= entries  in  the  config
444              file  will  override the --auto instruction given on the command
445              line.
446
447              For partitionable arrays, mdadm will create the device file  for
448              the  whole  array  and  for the first 4 partitions.  A different
449              number of partitions can be specified at the end of this  option
450              (e.g.   --auto=p7).   If  the device name ends with a digit, the
451              partition names add a 'p', and a  number,  e.g.  "/dev/home1p3".
452              If  there  is  no  trailing digit, then the partition names just
453              have a number added, e.g. "/dev/scratch3".
454
455              If the md device name is in a 'standard' format as described  in
456              DEVICE  NAMES,  then  it will be created, if necessary, with the
457              appropriate number based on that name.  If the  device  name  is
458              not  in one of these formats, then a unused minor number will be
459              allocated.  The minor number will be considered unused if  there
460              is  no  active  array  for that number, and there is no entry in
461              /dev for that number and with a non-standard name.
462
463
464       --symlink=no
465              Normally when --auto causes mdadm to create devices in  /dev/md/
466              it will also create symlinks from /dev/ with names starting with
467              md or md_.  Use --symlink=no to suppress this, or  --symlink=yes
468              to enforce this even if it is suppressing mdadm.conf.
469
470
471

For assemble:

473       -u, --uuid=
474              uuid  of  array  to assemble. Devices which don't have this uuid
475              are excluded
476
477
478       -m, --super-minor=
479              Minor number of device that  array  was  created  for.   Devices
480              which  don't have this minor number are excluded.  If you create
481              an array as /dev/md1, then  all  superblocks  will  contain  the
482              minor  number  1,  even  if  the  array  is  later  assembled as
483              /dev/md2.
484
485              Giving the literal word "dev" for --super-minor will cause mdadm
486              to  use  the  minor number of the md device that is being assem‐
487              bled.  e.g. when assembling /dev/md0, will look for super blocks
488              with a minor number of 0.
489
490
491       -N, --name=
492              Specify  the  name  of  the array to assemble.  This must be the
493              name that was specified when creating the array.  It must either
494              match  then  name  stored  in the superblock exactly, or it must
495              match with the current homehost is added to  the  start  of  the
496              given name.
497
498
499       -f, --force
500              Assemble the array even if some superblocks appear out-of-date
501
502
503       -R, --run
504              Attempt  to start the array even if fewer drives were given than
505              were present last time the array was active.   Normally  if  not
506              all  the  expected drives are found and --scan is not used, then
507              the array will be assembled but  not  started.   With  --run  an
508              attempt will be made to start it anyway.
509
510
511       --no-degraded
512              This  is the reverse of --run in that it inhibits the started if
513              array unless all expected drives  are  present.   This  is  only
514              needed  with  --scan and can be used if you physical connections
515              to devices are not as reliable as you would like.
516
517
518       -a, --auto{=no,yes,md,mdp,part}
519              See this option under Create and Build options.
520
521
522       -b, --bitmap=
523              Specify the bitmap file that was given when the array  was  cre‐
524              ated.   If  an array has an internal bitmap, there is no need to
525              specify this when assembling the array.
526
527
528       --backup-file=
529              If --backup-file was used to grow the number of raid-devices  in
530              a  RAID5,  and  the  system crashed during the critical section,
531              then the same --backup-file must be presented to  --assemble  to
532              allow possibly corrupted data to be restored.
533
534
535       -U, --update=
536              Update the superblock on each device while assembling the array.
537              The argument given to this flag can be  one  of  sparc2.2,  sum‐
538              maries,  uuid, name, homehost, resync, byteorder, devicesize, or
539              super-minor.
540
541              The sparc2.2 option will adjust the superblock of an array  what
542              was  created on a Sparc machine running a patched 2.2 Linux ker‐
543              nel.  This kernel got the alignment of part  of  the  superblock
544              wrong.   You can use the --examine --sparc2.2 option to mdadm to
545              see what effect this would have.
546
547              The super-minor option will update the preferred minor field  on
548              each  superblock  to  match  the minor number of the array being
549              assembled.  This can be useful if --examine reports a  different
550              "Preferred  Minor"  to --detail.  In some cases this update will
551              be performed automatically by the kernel driver.  In  particular
552              the  update happens automatically at the first write to an array
553              with redundancy (RAID level 1 or greater) on a  2.6  (or  later)
554              kernel.
555
556              The uuid option will change the uuid of the array.  If a UUID is
557              given with the --uuid option that UUID will be  used  as  a  new
558              UUID  and  will  NOT be used to help identify the devices in the
559              array.  If no --uuid is given, a random UUID is chosen.
560
561              The name option will change the name of the array as  stored  in
562              the   superblock.    This   is   only  supported  for  version-1
563              superblocks.
564
565              The homehost option will change the homehost as recorded in  the
566              superblock.   For  version-0  superblocks,  this  is the same as
567              updating the UUID.  For  version-1  superblocks,  this  involves
568              updating the name.
569
570              The  resync option will cause the array to be marked dirty mean‐
571              ing that any redundancy in the array  (e.g.  parity  for  raid5,
572              copies  for  raid1)  may be incorrect.  This will cause the raid
573              system to perform a "resync" pass to make sure that  all  redun‐
574              dant information is correct.
575
576              The  byteorder option allows arrays to be moved between machines
577              with different byte-order.  When assembling such  an  array  for
578              the  first  time  after  a  move, giving --update=byteorder will
579              cause mdadm  to  expect  superblocks  to  have  their  byteorder
580              reversed,  and  will  correct  that  order before assembling the
581              array.   This  is  only  valid  with  original  (Version   0.90)
582              superblocks.
583
584              The   summaries   option  will  correct  the  summaries  in  the
585              superblock. That  is  the  counts  of  total,  working,  active,
586              failed, and spare devices.
587
588              The devicesize will rarely be of use.  It applies to version 1.1
589              and 1.2 metadata only (where the metadata is at the start of the
590              device) and is only useful when the component device has changed
591              size (typically become larger).  The version 1 metadata  records
592              the amount of the device that can be used to store data, so if a
593              device in a version 1.1 or 1.2 array becomes larger,  the  meta‐
594              data  will  still  be visible, but the extra space will not.  In
595              this case  it  might  be  useful  to  assemble  the  array  with
596              --update=devicesize.   This  will  cause  mdadm to determine the
597              maximum usable amount of space on each  device  and  update  the
598              relevant field in the metadata.
599
600
601       --auto-update-homehost
602              This  flag  is  only  meaning with auto-assembly (see discussion
603              below).  In that situation, if no suitable arrays are found  for
604              this  homehost,  mdadm will recan for any arrays at all and will
605              assemble them and update the homehost to match the current host.
606
607

For Manage mode:

609       -a, --add
610              hot-add listed devices.
611
612
613       --re-add
614              re-add a device that was recently removed from an array.
615
616
617       -r, --remove
618              remove listed devices.  They must  not  be  active.   i.e.  they
619              should  be  failed  or  spare devices.  As well as the name of a
620              device file (e.g.  /dev/sda1) the words failed and detached  can
621              be  given to --remove.  The first causes all failed device to be
622              removed.  The second causes any device which is no  longer  con‐
623              nected to the system (i.e and open returns ENXIO) to be removed.
624              This will only succeed for  devices  that  are  spares  or  have
625              already been marked as failed.
626
627
628       -f, --fail
629              mark  listed devices as faulty.  As well as the name of a device
630              file, the word detached can  be  given.   This  will  cause  any
631              device  that  has  been detached from the system to be marked as
632              failed.  It can then be removed.
633
634
635       --set-faulty
636              same as --fail.
637
638
639       Each of these options require that the first device list is  the  array
640       to  be  acted upon and the remainder are component devices to be added,
641       removed, or marked as fault.  Several different operations can be spec‐
642       ified for different devices, e.g.
643            mdadm /dev/md0 --add /dev/sda1 --fail /dev/sdb1 --remove /dev/sdb1
644       Each operation applies to all devices listed until the next operations.
645
646       If  an  array  is  using a write-intent bitmap, then devices which have
647       been removed can be re-added in a way that avoids a full reconstruction
648       but  instead just updated the blocks that have changed since the device
649       was removed.  For arrays with persistent metadata (superblocks) this is
650       done  automatically.  For arrays created with --build mdadm needs to be
651       told that this device we removed recently with --re-add.
652
653       Devices can only be removed from an array if they  are  not  in  active
654       use.   i.e. that must be spares or failed devices.  To remove an active
655       device, it must be marked as faulty first.
656
657

For Misc mode:

659       -Q, --query
660              Examine a device to see (1) if it is an md device and (2) if  it
661              is  a  component of an md array.  Information about what is dis‐
662              covered is presented.
663
664
665       -D, --detail
666              Print detail of one or more md devices.
667
668
669       -Y, --export
670              When used with --detail, output will be formatted  as  key=value
671              pairs for easy import into the environment.
672
673
674       -E, --examine
675              Print content of md superblock on device(s).
676
677       --sparc2.2
678              If  an array was created on a 2.2 Linux kernel patched with RAID
679              support, the superblock will have been created  incorrectly,  or
680              at  least  incompatibly  with  2.4 and later kernels.  Using the
681              --sparc2.2 flag with --examine will fix  the  superblock  before
682              displaying  it.  If this appears to do the right thing, then the
683              array   can   be   successfully   assembled   using   --assemble
684              --update=sparc2.2.
685
686
687       -X, --examine-bitmap
688              Report information about a bitmap file.
689
690
691       -R, --run
692              start a partially built array.
693
694
695       -S, --stop
696              deactivate array, releasing all resources.
697
698
699       -o, --readonly
700              mark array as readonly.
701
702
703       -w, --readwrite
704              mark array as readwrite.
705
706
707       --zero-superblock
708              If the device contains a valid md superblock, the block is over‐
709              written with zeros.  With --force the block where the superblock
710              would be is overwritten even if it doesn't appear to be valid.
711
712
713       -t, --test
714              When  used  with  --detail,  the  exit status of mdadm is set to
715              reflect the status of the device.
716
717
718       -W, --wait
719              For each md device given, wait  for  any  resync,  recovery,  or
720              reshape  activity to finish before returning.  mdadm will return
721              with success if it actually waited for every device listed, oth‐
722              erwise it will return failure.
723
724

For Incremental Assembly mode:

726       --rebuild-map, -r
727              Rebuild  the  map  file  (/var/run/mdadm/map) that mdadm uses to
728              help track which arrays are currently being assembled.
729
730
731       --run, -R
732              Run any array assembled as soon as a minimal number  of  devices
733              are  available,  rather  than waiting until all expected devices
734              are present.
735
736
737       --scan, -s
738              Only meaningful with -R this will scan the map file  for  arrays
739              that are being incrementally assembled and will try to start any
740              that are not already started.  If any such array  is  listed  in
741              mdadm.conf  as requiring an external bitmap, that bitmap will be
742              attached first.
743
744

For Monitor mode:

746       -m, --mail
747              Give a mail address to send alerts to.
748
749
750       -p, --program, --alert
751              Give a program to be run whenever an event is detected.
752
753
754       -y, --syslog
755              Cause all events to be reported through 'syslog'.  The  messages
756              have facility of 'daemon' and varying priorities.
757
758
759       -d, --delay
760              Give  a  delay  in  seconds.  mdadm polls the md arrays and then
761              waits this many seconds before polling again.  The default is 60
762              seconds.
763
764
765       -f, --daemonise
766              Tell  mdadm to run as a background daemon if it decides to moni‐
767              tor anything.  This causes it to fork and run in the child,  and
768              to disconnect form the terminal.  The process id of the child is
769              written to stdout.  This is useful with --scan which  will  only
770              continue  monitoring if a mail address or alert program is found
771              in the config file.
772
773
774       -i, --pid-file
775              When mdadm is running in daemon mode, write the pid of the  dae‐
776              mon  process  to  the  specified file, instead of printing it on
777              standard output.
778
779
780       -1, --oneshot
781              Check arrays only once.  This will generate NewArray events  and
782              more significantly DegradedArray and SparesMissing events.  Run‐
783              ning
784                      mdadm --monitor --scan -1
785              from a cron script  will  ensure  regular  notification  of  any
786              degraded arrays.
787
788
789       -t, --test
790              Generate  a  TestMessage alert for every array found at startup.
791              This alert gets mailed and passed to the  alert  program.   This
792              can  be  used for testing that alert message do get through suc‐
793              cessfully.
794
795

ASSEMBLE MODE

797       Usage: mdadm --assemble md-device options-and-component-devices...
798
799       Usage: mdadm --assemble --scan md-devices-and-options...
800
801       Usage: mdadm --assemble --scan options...
802
803
804       This usage assembles one or more raid arrays from  pre-existing  compo‐
805       nents.  For each array, mdadm needs to know the md device, the identity
806       of the array, and a number of component-devices. These can be found  in
807       a number of ways.
808
809       In  the first usage example (without the --scan) the first device given
810       is the md device.  In the second usage example, all devices listed  are
811       treated  as  md devices and assembly is attempted.  In the third (where
812       no devices are listed) all md devices that are listed in the configura‐
813       tion file are assembled.
814
815       If  precisely one device is listed, but --scan is not given, then mdadm
816       acts as though --scan was given and identify information  is  extracted
817       from the configuration file.
818
819       The   identity   can   be  given  with  the  --uuid  option,  with  the
820       --super-minor option, can be found  in the  config  file,  or  will  be
821       taken  from the super block on the first component-device listed on the
822       command line.
823
824       Devices can be given on the --assemble command line or  in  the  config
825       file. Only devices which have an md superblock which contains the right
826       identity will be considered for any array.
827
828       The config file is only used  if  explicitly  named  with  --config  or
829       requested  with  (a  possibly  implicit)  --scan.   In  the later case,
830       /etc/mdadm.conf is used.
831
832       If --scan is not given, then the config file will only be used to  find
833       the identity of md arrays.
834
835       Normally  the  array will be started after it is assembled.  However if
836       --scan is not given and insufficient drives were listed to start a com‐
837       plete  (non-degraded)  array,  then  the array is not started (to guard
838       against usage errors).  To insist that the array  be  started  in  this
839       case (as may work for RAID1, 4, 5, 6, or 10), give the --run flag.
840
841       If  the md device does not exist, then it will be created providing the
842       intent is clear. i.e. the name must be  in  a  standard  form,  or  the
843       --auto  option  must  be  given  to  clarify how and whether the device
844       should be created.
845
846       This can be useful for handling partitioned devices (which don't have a
847       stable  device  number  —  it can change after a reboot) and when using
848       "udev" to manage your /dev tree (udev cannot handle md devices  because
849       of the unusual device initialisation conventions).
850
851       If  the  option  to  "auto"  is "mdp" or "part" or (on the command line
852       only) "p", then mdadm will create  a  partitionable  array,  using  the
853       first  free  one that is not in use, and does not already have an entry
854       in /dev (apart from numeric /dev/md* entries).
855
856       If the option to "auto" is "yes" or "md" or (on the command line) noth‐
857       ing, then mdadm will create a traditional, non-partitionable md array.
858
859       It  is  expected  that  the "auto" functionality will be used to create
860       device  entries  with  meaningful  names  such  as  "/dev/md/home"   or
861       "/dev/md/root", rather than names based on the numerical array number.
862
863       When  using  this  option  to  create a partitionable array, the device
864       files for the first 4 partitions are also created. If a different  num‐
865       ber  is  required  it  can be simply appended to the auto option.  e.g.
866       "auto=part8".  Partition names are created by appending a digit  string
867       to  the  device  name,  with an intervening "p" if the device name ends
868       with a digit.
869
870       The --auto option is also available in  Build  and  Create  modes.   As
871       those  modes  do  not use a config file, the "auto=" config option does
872       not apply to these modes.
873
874
875   Auto Assembly
876       When --assemble is used with --scan and no devices  are  listed,  mdadm
877       will  first  attempt  to  assemble  all the arrays listed in the config
878       file.
879
880       If a homehost has been specified (either in the config file or  on  the
881       command line), mdadm will look further for possible arrays and will try
882       to assemble anything that it finds which is tagged as belonging to  the
883       given  homehost.   This is the only situation where mdadm will assemble
884       arrays without being given specific device name or identify information
885       for the array.
886
887       If  mdadm  finds a consistent set of devices that look like they should
888       comprise an array, and if the superblock is tagged as belonging to  the
889       given  home host, it will automatically choose a device name and try to
890       assemble the array.  If the array uses version-0.90 metadata, then  the
891       minor  number as recorded in the superblock is used to create a name in
892       /dev/md/ so for example /dev/md/3.  If the array uses  version-1  meta‐
893       data,  then  the name from the superblock is used to similarly create a
894       name in /dev/md.  The name will have any 'host' prefix stripped first.
895
896       If mdadm cannot find any array for  the  given  host  at  all,  and  if
897       --auto-update-homehost  is  given, then mdadm will search again for any
898       array (not just an array created for this host) and will assemble  each
899       assuming  --update=homehost.   This  will  change  the  host tag in the
900       superblock so that on the next run, these arrays will be found  without
901       the  second  pass.  The intention of this feature is to support transi‐
902       tioning a set of md arrays to using homehost tagging.
903
904       The reason for requiring arrays to be tagged with the homehost for auto
905       assembly  is  to  guard  against  problems  that  can arise when moving
906       devices from one host to another.
907
908

BUILD MODE

910       Usage:  mdadm  --build  device  --chunk=X  --level=Y   --raid-devices=Z
911                   devices
912
913
914       This  usage  is similar to --create.  The difference is that it creates
915       an array without a superblock. With these arrays there is no difference
916       between  initially  creating  the array and subsequently assembling the
917       array, except that hopefully there is useful data there in  the  second
918       case.
919
920       The level may raid0, linear, multipath, or faulty, or one of their syn‐
921       onyms. All devices must be listed and the array will  be  started  once
922       complete.
923
924

CREATE MODE

926       Usage: mdadm --create device --chunk=X --level=Y
927                   --raid-devices=Z devices
928
929
930       This  usage will initialise a new md array, associate some devices with
931       it, and activate the array.
932
933       If the --auto option is given (as described in more detail in the  sec‐
934       tion on Assemble mode), then the md device will be created with a suit‐
935       able device number if necessary.
936
937       As devices are added, they are checked to  see  if  they  contain  raid
938       superblocks  or  filesystems. They are also checked to see if the vari‐
939       ance in device size exceeds 1%.
940
941       If any discrepancy is found, the array will not automatically  be  run,
942       though the presence of a --run can override this caution.
943
944       To  create a "degraded" array in which some devices are missing, simply
945       give the word "missing" in place of a device  name.   This  will  cause
946       mdadm  to leave the corresponding slot in the array empty.  For a RAID4
947       or RAID5 array at most one slot can be "missing"; for a RAID6 array  at
948       most  two  slots.   For a RAID1 array, only one real device needs to be
949       given.  All of the others can be "missing".
950
951       When creating a RAID5 array, mdadm will automatically create a degraded
952       array  with  an  extra spare drive.  This is because building the spare
953       into a degraded array is in general faster than resyncing the parity on
954       a  non-degraded,  but not clean, array.  This feature can be overridden
955       with the --force option.
956
957       When creating an array with version-1 metadata a name for the  host  is
958       required.   If  this  is  not  given with the --name option, mdadm will
959       chose a name based on the last component of  the  name  of  the  device
960       being  created.   So if /dev/md3 is being created, then the name 3 will
961       be chosen.  If /dev/md/home is being created, then the name  home  will
962       be used.
963
964       A  new array will normally get a randomly assigned 128bit UUID which is
965       very likely to be unique.  If you have a specific need, you can  choose
966       a UUID for the array by giving the --uuid= option.  Be warned that cre‐
967       ating two arrays with the same UUID is a recipe  for  disaster.   Also,
968       using  --uuid=  when  creating a v0.90 array will silently override any
969       --homehost= setting.
970
971       The General Management options that are valid with --create are:
972
973       --run  insist on running the array even if some devices look like  they
974              might be in use.
975
976
977       --readonly
978              start the array readonly — not supported yet.
979
980
981

MANAGE MODE

983       Usage: mdadm device options... devices...
984
985       This  usage  will  allow  individual  devices in an array to be failed,
986       removed or added.  It is possible to perform multiple  operations  with
987       on command. For example:
988         mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 -a /dev/hda1
989       will  firstly mark /dev/hda1 as faulty in /dev/md0 and will then remove
990       it from the array and finally add it back in as a spare.  However  only
991       one md array can be affected by a single command.
992
993

MISC MODE

995       Usage: mdadm options ...  devices ...
996
997       MISC mode includes a number of distinct operations that operate on dis‐
998       tinct devices.  The operations are:
999
1000       --query
1001              The device is examined to see if it is (1) an active  md  array,
1002              or  (2)  a component of an md array.  The information discovered
1003              is reported.
1004
1005
1006       --detail
1007              The device should be an active md device.  mdadm will display  a
1008              detailed description of the array.  --brief or --scan will cause
1009              the output to be less detailed and the format to be suitable for
1010              inclusion  in  /etc/mdadm.conf.   The  exit status of mdadm will
1011              normally be 0 unless mdadm  failed  to  get  useful  information
1012              about  the  device(s).   However  if the --test option is given,
1013              then the exit status will be:
1014
1015              0      The array is functioning normally.
1016
1017              1      The array has at least one failed device.
1018
1019              2      The array has multiple failed devices  such  that  it  is
1020                     unusable.
1021
1022              4      There  was an error while trying to get information about
1023                     the device.
1024
1025
1026       --examine
1027              The device should be a component of an  md  array.   mdadm  will
1028              read  the  md superblock of the device and display the contents.
1029              If --brief is given, or --scan then multiple  devices  that  are
1030              components of the one array are grouped together and reported in
1031              a single entry suitable for inclusion in /etc/mdadm.conf.
1032
1033              Having --scan without listing any devices will cause all devices
1034              listed in the config file to be examined.
1035
1036
1037       --stop The  devices  should  be  active md arrays which will be deacti‐
1038              vated, as long as they are not currently in use.
1039
1040
1041       --run  This will fully activate a partially assembled md array.
1042
1043
1044       --readonly
1045              This will mark an active array as read-only, providing  that  it
1046              is not currently being used.
1047
1048
1049       --readwrite
1050              This will change a readonly array back to being read/write.
1051
1052
1053       --scan For all operations except --examine, --scan will cause the oper‐
1054              ation to be applied to all arrays listed in  /proc/mdstat.   For
1055              --examine,  --scan  causes all devices listed in the config file
1056              to be examined.
1057
1058
1059

MONITOR MODE

1061       Usage: mdadm --monitor options... devices...
1062
1063
1064       This usage causes mdadm to periodically poll a number of md arrays  and
1065       to report on any events noticed.  mdadm will never exit once it decides
1066       that there are arrays to be checked, so it should normally  be  run  in
1067       the background.
1068
1069       As  well  as  reporting  events,  mdadm may move a spare drive from one
1070       array to another if they are in the same spare-group and if the  desti‐
1071       nation array has a failed drive but no spares.
1072
1073       If  any devices are listed on the command line, mdadm will only monitor
1074       those devices. Otherwise all arrays listed in  the  configuration  file
1075       will  be  monitored.   Further,  if  --scan is given, then any other md
1076       devices that appear in /proc/mdstat will also be monitored.
1077
1078       The result of monitoring the arrays is the generation of events.  These
1079       events  are  passed  to  a  separate  program (if specified) and may be
1080       mailed to a given E-mail address.
1081
1082       When passing event to program, the program is run once for  each  event
1083       and  is  given 2 or 3 command-line arguments.  The first is the name of
1084       the event (see below).  The second is the name of the md  device  which
1085       is affected, and the third is the name of a related device if relevant,
1086       such as a component device that has failed.
1087
1088       If --scan is given, then a program or an E-mail address must be  speci‐
1089       fied  on the command line or in the config file.  If neither are avail‐
1090       able, then mdadm will not monitor anything.  Without --scan mdadm  will
1091       continue  monitoring  as long as something was found to monitor.  If no
1092       program or email is given, then each event is reported to stdout.
1093
1094       The different events are:
1095
1096
1097           DeviceDisappeared
1098                  An md array which previously was configured  appears  to  no
1099                  longer be configured. (syslog priority: Critical)
1100
1101                  If mdadm was told to monitor an array which is RAID0 or Lin‐
1102                  ear, then it will report DeviceDisappeared  with  the  extra
1103                  information  Wrong-Level.   This is because RAID0 and Linear
1104                  do not support the device-failed, hot-spare and resync oper‐
1105                  ations which are monitored.
1106
1107
1108           RebuildStarted
1109                  An  md array started reconstruction. (syslog priority: Warn‐
1110                  ing)
1111
1112
1113           RebuildNN
1114                  Where NN is 20, 40, 60, or 80, this indicates  that  rebuild
1115                  has passed that many percentage of the total. (syslog prior‐
1116                  ity: Warning)
1117
1118
1119           RebuildFinished
1120                  An md array that was  rebuilding,  isn't  any  more,  either
1121                  because  it finished normally or was aborted. (syslog prior‐
1122                  ity: Warning)
1123
1124
1125           Fail   An active component device of an array has  been  marked  as
1126                  faulty. (syslog priority: Critical)
1127
1128
1129           FailSpare
1130                  A  spare component device which was being rebuilt to replace
1131                  a faulty device has failed. (syslog priority: Critial)
1132
1133
1134           SpareActive
1135                  A spare component device which was being rebuilt to  replace
1136                  a  faulty  device has been successfully rebuilt and has been
1137                  made active.  (syslog priority: Info)
1138
1139
1140           NewArray
1141                  A new md array has been detected in the  /proc/mdstat  file.
1142                  (syslog priority: Info)
1143
1144
1145           DegradedArray
1146                  A  newly noticed array appears to be degraded.  This message
1147                  is not generated when mdadm notices a  drive  failure  which
1148                  causes  degradation,  but  only  when  mdadm notices that an
1149                  array is degraded when it first  sees  the  array.   (syslog
1150                  priority: Critial)
1151
1152
1153           MoveSpare
1154                  A spare drive has been moved from one array in a spare-group
1155                  to another to allow a failed drive to be replaced.   (syslog
1156                  priority: Info)
1157
1158
1159           SparesMissing
1160                  If  mdadm  has been told, via the config file, that an array
1161                  should have a certain number of  spare  devices,  and  mdadm
1162                  detects  that  it  has  fewer that this number when it first
1163                  sees the array, it  will  report  a  SparesMissing  message.
1164                  (syslog priority: Warning)
1165
1166
1167           TestMessage
1168                  An  array  was  found  at  startup,  and the --test flag was
1169                  given.  (syslog priority: Info)
1170
1171       Only Fail , FailSpare , DegradedArray , SparesMissing , and TestMessage
1172       cause  Email  to be sent.  All events cause the program to be run.  The
1173       program is run with two or three arguments, they being the event  name,
1174       the array device and possibly a second device.
1175
1176       Each event has an associated array device (e.g.  /dev/md1) and possibly
1177       a second device.  For  Fail,  FailSpare,  and  SpareActive  the  second
1178       device  is  the  relevant  component  device.  For MoveSpare the second
1179       device is the array that the spare was moved from.
1180
1181       For mdadm to move spares from  one  array  to  another,  the  different
1182       arrays  need to be labelled with the same spare-group in the configura‐
1183       tion file.  The spare-group name can be any string. It is  only  neces‐
1184       sary that different spare groups use different names.
1185
1186       When  mdadm  detects  that an array which is in a spare group has fewer
1187       active devices than necessary for the complete array, and has no  spare
1188       devices,  it  will  look for another array in the same spare group that
1189       has a full complement of working drive  and  a  spare.   It  will  then
1190       attempt  to  remove  the  spare from the second drive and add it to the
1191       first.  If the removal succeeds but the adding fails, then it is  added
1192       back to the original array.
1193
1194

GROW MODE

1196       The  GROW  mode  is  used  for  changing the size or shape of an active
1197       array.  For this to work, the kernel must support the necessary change.
1198       Various types of growth are being added during 2.6 development, includ‐
1199       ing restructuring a raid5 array to have more active devices.
1200
1201       Currently the only support available is to
1202
1203       ·   change the "size" attribute for RAID1, RAID5 and RAID6.
1204
1205       ·   increase the "raid-disks" attribute of RAID1, RAID5, and RAID6.
1206
1207       ·   add a write-intent bitmap to any array which support these bitmaps,
1208           or remove a write-intent bitmap from such an array.
1209
1210   SIZE CHANGES
1211       Normally  when  an array is built the "size" it taken from the smallest
1212       of the drives.  If all the small drives in an  arrays  are,  one  at  a
1213       time,  removed  and replaced with larger drives, then you could have an
1214       array of large drives with only a small amount used.   In  this  situa‐
1215       tion,  changing  the "size" with "GROW" mode will allow the extra space
1216       to start being used.  If the size is increased in this way, a  "resync"
1217       process will start to make sure the new parts of the array are synchro‐
1218       nised.
1219
1220       Note that when an array changes size, any filesystem that may be stored
1221       in  the  array  will  not  automatically  grow  to  use the space.  The
1222       filesystem will need to be explicitly told to use the extra space.
1223
1224
1225   RAID-DEVICES CHANGES
1226       A RAID1 array can work with  any  number  of  devices  from  1  upwards
1227       (though  1  is  not very useful).  There may be times which you want to
1228       increase or decrease the number of active devices.  Note that  this  is
1229       different to hot-add or hot-remove which changes the number of inactive
1230       devices.
1231
1232       When reducing the number of devices in a RAID1 array, the  slots  which
1233       are  to be removed from the array must already be vacant.  That is, the
1234       devices that which were in those slots must be failed and removed.
1235
1236       When the number of devices  is  increased,  any  hot  spares  that  are
1237       present will be activated immediately.
1238
1239       Increasing the number of active devices in a RAID5 is much more effort.
1240       Every block in the array will need to be read and written back to a new
1241       location.   From  2.6.17,  the  Linux Kernel is able to do this safely,
1242       including restart and interrupted "reshape".
1243
1244       When relocating the first few stripes on a raid5, it is not possible to
1245       keep  the  data on disk completely consistent and crash-proof.  To pro‐
1246       vide the required safety, mdadm disables writes to the array while this
1247       "critical  section" is reshaped, and takes a backup of the data that is
1248       in that section.  This backup is normally stored in any  spare  devices
1249       that  the  array  has, however it can also be stored in a separate file
1250       specified with the --backup-file option.  If this option is  used,  and
1251       the system does crash during the critical period, the same file must be
1252       passed to --assemble to restore the backup and reassemble the array.
1253
1254
1255   BITMAP CHANGES
1256       A write-intent bitmap can be added  to,  or  removed  from,  an  active
1257       array.   Either  internal bitmaps, or bitmaps stored in a separate file
1258       can be added.  Note that if you add a bitmap stored in a file which  is
1259       in  a  filesystem  that is on the raid array being affected, the system
1260       will deadlock.  The bitmap must be on a separate filesystem.
1261
1262

INCREMENTAL MODE

1264       Usage: mdadm --incremental [--run] [--quiet] component-device
1265
1266       Usage: mdadm --incremental --rebuild
1267
1268       Usage: mdadm --incremental --run --scan
1269
1270
1271
1272       This mode is designed to be used in conjunction with a device discovery
1273       system.   As devices are found in a system, they can be passed to mdadm
1274       --incremental to be conditionally added to an appropriate array.
1275
1276       mdadm performs a number of tests to determine if the device is part  of
1277       an  array,  and  which  array  is should be part of.  If an appropriate
1278       array is found, or can be created, mdadm adds the device to  the  array
1279       and conditionally starts the array.
1280
1281       Note that mdadm will only add devices to an array which were previously
1282       working (active or spare) parts of that array.  It does  not  currently
1283       support automatic inclusion of a new drive as a spare in some array.
1284
1285       mdadm  --incremental  requires  a  bug  present  in all kernels through
1286       2.6.19, to be fixed.  Hopefully this will be fixed in  2.6.20.   Alter‐
1287       nately  apply the patch which is included with the mdadm source distri‐
1288       bution.  If mdadm detects that this bug is present, it will  abort  any
1289       attempt to use --incremental.
1290
1291       The tests that mdadm makes are as follow:
1292
1293       +      Is the device permitted by mdadm.conf?  That is, is it listed in
1294              a DEVICES line in that file.  If  DEVICES  is  absent  then  the
1295              default it to allow any device.  Similar if DEVICES contains the
1296              special word partitions then any device is  allowed.   Otherwise
1297              the  device  name  given to mdadm must match one of the names or
1298              patterns in a DEVICES line.
1299
1300
1301       +      Does the device have a valid md superblock.  If a specific meta‐
1302              data  version  is  request  with --metadata or -e then only that
1303              style of metadata is accepted, otherwise mdadm finds  any  known
1304              version  of metadata.  If no md metadata is found, the device is
1305              rejected.
1306
1307
1308       +      Does the metadata match an expected  array?   The  metadata  can
1309              match  in  two  ways.   Either  there  is  an  array  listed  in
1310              mdadm.conf which identifies the array (either by UUID, by  name,
1311              by  device list, or by minor-number), the array was created with
1312              a homehost specified, and that homehost matches  that  which  is
1313              given  in  mdadm.conf  or  on the command line.  If mdadm is not
1314              able to positively identify the array as belonging to  the  cur‐
1315              rent host, the device will be rejected.
1316
1317
1318       +      mdadm  keeps  a  list  of arrays that is has partly assembled in
1319              /var/run/mdadm/map  (or  /var/run/mdadm.map  if  the   directory
1320              doesn't  exist).   If no array exists which matches the metadata
1321              on the new device, mdadm must choose a device name and unit num‐
1322              ber.   It does this based on any name given in mdadm.conf or any
1323              name information stored in the metadata.  If this name  suggests
1324              a  unit  number, that number will be used, otherwise a free unit
1325              number will be chosen.  Normally mdadm will prefer to  create  a
1326              partitionable  array,  however  if the CREATE line in mdadm.conf
1327              suggests that a non-partitionable array is preferred, that  will
1328              be honoured.
1329
1330
1331       +      Once  an appropriate array is found or created and the device is
1332              added, mdadm must decide if the array is ready  to  be  started.
1333              It  will  normally  compare  the number of available (non-spare)
1334              devices to the number of devices that the metadata suggests need
1335              to  be  active.  If there are at least that many, the array will
1336              be started.  This means that if  any  devices  are  missing  the
1337              array will not be restarted.
1338
1339              As  an  alternative,  --run may be passed to mdadm in which case
1340              the array will be run  as  soon  as  there  are  enough  devices
1341              present  for the data to be accessible.  For a raid1, that means
1342              one device will start the array.  For a clean raid5,  the  array
1343              will be started as soon as all but one drive is present.
1344
1345              Note that neither of these approaches is really ideal.  If it is
1346              can be known that all device discovery has completed, then
1347                 mdadm -IRs
1348              can be run which will try to start all  arrays  that  are  being
1349              incrementally  assembled.   They are started in "read-auto" mode
1350              in which they are read-only until the first write request.  This
1351              means that no metadata updates are made and no attempt at resync
1352              or recovery happens.  Further devices that are found before  the
1353              first write can still be added safely.
1354
1355

EXAMPLES

1357         mdadm --query /dev/name-of-device
1358       This  will  find  out  if a given device is a raid array, or is part of
1359       one, and will provide brief information about the device.
1360
1361         mdadm --assemble --scan
1362       This will assemble and start all arrays listed in the  standard  config
1363       file file.  This command will typically go in a system startup file.
1364
1365         mdadm --stop --scan
1366       This  will shut down all array that can be shut down (i.e. are not cur‐
1367       rently in use).  This will typically go in a system shutdown script.
1368
1369         mdadm --follow --scan --delay=120
1370       If (and only if) there is an Email address  or  program  given  in  the
1371       standard  config  file, then monitor the status of all arrays listed in
1372       that file by polling them ever 2 minutes.
1373
1374         mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1
1375       Create /dev/md0 as a RAID1 array consisting of /dev/hda1 and /dev/hdc1.
1376
1377         echo 'DEVICE /dev/hd*[0-9] /dev/sd*[0-9]' > mdadm.conf
1378         mdadm --detail --scan >> mdadm.conf
1379       This will create a  prototype  config  file  that  describes  currently
1380       active  arrays that are known to be made from partitions of IDE or SCSI
1381       drives.  This file should be reviewed before being used as it may  con‐
1382       tain unwanted detail.
1383
1384         echo 'DEVICE /dev/hd[a-z] /dev/sd*[a-z]' > mdadm.conf
1385          mdadm  --examine  --scan --config=mdadm.conf >> mdadm.conf This will
1386       find what arrays could be assembled from existing IDE  and  SCSI  whole
1387       drives  (not  partitions)  and store the information is the format of a
1388       config file.  This file is very likely to contain unwanted detail, par‐
1389       ticularly  the  devices=  entries.   It  should  be reviewed and edited
1390       before being used as an actual config file.
1391
1392         mdadm --examine --brief --scan --config=partitions
1393         mdadm -Ebsc partitions
1394       Create a list of devices by reading /proc/partitions,  scan  these  for
1395       RAID superblocks, and printout a brief listing of all that was found.
1396
1397         mdadm -Ac partitions -m 0 /dev/md0
1398       Scan all partitions and devices listed in /proc/partitions and assemble
1399       /dev/md0 out of all such devices with a RAID superblock  with  a  minor
1400       number of 0.
1401
1402         mdadm --monitor --scan --daemonise > /var/run/mdadm
1403       If  config  file contains a mail address or alert program, run mdadm in
1404       the background in monitor mode monitoring all md devices.   Also  write
1405       pid of mdadm daemon to /var/run/mdadm.
1406
1407         mdadm -Iq /dev/somedevice
1408       Try to incorporate newly discovered device into some array as appropri‐
1409       ate.
1410
1411         mdadm --incremental --rebuild --run --scan
1412       Rebuild the array map from any current arrays, and then start any  that
1413       can be started.
1414
1415         mdadm /dev/md4 --fail detached --remove detached
1416       Any  devices  which are components of /dev/md4 will be marked as faulty
1417       and then remove from the array.
1418
1419         mdadm --create --help
1420       Provide help about the Create mode.
1421
1422         mdadm --config --help
1423       Provide help about the format of the config file.
1424
1425         mdadm --help
1426       Provide general help.
1427
1428
1429

FILES

1431   /proc/mdstat
1432       If you're using the /proc filesystem, /proc/mdstat lists all active  md
1433       devices  with  information  about them.  mdadm uses this to find arrays
1434       when --scan is given in Misc mode, and to monitor array  reconstruction
1435       on Monitor mode.
1436
1437
1438
1439   /etc/mdadm.conf
1440       The  config file lists which devices may be scanned to see if they con‐
1441       tain MD super block, and  gives  identifying  information  (e.g.  UUID)
1442       about known MD arrays.  See mdadm.conf(5) for more details.
1443
1444
1445   /var/run/mdadm/map
1446       When  --incremental  mode is used. this file gets a list of arrays cur‐
1447       rently being created.  If /var/run/mdadm does not exist as a directory,
1448       then /var/run/mdadm.map is used instead.
1449
1450

DEVICE NAMES

1452       While entries in the /dev directory can have any format you like, mdadm
1453       has an understanding of 'standard' formats which it uses to  guide  its
1454       behaviour when creating device files via the --auto option.
1455
1456       The  standard  names  for  non-partitioned  arrays (the only sort of md
1457       array available in 2.4 and earlier) either of
1458
1459              /dev/mdNN
1460              /dev/md/NN
1461
1462       where NN is a number.  The standard names for partitionable arrays  (as
1463       available from 2.6 onwards) is one of
1464
1465              /dev/md/dNN
1466              /dev/md_dNN
1467
1468       Partition  numbers  should  be  indicated by added "pMM" to these, thus
1469       "/dev/md/d1p2".
1470
1471

NOTE

1473       mdadm was previously known as mdctl.
1474
1475       mdadm is completely separate from the raidtools package, and  does  not
1476       use the /etc/raidtab configuration file at all.
1477
1478

SEE ALSO

1480       For information on the various levels of RAID, check out:
1481
1482
1483              http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/
1484http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/⟩
1485
1486       The latest version of mdadm should always be available from
1487
1488              http://www.kernel.org/pub/linux/utils/raid/mdadm/
1489http://www.kernel.org/pub/linux/utils/raid/mdadm/
1490
1491       mdadm.conf(5), md(4).
1492
1493       raidtab(5), raid0run(8), raidstop(8), mkraid(8).
1494
1495
1496
1497v2.6.2                                                                MDADM(8)
Impressum