]> git.ipfire.org Git - thirdparty/mdadm.git/blob - mdadm.conf.5.in
mdadm: Update config man regarding default files and multi-keyword behavior
[thirdparty/mdadm.git] / mdadm.conf.5.in
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.
7 .TH MDADM.CONF 5
8 .SH NAME
9 mdadm.conf \- configuration for management of Software RAID with mdadm
10 .SH SYNOPSIS
11 {CONFFILE}
12 .SH DESCRIPTION
13 .PP
14 .I mdadm
15 is a tool for creating, managing, and monitoring RAID devices using the
16 .B md
17 driver in Linux.
18 .PP
19 Some common tasks, such as assembling all arrays, can be simplified
20 by describing the devices and arrays in this configuration file.
21
22 .SS SYNTAX
23 The file should be seen as a collection of words separated by white
24 space (space, tab, or newline).
25 Any word that beings with a hash sign (#) starts a comment and that
26 word together with the remainder of the line is ignored.
27
28 Spaces can be included in a word using quotation characters. Either
29 single quotes
30 .RB ( ' )
31 or double quotes (\fB"\fP)
32 may be used. All the characters from one quotation character to
33 next identical character are protected and will not be used to
34 separate words to start new quoted strings. To include a single quote
35 it must be between double quotes. To include a double quote it must
36 be between single quotes.
37
38 Any line that starts with white space (space or tab) is treated as
39 though it were a continuation of the previous line.
40
41 Empty lines are ignored, but otherwise each (non continuation) line
42 must start with a keyword as listed below. The keywords are case
43 insensitive and can be abbreviated to 3 characters.
44
45 The keywords are:
46 .TP
47 .B DEVICE
48 A
49 .B device
50 line lists the devices (whole devices or partitions) that might contain
51 a component of an MD array. When looking for the components of an
52 array,
53 .I mdadm
54 will scan these devices (or any devices listed on the command line).
55
56 The
57 .B device
58 line may contain a number of different devices (separated by spaces)
59 and each device name can contain wild cards as defined by
60 .BR glob (7).
61
62 Also, there may be several device lines present in the file.
63
64 Alternatively, a
65 .B device
66 line can contain either or both of the words
67 .B containers
68 and
69 .BR partitions .
70 The word
71 .B containers
72 will cause
73 .I mdadm
74 to look for assembled CONTAINER arrays and included them as a source
75 for assembling further arrays.
76
77 The word
78 .I partitions
79 will cause
80 .I mdadm
81 to read
82 .I /proc/partitions
83 and include all devices and partitions found therein.
84 .I mdadm
85 does not use the names from
86 .I /proc/partitions
87 but only the major and minor device numbers. It scans
88 .I /dev
89 to find the name that matches the numbers.
90
91 If no DEVICE line is present in any config file,
92 then "DEVICE partitions containers" is assumed.
93
94 For example:
95 .IP
96 DEVICE /dev/hda* /dev/hdc*
97 .br
98 DEV /dev/sd*
99 .br
100 DEVICE /dev/disk/by-path/pci*
101 .br
102 DEVICE partitions
103
104 .TP
105 .B ARRAY
106 The ARRAY lines identify actual arrays. The second word on the line
107 may be the name of the device where the array is normally
108 assembled, such as
109 .B /dev/md1
110 or
111 .BR /dev/md/backup .
112 If the name does not start with a slash
113 .RB (' / '),
114 it is treated as being in
115 .BR /dev/md/ .
116 Alternately the word
117 .B <ignore>
118 (complete with angle brackets) can be given in which case any array
119 which matches the rest of the line will never be automatically assembled.
120 If no device name is given,
121 .I mdadm
122 will use various heuristics to determine an appropriate name.
123
124 Subsequent words identify the array, or identify the array as a member
125 of a group. If multiple identities are given,
126 then a component device must match ALL identities to be considered a
127 match. Each identity word has a tag, and equals sign, and some value.
128 The tags are:
129 .RS 4
130 .TP
131 .B uuid=
132 The value should be a 128 bit uuid in hexadecimal, with punctuation
133 interspersed if desired. This must match the uuid stored in the
134 superblock.
135 .TP
136 .B name=
137 The value should be a simple textual name as was given to
138 .I mdadm
139 when the array was created. This must match the name stored in the
140 superblock on a device for that device to be included in the array.
141 Not all superblock formats support names.
142 .TP
143 .B super\-minor=
144 The value is an integer which indicates the minor number that was
145 stored in the superblock when the array was created. When an array is
146 created as /dev/mdX, then the minor number X is stored.
147 .TP
148 .B devices=
149 The value is a comma separated list of device names or device name
150 patterns.
151 Only devices with names which match one entry in the list will be used
152 to assemble the array. Note that the devices
153 listed there must also be listed on a DEVICE line.
154 .TP
155 .B level=
156 The value is a RAID level. This is not normally used to
157 identify an array, but is supported so that the output of
158
159 .B "mdadm \-\-examine \-\-scan"
160
161 can be use directly in the configuration file.
162 .TP
163 .B num\-devices=
164 The value is the number of devices in a complete active array. As with
165 .B level=
166 this is mainly for compatibility with the output of
167
168 .BR "mdadm \-\-examine \-\-scan" .
169
170 .TP
171 .B spares=
172 The value is a number of spare devices to expect the array to have.
173 The sole use of this keyword and value is as follows:
174 .B mdadm \-\-monitor
175 will report an array if it is found to have fewer than this number of
176 spares when
177 .B \-\-monitor
178 starts or when
179 .B \-\-oneshot
180 is used.
181
182 .TP
183 .B spare\-group=
184 The value is a textual name for a group of arrays. All arrays with
185 the same
186 .B spare\-group
187 name are considered to be part of the same group. The significance of
188 a group of arrays is that
189 .I mdadm
190 will, when monitoring the arrays, move a spare drive from one array in
191 a group to another array in that group if the first array had a failed
192 or missing drive but no spare.
193
194 .TP
195 .B auto=
196 This option is rarely needed with mdadm-3.0, particularly if use with
197 the Linux kernel v2.6.28 or later.
198 It tells
199 .I mdadm
200 whether to use partitionable array or non-partitionable arrays and,
201 in the absence of
202 .IR udev ,
203 how many partition devices to create. From 2.6.28 all md array
204 devices are partitionable, hence this option is not needed.
205
206 The value of this option can be "yes" or "md" to indicate that a
207 traditional, non-partitionable md array should be created, or "mdp",
208 "part" or "partition" to indicate that a partitionable md array (only
209 available in linux 2.6 and later) should be used. This later set can
210 also have a number appended to indicate how many partitions to create
211 device files for, e.g.
212 .BR auto=mdp5 .
213 The default is 4.
214
215 .TP
216 .B bitmap=
217 The option specifies a file in which a write-intent bitmap should be
218 found. When assembling the array,
219 .I mdadm
220 will provide this file to the
221 .B md
222 driver as the bitmap file. This has the same function as the
223 .B \-\-bitmap\-file
224 option to
225 .BR \-\-assemble .
226
227 .TP
228 .B metadata=
229 Specify the metadata format that the array has. This is mainly
230 recognised for comparability with the output of
231 .BR "mdadm \-Es" .
232
233 .TP
234 .B container=
235 Specify that this array is a member array of some container. The
236 value given can be either a path name in /dev, or a UUID of the
237 container array.
238
239 .TP
240 .B member=
241 Specify that this array is a member array of some container. Each
242 type of container has some way to enumerate member arrays, often a
243 simple sequence number. The value identifies which member of a
244 container the array is. It will usually accompany a "container=" word.
245 .RE
246
247 .TP
248 .B MAILADDR
249 The
250 .B mailaddr
251 line gives an E-mail address that alerts should be
252 sent to when
253 .I mdadm
254 is running in
255 .B \-\-monitor
256 mode (and was given the
257 .B \-\-scan
258 option). There should only be one
259 .B MAILADDR
260 line and it should have only one address. Any subsequent addresses
261 are silently ignored.
262
263 .TP
264 .B MAILFROM
265 The
266 .B mailfrom
267 line (which can only be abbreviated to at least 5 characters) gives an
268 address to appear in the "From" address for alert mails. This can be
269 useful if you want to explicitly set a domain, as the default from
270 address is "root" with no domain. All words on this line are
271 catenated with spaces to form the address.
272
273 Note that this value cannot be set via the
274 .I mdadm
275 commandline. It is only settable via the config file.
276 There should only be one
277 .B MAILADDR
278 line and it should have only one address. Any subsequent addresses
279 are silently ignored.
280
281 .TP
282 .B PROGRAM
283 The
284 .B program
285 line gives the name of a program to be run when
286 .B "mdadm \-\-monitor"
287 detects potentially interesting events on any of the arrays that it
288 is monitoring. This program gets run with two or three arguments, they
289 being the Event, the md device, and possibly the related component
290 device.
291
292 There should only be one
293 .B program
294 line and it should be given only one program. Any subsequent programs
295 are silently ignored.
296
297
298 .TP
299 .B CREATE
300 The
301 .B create
302 line gives default values to be used when creating arrays, new members
303 of arrays, and device entries for arrays.
304
305 There should only be one
306 .B create
307 line. Any subsequent lines will override the previous settings.
308
309 Keywords used in the
310 .I CREATE
311 line and supported values are:
312
313 .RS 4
314 .TP
315 .B owner=
316 .TP
317 .B group=
318 These can give user/group ids or names to use instead of system
319 defaults (root/wheel or root/disk).
320 .TP
321 .B mode=
322 An octal file mode such as 0660 can be given to override the default
323 of 0600.
324 .TP
325 .B auto=
326 This corresponds to the
327 .B \-\-auto
328 flag to mdadm. Give
329 .BR yes ,
330 .BR md ,
331 .BR mdp ,
332 .B part
333 \(em possibly followed by a number of partitions \(em to indicate how
334 missing device entries should be created.
335
336 .TP
337 .B metadata=
338 The name of the metadata format to use if none is explicitly given.
339 This can be useful to impose a system-wide default of version-1 superblocks.
340
341 .TP
342 .B symlinks=no
343 Normally when creating devices in
344 .B /dev/md/
345 .I mdadm
346 will create a matching symlink from
347 .B /dev/
348 with a name starting
349 .B md
350 or
351 .BR md_ .
352 Give
353 .B symlinks=no
354 to suppress this symlink creation.
355
356 .TP
357 .B names=yes
358 Since Linux 2.6.29 it has been possible to create
359 .B md
360 devices with a name like
361 .B md_home
362 rather than just a number, like
363 .BR md3 .
364 .I mdadm
365 will use the numeric alternative by default as other tools that interact
366 with md arrays may expect only numbers.
367 If
368 .B names=yes
369 is given in
370 .I mdadm.conf
371 then
372 .I mdadm
373 will use a name when appropriate.
374 If
375 .B names=no
376 is given, then non-numeric
377 .I md
378 device names will not be used even if the default changes in a future
379 release of
380 .IR mdadm .
381
382 .TP
383 .B bbl=no
384 By default,
385 .I mdadm
386 will reserve space for a bad block list (bbl) on all devices
387 included in or added to any array that supports them. Setting
388 .B bbl=no
389 will prevent this, so newly added devices will not have a bad
390 block log.
391 .RE
392
393 .TP
394 .B HOMEHOST
395 The
396 .B homehost
397 line gives a default value for the
398 .B \-\-homehost=
399 option to mdadm. There should normally be only one other word on the line.
400 It should either be a host name, or one of the special words
401 .BR <system>,
402 .B <none>
403 and
404 .BR <ignore> .
405 If
406 .B <system>
407 is given, then the
408 .BR gethostname ( 2 )
409 systemcall is used to get the host name. This is the default.
410
411 If
412 .B <ignore>
413 is given, then a flag is set so that when arrays are being
414 auto-assembled the checking of the recorded
415 .I homehost
416 is disabled.
417 If
418 .B <ignore>
419 is given it is also possible to give an explicit name which will be
420 used when creating arrays. This is the only case when there can be
421 more that one other word on the
422 .B HOMEHOST
423 line. If there are other words, or other
424 .B HOMEHOST
425 lines, they are silently ignored.
426
427 If
428 .B <none>
429 is given, then the default of using
430 .BR gethostname ( 2 )
431 is over-ridden and no homehost name is assumed.
432
433 When arrays are created, this host name will be stored in the
434 metadata. When arrays are assembled using auto-assembly, arrays which
435 do not record the correct homehost name in their metadata will be
436 assembled using a "foreign" name. A "foreign" name alway ends with a
437 digit string preceded by an underscore to differentiate it
438 from any possible local name. e.g.
439 .B /dev/md/1_1
440 or
441 .BR /dev/md/home_0 .
442 .TP
443 .B AUTO
444 A list of names of metadata format can be given, each preceded by a
445 plus or minus sign. Also the word
446 .I homehost
447 is allowed as is
448 .I all
449 preceded by plus or minus sign.
450 .I all
451 is usually last.
452
453 When
454 .I mdadm
455 is auto-assembling an array, either via
456 .I \-\-assemble
457 or
458 .I \-\-incremental
459 and it finds metadata of a given type, it checks that metadata type
460 against those listed in this line. The first match wins, where
461 .I all
462 matches anything.
463 If a match is found that was preceded by a plus sign, the auto
464 assembly is allowed. If the match was preceded by a minus sign, the
465 auto assembly is disallowed. If no match is found, the auto assembly
466 is allowed.
467
468 If the metadata indicates that the array was created for
469 .I this
470 host, and the word
471 .I homehost
472 appears before any other match, then the array is treated as a valid
473 candidate for auto-assembly.
474
475 This can be used to disable all auto-assembly (so that only arrays
476 explicitly listed in mdadm.conf or on the command line are assembled),
477 or to disable assembly of certain metadata types which might be
478 handled by other software. It can also be used to disable assembly of
479 all foreign arrays - normally such arrays are assembled but given a
480 non-deterministic name in
481 .BR /dev/md/ .
482
483 The known metadata types are
484 .BR 0.90 ,
485 .BR 1.x ,
486 .BR ddf ,
487 .BR imsm .
488
489 .B AUTO
490 should be given at most once. Subsequent lines are silently ignored.
491 Thus a later config file in a config directory will not overwrite
492 the setting in an earlier config file.
493
494 .TP
495 .B POLICY
496 This is used to specify what automatic behavior is allowed on devices
497 newly appearing in the system and provides a way of marking spares that can
498 be moved to other arrays as well as the migration domains.
499 .I Domain
500 can be defined through
501 .I policy
502 line by specifying a domain name for a number of paths from
503 .BR /dev/disk/by-path/ .
504 A device may belong to several domains. The domain of an array is a union
505 of domains of all devices in that array. A spare can be automatically
506 moved from one array to another if the set of the destination array's
507 .I domains
508 contains all the
509 .I domains
510 of the new disk or if both arrays have the same
511 .IR spare-group .
512
513 To update hot plug configuration it is necessary to execute
514 .B mdadm \-\-udev\-rules
515 command after changing the config file
516
517 Keywords used in the
518 .I POLICY
519 line and supported values are:
520
521 .RS 4
522 .TP
523 .B domain=
524 any arbitrary string
525 .TP
526 .B metadata=
527 0.9 1.x ddf or imsm
528 .TP
529 .B path=
530 file glob matching anything from
531 .B /dev/disk/by-path
532 .TP
533 .B type=
534 either
535 .B disk
536 or
537 .BR part .
538 .TP
539 .B action=
540 include, re-add, spare, spare-same-slot, or force-spare
541 .TP
542 .B auto=
543 yes, no, or homehost.
544
545 .P
546 The
547 .I action
548 item determines the automatic behavior allowed for devices matching the
549 .I path
550 and
551 .I type
552 in the same line. If a device matches several lines with different
553 .I actions
554 then the most permissive will apply. The ordering of policy lines
555 is irrelevant to the end result.
556 .TP
557 .B include
558 allows adding a disk to an array if metadata on that disk matches that array
559 .TP
560 .B re\-add
561 will include the device in the array if it appears to be a current member
562 or a member that was recently removed and the array has a
563 write-intent-bitmap to allow the
564 .B re\-add
565 functionality.
566 .TP
567 .B spare
568 as above and additionally: if the device is bare it can
569 become a spare if there is any array that it is a candidate for based
570 on domains and metadata.
571 .TP
572 .B spare\-same\-slot
573 as above and additionally if given slot was used by an array that went
574 degraded recently and the device plugged in has no metadata then it will
575 be automatically added to that array (or it's container)
576 .TP
577 .B force\-spare
578 as above and the disk will become a spare in remaining cases
579 .RE
580
581 .TP
582 .B PART-POLICY
583 This is similar to
584 .B POLICY
585 and accepts the same keyword assignments. It allows a consistent set
586 of policies to applied to each of the partitions of a device.
587
588 A
589 .B PART-POLICY
590 line should set
591 .I type=disk
592 and identify the path to one or more disk devices. Each partition on
593 these disks will be treated according to the
594 .I action=
595 setting from this line. If a
596 .I domain
597 is set in the line, then the domain associated with each patition will
598 be based on the domain, but with
599 .RB \(dq -part N\(dq
600 appended, when N is the partition number for the partition that was
601 found.
602
603 .TP
604 .B SYSFS
605 The
606 .B SYSFS
607 line lists custom values of MD device's sysfs attributes which will be
608 stored in sysfs after the array is assembled. Multiple lines are allowed and each
609 line has to contain the uuid or the name of the device to which it relates.
610 Lines are applied in reverse order.
611 .RS 4
612 .TP
613 .B uuid=
614 hexadecimal identifier of MD device. This has to match the uuid stored in the
615 superblock.
616 .TP
617 .B name=
618 name of the MD device as was given to
619 .I mdadm
620 when the array was created. It will be ignored if
621 .B uuid
622 is not empty.
623 .RE
624
625 .TP
626 .B MONITORDELAY
627 The
628 .B monitordelay
629 line gives a delay in seconds
630 .I mdadm
631 shall wait before pooling md arrays
632 when
633 .I mdadm
634 is running in
635 .B \-\-monitor
636 mode.
637 .B \-d/\-\-delay
638 command line argument takes precedence over the config file.
639
640 If multiple
641 .B MINITORDELAY
642 lines are provided, only first non-zero value is considered.
643
644 .SH FILES
645
646 .SS {CONFFILE}
647
648 The default config file location, used when
649 .I mdadm
650 is running without --config option.
651
652 .SS {CONFFILE}.d
653
654 The default directory with config files. Used when
655 .I mdadm
656 is running without --config option, after successful reading of the
657 .B {CONFFILE}
658 default config file. Files in that directory
659 are read in lexical order.
660
661
662 .SS {CONFFILE2}
663
664 Alternative config file that is read, when
665 .I mdadm
666 is running without --config option and the
667 .B {CONFFILE}
668 default config file was not opened successfully.
669
670 .SS {CONFFILE2}.d
671
672 The alternative directory with config files. Used when
673 .I mdadm
674 is runninng without --config option, after reading the
675 .B {CONFFILE2}
676 alternative config file whether it was successful or not. Files in
677 that directory are read in lexical order.
678
679 .SH EXAMPLE
680 DEVICE /dev/sd[bcdjkl]1
681 .br
682 DEVICE /dev/hda1 /dev/hdb1
683
684 # /dev/md0 is known by its UUID.
685 .br
686 ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
687 .br
688 # /dev/md1 contains all devices with a minor number of
689 .br
690 # 1 in the superblock.
691 .br
692 ARRAY /dev/md1 superminor=1
693 .br
694 # /dev/md2 is made from precisely these two devices
695 .br
696 ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1
697
698 # /dev/md4 and /dev/md5 are a spare-group and spares
699 .br
700 # can be moved between them
701 .br
702 ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df
703 .br
704 spare\-group=group1
705 .br
706 ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977
707 .br
708 spare\-group=group1
709 .br
710 # /dev/md/home is created if need to be a partitionable md array
711 .br
712 # any spare device number is allocated.
713 .br
714 ARRAY /dev/md/home UUID=9187a482:5dde19d9:eea3cc4a:d646ab8b
715 .br
716 auto=part
717 .br
718 # The name of this array contains a space.
719 .br
720 ARRAY /dev/md9 name='Data Storage'
721 .sp
722 POLICY domain=domain1 metadata=imsm path=pci-0000:00:1f.2-scsi-*
723 .br
724 action=spare
725 .br
726 POLICY domain=domain1 metadata=imsm path=pci-0000:04:00.0-scsi-[01]*
727 .br
728 action=include
729 .br
730 # One domain comprising of devices attached to specified paths is defined.
731 .br
732 # Bare device matching first path will be made an imsm spare on hot plug.
733 .br
734 # If more than one array is created on devices belonging to domain1 and
735 .br
736 # one of them becomes degraded, then any imsm spare matching any path for
737 .br
738 # given domain name can be migrated.
739 .br
740 MAILADDR root@mydomain.tld
741 .br
742 PROGRAM /usr/sbin/handle\-mdadm\-events
743 .br
744 CREATE group=system mode=0640 auto=part\-8
745 .br
746 HOMEHOST <system>
747 .br
748 AUTO +1.x homehost \-all
749 .br
750 SYSFS name=/dev/md/raid5 group_thread_cnt=4 sync_speed_max=1000000
751 .br
752 SYSFS uuid=bead5eb6:31c17a27:da120ba2:7dfda40d group_thread_cnt=4
753 sync_speed_max=1000000
754 .br
755 MONITORDELAY 60
756
757 .SH SEE ALSO
758 .BR mdadm (8),
759 .BR md (4).