]> git.ipfire.org Git - thirdparty/mdadm.git/blame - mdadm.conf.5
Incremental: remove partitions when assembling.
[thirdparty/mdadm.git] / mdadm.conf.5
CommitLineData
519561f7
NB
1.\" Copyright Neil Brown and others.
2.\" This program is free software; you can redistribute it and/or modify
3.\" it under the terms of the GNU General Public License as published by
4.\" the Free Software Foundation; either version 2 of the License, or
5.\" (at your option) any later version.
6.\" See file COPYING in distribution for details.
56eb10c0
NB
7.TH MDADM.CONF 5
8.SH NAME
93e790af 9mdadm.conf \- configuration for management of Software RAID with mdadm
56eb10c0
NB
10.SH SYNOPSIS
11/etc/mdadm.conf
12.SH DESCRIPTION
13.PP
51ac42e3 14.I mdadm
11a3e71d 15is a tool for creating, managing, and monitoring RAID devices using the
56eb10c0
NB
16.B md
17driver in Linux.
18.PP
19Some common tasks, such as assembling all arrays, can be simplified
2d465520 20by describing the devices and arrays in this configuration file.
56eb10c0
NB
21
22.SS SYNTAX
23The file should be seen as a collection of words separated by white
24space (space, tab, or newline).
11a3e71d 25Any word that beings with a hash sign (#) starts a comment and that
2d465520 26word together with the remainder of the line is ignored.
56eb10c0 27
7df8a7b9
N
28Spaces can be included in a word using quotation characters. Either
29single quotes
30.RB ( ' )
31or double quotes (\fB"\fP)
32may be used. All the characters from one quotation character to
33next identical character are protected and will not be used to
34separate words to start new quoted strings. To include a single quote
35it must be between double quotes. To include a double quote it must
36be between single quotes.
37
2d465520 38Any line that starts with white space (space or tab) is treated as
56eb10c0
NB
39though it were a continuation of the previous line.
40
41Empty lines are ignored, but otherwise each (non continuation) line
2d465520 42must start with a keyword as listed below. The keywords are case
e0d19036 43insensitive and can be abbreviated to 3 characters.
56eb10c0
NB
44
45The keywords are:
46.TP
47.B DEVICE
48A
49.B device
50line lists the devices (whole devices or partitions) that might contain
51a component of an MD array. When looking for the components of an
52array,
51ac42e3 53.I mdadm
2d465520 54will scan these devices (or any devices listed on the command line).
56eb10c0
NB
55
56The
57.B device
58line may contain a number of different devices (separated by spaces)
59and each device name can contain wild cards as defined by
60.BR glob (7).
61
62Also, there may be several device lines present in the file.
63
5787fa49
NB
64Alternatively, a
65.B device
6c89c867 66line can contain either or both of the words
8fd8d9c4
N
67.B containers
68and
5787fa49 69.BR partitions .
8fd8d9c4
N
70The word
71.B containers
72will cause
73.I mdadm
74to look for assembled CONTAINER arrays and included them as a source
75for assembling further arrays.
e0fe762a 76
8fd8d9c4
N
77The word
78.I partitions
79will cause
5787fa49
NB
80.I mdadm
81to read
82.I /proc/partitions
35cc5be4 83and include all devices and partitions found therein.
5787fa49
NB
84.I mdadm
85does not use the names from
86.I /proc/partitions
87but only the major and minor device numbers. It scans
88.I /dev
89to find the name that matches the numbers.
90
8fd8d9c4 91If no DEVICE line is present, then "DEVICE partitions containers" is assumed.
a99d6b66 92
11a3e71d
NB
93For example:
94.IP
95DEVICE /dev/hda* /dev/hdc*
96.br
97DEV /dev/sd*
98.br
e0fe762a 99DEVICE /dev/disk/by-path/pci*
5787fa49
NB
100.br
101DEVICE partitions
11a3e71d 102
56eb10c0
NB
103.TP
104.B ARRAY
11a3e71d 105The ARRAY lines identify actual arrays. The second word on the line
8fd8d9c4 106may be the name of the device where the array is normally
11a3e71d 107assembled, such as
db2d001c
N
108.B /dev/md1
109or
110.BR /dev/md/backup .
111If the name does not start with a slash
112.RB (' / '),
113it is treated as being in
114.BR /dev/md/ .
112cace6
N
115Alternately the word
116.B <ignore>
117(complete with angle brackets) can be given in which case any array
118which matches the rest of the line will never be automatically assembled.
8fd8d9c4
N
119If no device name is given,
120.I mdadm
db2d001c 121will use various heuristics to determine an appropriate name.
e0fe762a 122
e0d19036
NB
123Subsequent words identify the array, or identify the array as a member
124of a group. If multiple identities are given,
2d465520
NB
125then a component device must match ALL identities to be considered a
126match. Each identity word has a tag, and equals sign, and some value.
127The tags are:
11a3e71d
NB
128.RS 4
129.TP
130.B uuid=
131The value should be a 128 bit uuid in hexadecimal, with punctuation
132interspersed if desired. This must match the uuid stored in the
133superblock.
134.TP
947fd4dd
NB
135.B name=
136The value should be a simple textual name as was given to
137.I mdadm
138when the array was created. This must match the name stored in the
139superblock on a device for that device to be included in the array.
35cc5be4 140Not all superblock formats support names.
947fd4dd 141.TP
7e23fc43 142.B super\-minor=
11a3e71d
NB
143The value is an integer which indicates the minor number that was
144stored in the superblock when the array was created. When an array is
145created as /dev/mdX, then the minor number X is stored.
146.TP
147.B devices=
56eedc1a
NB
148The value is a comma separated list of device names or device name
149patterns.
150Only devices with names which match one entry in the list will be used
151to assemble the array. Note that the devices
11a3e71d
NB
152listed there must also be listed on a DEVICE line.
153.TP
154.B level=
155The value is a raid level. This is not normally used to
156identify an array, but is supported so that the output of
157
7e23fc43 158.B "mdadm \-\-examine \-\-scan"
11a3e71d
NB
159
160can be use directly in the configuration file.
161.TP
7e23fc43 162.B num\-devices=
b83d95f3 163The value is the number of devices in a complete active array. As with
11a3e71d
NB
164.B level=
165this is mainly for compatibility with the output of
56eb10c0 166
7e23fc43 167.BR "mdadm \-\-examine \-\-scan" .
e0d19036 168
058574b1
NB
169.TP
170.B spares=
171The value is a number of spare devices to expect the array to have.
e0fe762a 172The sole use of this keyword and value is as follows:
7e23fc43 173.B mdadm \-\-monitor
058574b1
NB
174will report an array if it is found to have fewer than this number of
175spares when
7e23fc43 176.B \-\-monitor
058574b1 177starts or when
7e23fc43 178.B \-\-oneshot
058574b1
NB
179is used.
180
e0d19036 181.TP
7e23fc43 182.B spare\-group=
e0d19036
NB
183The value is a textual name for a group of arrays. All arrays with
184the same
7e23fc43 185.B spare\-group
e0d19036
NB
186name are considered to be part of the same group. The significance of
187a group of arrays is that
51ac42e3 188.I mdadm
e0d19036
NB
189will, when monitoring the arrays, move a spare drive from one array in
190a group to another array in that group if the first array had a failed
191or missing drive but no spare.
dd0781e5
NB
192
193.TP
194.B auto=
257c1dc2
N
195This option is rarely needed with mdadm-3.0, particularly if use with
196the Linux kernel v2.6.28 or later.
197It tells
51ac42e3 198.I mdadm
257c1dc2
N
199whether to use partitionable array or non-partitionable arrays and,
200in the absence of
201.IR udev ,
202how many partition devices to create. From 2.6.28 all md array
203devices are partitionable, hence this option is not needed.
dd0781e5
NB
204
205The value of this option can be "yes" or "md" to indicate that a
206traditional, non-partitionable md array should be created, or "mdp",
207"part" or "partition" to indicate that a partitionable md array (only
208available in linux 2.6 and later) should be used. This later set can
209also have a number appended to indicate how many partitions to create
210device files for, e.g.
211.BR auto=mdp5 .
212The default is 4.
7ef02d01
NB
213
214.TP
215.B bitmap=
216The option specifies a file in which a write-intent bitmap should be
217found. When assembling the array,
218.I mdadm
219will provide this file to the
220.B md
221driver as the bitmap file. This has the same function as the
7e23fc43 222.B \-\-bitmap\-file
7ef02d01 223option to
7e23fc43 224.BR \-\-assemble .
058574b1
NB
225
226.TP
227.B metadata=
228Specify the metadata format that the array has. This is mainly
229recognised for comparability with the output of
7e23fc43 230.BR "mdadm \-Es" .
058574b1 231
8fd8d9c4
N
232.TP
233.B container=
234Specify that this array is a member array of some container. The
235value given can be either a path name in /dev, or a UUID of the
236container array.
237
e0fe762a 238.TP
8fd8d9c4
N
239.B member=
240Specify that this array is a member array of some container. Each
241type of container has some way to enumerate member arrays, often a
242simple sequence number. The value identifies which member of a
e0fe762a 243container the array is. It will usually accompany a "container=" word.
11a3e71d 244.RE
e0d19036
NB
245
246.TP
247.B MAILADDR
248The
249.B mailaddr
250line gives an E-mail address that alerts should be
251sent to when
51ac42e3 252.I mdadm
e0d19036 253is running in
7e23fc43 254.B \-\-monitor
e0d19036 255mode (and was given the
7e23fc43 256.B \-\-scan
e0d19036
NB
257option). There should only be one
258.B MAILADDR
259line and it should have only one address.
260
261
4948b8f7
NB
262.TP
263.B MAILFROM
264The
265.B mailfrom
93e790af 266line (which can only be abbreviated to at least 5 characters) gives an
4948b8f7
NB
267address to appear in the "From" address for alert mails. This can be
268useful if you want to explicitly set a domain, as the default from
269address is "root" with no domain. All words on this line are
270catenated with spaces to form the address.
271
272Note that this value cannot be set via the
273.I mdadm
274commandline. It is only settable via the config file.
275
e0d19036
NB
276.TP
277.B PROGRAM
278The
279.B program
280line gives the name of a program to be run when
7e23fc43 281.B "mdadm \-\-monitor"
e0d19036
NB
282detects potentially interesting events on any of the arrays that it
283is monitoring. This program gets run with two or three arguments, they
284being the Event, the md device, and possibly the related component
285device.
286
287There should only be one
288.B program
289line and it should be give only one program.
290
5bbb4842
NB
291
292.TP
293.B CREATE
294The
295.B create
058574b1 296line gives default values to be used when creating arrays and device entries for
5bbb4842
NB
297arrays.
298These include:
299
300.RS 4
301.TP
302.B owner=
303.TP
304.B group=
305These can give user/group ids or names to use instead of system
306defaults (root/wheel or root/disk).
307.TP
308.B mode=
309An octal file mode such as 0660 can be given to override the default
310of 0600.
311.TP
312.B auto=
313This corresponds to the
7e23fc43 314.B \-\-auto
5bbb4842
NB
315flag to mdadm. Give
316.BR yes ,
317.BR md ,
318.BR mdp ,
319.B part
b3f1c093 320\(em possibly followed by a number of partitions \(em to indicate how
5bbb4842
NB
321missing device entries should be created.
322
058574b1
NB
323.TP
324.B metadata=
325The name of the metadata format to use if none is explicitly given.
326This can be useful to impose a system-wide default of version-1 superblocks.
327
38098016
NB
328.TP
329.B symlinks=no
330Normally when creating devices in
331.B /dev/md/
332.I mdadm
333will create a matching symlink from
334.B /dev/
335with a name starting
336.B md
337or
338.BR md_ .
339Give
16c4849b 340.B symlinks=no
38098016 341to suppress this symlink creation.
5bbb4842
NB
342.RE
343
6d6de2ee
NB
344.TP
345.B HOMEHOST
346The
347.B homehost
348line gives a default value for the
d1d3482b 349.B \-\-homehost=
e0fe762a 350option to mdadm. There should normally be only one other word on the line.
0ac91628 351It should either be a host name, or one of the special words
0f23aa88
N
352.BR <system>,
353.B <none>
0ac91628
N
354and
355.BR <ignore> .
6d6de2ee
NB
356If
357.B <system>
358is given, then the
359.BR gethostname ( 2 )
0f23aa88 360systemcall is used to get the host name. This is the default.
5bbb4842 361
0ac91628
N
362If
363.B <ignore>
364is given, then a flag is set so that when arrays are being
e0fe762a 365auto-assembled the checking of the recorded
0ac91628
N
366.I homehost
367is disabled.
e0fe762a
N
368If
369.B <ignore>
370is given it is also possible to give an explicit name which will be
371used when creating arrays. This is the only case when there can be
372more that one other word on the
373.B HOMEHOST
374line.
0ac91628 375
0f23aa88
N
376If
377.B <none>
378is given, then the default of using
379.BR gethostname ( 2 )
380is over-ridden and no homehost name is assumed.
381
0ac91628
N
382When arrays are created, this host name will be stored in the
383metadata. When arrays are assembled using auto-assembly, arrays which
384do not record the correct homehost name in their metadata will be
e0fe762a
N
385assembled using a "foreign" name. A "foreign" name alway ends with a
386digit string preceded by an underscore to differentiate it
0ac91628
N
387from any possible local name. e.g.
388.B /dev/md/1_1
389or
e0fe762a 390.BR /dev/md/home_0 .
31015d57
N
391.TP
392.B AUTO
393A list of names of metadata format can be given, each preceded by a
394plus or minus sign. Also the word
d1d3482b
N
395.I homehost
396is allowed as is
397.I all
398preceded by plus or minus sign.
31015d57 399.I all
d1d3482b 400is usually last.
31015d57
N
401
402When
403.I mdadm
a1331cc4 404is auto-assembling an array, either via
d1d3482b 405.I \-\-assemble
31015d57 406or
d1d3482b 407.I \-\-incremental
31015d57
N
408and it finds metadata of a given type, it checks that metadata type
409against those listed in this line. The first match wins, where
410.I all
411matches anything.
412If a match is found that was preceded by a plus sign, the auto
413assembly is allowed. If the match was preceded by a minus sign, the
414auto assembly is disallowed. If no match is found, the auto assembly
415is allowed.
416
d1d3482b
N
417If the metadata indicates that the array was created for
418.I this
419host, and the word
420.I homehost
421appears before any other match, then the array is treated as a valid
422candidate for auto-assembly.
423
31015d57
N
424This can be used to disable all auto-assembly (so that only arrays
425explicitly listed in mdadm.conf or on the command line are assembled),
426or to disable assembly of certain metadata types which might be
d1d3482b
N
427handled by other software. It can also be used to disable assembly of
428all foreign arrays - normally such arrays are assembled but given a
429non-deterministic name in
430.BR /dev/md/ .
31015d57
N
431
432The known metadata types are
433.BR 0.90 ,
434.BR 1.x ,
435.BR ddf ,
436.BR imsm .
437
210597d1
PC
438.TP
439.B POLICY
87eb4fab
N
440This is used to specify what automatic behavior is allowed on devices
441newly appearing in the system and provides a way of marking spares that can
442be moved to other arrays as well as the migration domains.
210597d1
PC
443.I Domain
444can be defined through
445.I policy
446line by specifying a domain name for a number of paths from
447.BR /dev/disk/by-path/ .
87eb4fab
N
448A device may belong to several domains. The domain of an array is a union
449of domains of all devices in that array. A spare can be automatically
210597d1
PC
450moved from one array to another if the set of the destination array's
451.I domains
b601104e 452ppcontains all the
210597d1
PC
453.I domains
454of the new disk or if both arrays have the same
455.IR spare-group .
456
457To update hot plug configuration it is necessary to execute
458.B mdadm \-\-udev\-rules
87eb4fab 459command after changing the config file
210597d1 460
87eb4fab 461Key words used in the
210597d1 462.I POLICY
87eb4fab 463line and supported values are:
210597d1
PC
464
465.RS 7
466.TP
467.B domain=
468any arbitrary string
469.TP
470.B metadata=
4710.9 1.x ddf or imsm
472.TP
473.B path=
474file glob matching anything from
475.B /dev/disk/by-path
b601104e 476.TP
87eb4fab
N
477.B type=
478either
479.B disk
480or
481.BR part .
210597d1
PC
482.TP
483.B action=
484include, re-add, spare, spare-same-slot, or force-spare
b601104e
LD
485.B auto=
486yes, no, or homehost.
210597d1
PC
487
488.P
489The
490.I action
491item determines the automatic behavior allowed for devices matching the
492.I path
87eb4fab
N
493and
494.I type
495in the same line. If a device matches several lines with different
210597d1
PC
496.I actions
497then the most permissive will apply. The ordering of policy lines
498is irrelevant to the end result.
499.TP
500.B include
501allows adding a disk to an array if metadata on that disk matches that array
502.TP
e31dec22 503.B re\-add
87eb4fab 504will include the device in the array if it appears to be a current member
e31dec22
N
505or a member that was recently removed and the array has a
506write-intent-bitmap to allow the
507.B re\-add
508functionality.
210597d1
PC
509.TP
510.B spare
87eb4fab
N
511as above and additionally: if the device is bare it can
512become a spare if there is any array that it is a candidate for based
513on domains and metadata.
210597d1
PC
514.TP
515.B spare\-same\-slot
516as above and additionally if given slot was used by an array that went
517degraded recently and the device plugged in has no metadata then it will
518be automatically added to that array (or it's container)
519.TP
e31dec22 520.B force\-spare
210597d1
PC
521as above and the disk will become a spare in remaining cases
522.RE
523
2d465520
NB
524.SH EXAMPLE
525DEVICE /dev/sd[bcdjkl]1
526.br
527DEVICE /dev/hda1 /dev/hdb1
528
0e69da72 529# /dev/md0 is known by its UUID.
2d465520
NB
530.br
531ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
532.br
533# /dev/md1 contains all devices with a minor number of
534.br
535# 1 in the superblock.
536.br
537ARRAY /dev/md1 superminor=1
538.br
93e790af 539# /dev/md2 is made from precisely these two devices
2d465520 540.br
a9d69660 541ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1
2d465520
NB
542
543# /dev/md4 and /dev/md5 are a spare-group and spares
544.br
545# can be moved between them
546.br
547ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df
548.br
7e23fc43 549 spare\-group=group1
2d465520
NB
550.br
551ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977
552.br
7e23fc43 553 spare\-group=group1
dd0781e5
NB
554.br
555# /dev/md/home is created if need to be a partitionable md array
556.br
557# any spare device number is allocated.
558.br
559ARRAY /dev/md/home UUID=9187a482:5dde19d9:eea3cc4a:d646ab8b
560.br
561 auto=part
210597d1 562.br
7df8a7b9
N
563# The name of this array contains a space.
564.br
565ARRAY /dev/md9 name='Data Storage'
566.sp
210597d1
PC
567POLICY domain=domain1 metadata=imsm path=pci-0000:00:1f.2-scsi-*
568.br
569 action=spare
570.br
571POLICY domain=domain1 metadata=imsm path=pci-0000:04:00.0-scsi-[01]*
572.br
573 action=include
574.br
575# One domain comprising of devices attached to specified paths is defined.
576.br
577# Bare device matching first path will be made an imsm spare on hot plug.
578.br
579# If more than one array is created on devices belonging to domain1 and
580.br
581# one of them becomes degraded, then any imsm spare matching any path for
582.br
583# given domain name can be migrated.
584.br
2d465520
NB
585MAILADDR root@mydomain.tld
586.br
7e23fc43 587PROGRAM /usr/sbin/handle\-mdadm\-events
5bbb4842 588.br
7e23fc43 589CREATE group=system mode=0640 auto=part\-8
41a3b72a
NB
590.br
591HOMEHOST <system>
31015d57 592.br
dae45415 593AUTO +1.x homehost \-all
e0d19036 594
56eb10c0 595.SH SEE ALSO
11a3e71d
NB
596.BR mdadm (8),
597.BR md (4).
56eb10c0 598