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