Blame SOURCES/0006-mdadm-Respect-config-file-location-in-man.patch

b33395
From e9dd5644843e2013a7dd1a8a5da2b9fa35837416 Mon Sep 17 00:00:00 2001
b33395
From: Lukasz Florczak <lukasz.florczak@linux.intel.com>
b33395
Date: Fri, 18 Mar 2022 09:26:04 +0100
b33395
Subject: [PATCH 06/12] mdadm: Respect config file location in man
b33395
b33395
Default config file location could differ depending on OS (e.g. Debian family).
b33395
This patch takes default config file into consideration when creating mdadm.man
b33395
file as well as mdadm.conf.man.
b33395
b33395
Rename mdadm.conf.5 to mdadm.conf.5.in. Now mdadm.conf.5 is generated automatically.
b33395
b33395
Signed-off-by: Lukasz Florczak <lukasz.florczak@linux.intel.com>
b33395
Acked-by: Coly Li <colyli@suse.de>
b33395
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
b33395
---
b33395
 .gitignore      |   1 +
b33395
 Makefile        |   7 +-
b33395
 mdadm.8.in      |  16 +-
b33395
 mdadm.conf.5    | 706 ------------------------------------------------
b33395
 mdadm.conf.5.in | 706 ++++++++++++++++++++++++++++++++++++++++++++++++
b33395
 5 files changed, 721 insertions(+), 715 deletions(-)
b33395
 delete mode 100644 mdadm.conf.5
b33395
 create mode 100644 mdadm.conf.5.in
b33395
b33395
diff --git a/.gitignore b/.gitignore
b33395
index 217fe76d..8d791c6f 100644
b33395
--- a/.gitignore
b33395
+++ b/.gitignore
b33395
@@ -3,6 +3,7 @@
b33395
 /*-stamp
b33395
 /mdadm
b33395
 /mdadm.8
b33395
+/mdadm.conf.5
b33395
 /mdadm.udeb
b33395
 /mdassemble
b33395
 /mdmon
b33395
diff --git a/Makefile b/Makefile
b33395
index 2a51d813..bf126033 100644
b33395
--- a/Makefile
b33395
+++ b/Makefile
b33395
@@ -227,7 +227,12 @@ raid6check : raid6check.o mdadm.h $(CHECK_OBJS)
b33395
 
b33395
 mdadm.8 : mdadm.8.in
b33395
 	sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' \
b33395
-	-e 's,{MAP_PATH},$(MAP_PATH),g'  mdadm.8.in > mdadm.8
b33395
+	-e 's,{MAP_PATH},$(MAP_PATH),g' -e 's,{CONFFILE},$(CONFFILE),g' \
b33395
+	-e 's,{CONFFILE2},$(CONFFILE2),g'  mdadm.8.in > mdadm.8
b33395
+
b33395
+mdadm.conf.5 : mdadm.conf.5.in
b33395
+	sed -e 's,{CONFFILE},$(CONFFILE),g' \
b33395
+	-e 's,{CONFFILE2},$(CONFFILE2),g'  mdadm.conf.5.in > mdadm.conf.5
b33395
 
b33395
 mdadm.man : mdadm.8
b33395
 	man -l mdadm.8 > mdadm.man
b33395
diff --git a/mdadm.8.in b/mdadm.8.in
b33395
index e2a42425..8b21ffd4 100644
b33395
--- a/mdadm.8.in
b33395
+++ b/mdadm.8.in
b33395
@@ -267,13 +267,13 @@ the exact meaning of this option in different contexts.
b33395
 .TP
b33395
 .BR \-c ", " \-\-config=
b33395
 Specify the config file or directory.  Default is to use
b33395
-.B /etc/mdadm.conf
b33395
+.B {CONFFILE}
b33395
 and
b33395
-.BR /etc/mdadm.conf.d ,
b33395
+.BR {CONFFILE}.d ,
b33395
 or if those are missing then
b33395
-.B /etc/mdadm/mdadm.conf
b33395
+.B {CONFFILE2}
b33395
 and
b33395
-.BR /etc/mdadm/mdadm.conf.d .
b33395
+.BR {CONFFILE2}.d .
b33395
 If the config file given is
b33395
 .B "partitions"
b33395
 then nothing will be read, but
b33395
@@ -2014,9 +2014,9 @@ The config file is only used if explicitly named with
b33395
 or requested with (a possibly implicit)
b33395
 .BR \-\-scan .
b33395
 In the later case,
b33395
-.B /etc/mdadm.conf
b33395
+.B {CONFFILE}
b33395
 or
b33395
-.B /etc/mdadm/mdadm.conf
b33395
+.B {CONFFILE2}
b33395
 is used.
b33395
 
b33395
 If
b33395
@@ -3344,7 +3344,7 @@ uses this to find arrays when
b33395
 is given in Misc mode, and to monitor array reconstruction
b33395
 on Monitor mode.
b33395
 
b33395
-.SS /etc/mdadm.conf
b33395
+.SS {CONFFILE} (or {CONFFILE2})
b33395
 
b33395
 The config file lists which devices may be scanned to see if
b33395
 they contain MD super block, and gives identifying information
b33395
@@ -3352,7 +3352,7 @@ they contain MD super block, and gives identifying information
b33395
 .BR mdadm.conf (5)
b33395
 for more details.
b33395
 
b33395
-.SS /etc/mdadm.conf.d
b33395
+.SS {CONFFILE}.d (or {CONFFILE2}.d)
b33395
 
b33395
 A directory containing configuration files which are read in lexical
b33395
 order.
b33395
diff --git a/mdadm.conf.5 b/mdadm.conf.5
b33395
deleted file mode 100644
b33395
index 74a21c5f..00000000
b33395
--- a/mdadm.conf.5
b33395
+++ /dev/null
b33395
@@ -1,706 +0,0 @@
b33395
-.\" Copyright Neil Brown and others.
b33395
-.\"   This program is free software; you can redistribute it and/or modify
b33395
-.\"   it under the terms of the GNU General Public License as published by
b33395
-.\"   the Free Software Foundation; either version 2 of the License, or
b33395
-.\"   (at your option) any later version.
b33395
-.\" See file COPYING in distribution for details.
b33395
-.TH MDADM.CONF 5
b33395
-.SH NAME
b33395
-mdadm.conf \- configuration for management of Software RAID with mdadm
b33395
-.SH SYNOPSIS
b33395
-/etc/mdadm.conf
b33395
-.SH DESCRIPTION
b33395
-.PP
b33395
-.I mdadm
b33395
-is a tool for creating, managing, and monitoring RAID devices using the
b33395
-.B md
b33395
-driver in Linux.
b33395
-.PP
b33395
-Some common tasks, such as assembling all arrays, can be simplified
b33395
-by describing the devices and arrays in this configuration file.
b33395
-
b33395
-.SS SYNTAX
b33395
-The file should be seen as a collection of words separated by white
b33395
-space (space, tab, or newline).
b33395
-Any word that beings with a hash sign (#) starts a comment and that
b33395
-word together with the remainder of the line is ignored.
b33395
-
b33395
-Spaces can be included in a word using quotation characters.  Either
b33395
-single quotes
b33395
-.RB ( ' )
b33395
-or double quotes (\fB"\fP)
b33395
-may be used.  All the characters from one quotation character to
b33395
-next identical character are protected and will not be used to
b33395
-separate words to start new quoted strings.  To include a single quote
b33395
-it must be between double quotes.  To include a double quote it must
b33395
-be between single quotes.
b33395
-
b33395
-Any line that starts with white space (space or tab) is treated as
b33395
-though it were a continuation of the previous line.
b33395
-
b33395
-Empty lines are ignored, but otherwise each (non continuation) line
b33395
-must start with a keyword as listed below.  The keywords are case
b33395
-insensitive and can be abbreviated to 3 characters.
b33395
-
b33395
-The keywords are:
b33395
-.TP
b33395
-.B DEVICE
b33395
-A
b33395
-.B device
b33395
-line lists the devices (whole devices or partitions) that might contain
b33395
-a component of an MD array.  When looking for the components of an
b33395
-array,
b33395
-.I mdadm
b33395
-will scan these devices (or any devices listed on the command line).
b33395
-
b33395
-The
b33395
-.B device
b33395
-line may contain a number of different devices (separated by spaces)
b33395
-and each device name can contain wild cards as defined by
b33395
-.BR glob (7).
b33395
-
b33395
-Also, there may be several device lines present in the file.
b33395
-
b33395
-Alternatively, a
b33395
-.B device
b33395
-line can contain either or both of the  words
b33395
-.B containers
b33395
-and
b33395
-.BR partitions .
b33395
-The word
b33395
-.B containers
b33395
-will cause
b33395
-.I mdadm
b33395
-to look for assembled CONTAINER arrays and included them as a source
b33395
-for assembling further arrays.
b33395
-
b33395
-The word
b33395
-.I partitions
b33395
-will cause
b33395
-.I mdadm
b33395
-to read
b33395
-.I /proc/partitions
b33395
-and include all devices and partitions found therein.
b33395
-.I mdadm
b33395
-does not use the names from
b33395
-.I /proc/partitions
b33395
-but only the major and minor device numbers.  It scans
b33395
-.I /dev
b33395
-to find the name that matches the numbers.
b33395
-
b33395
-If no DEVICE line is present, then "DEVICE partitions containers" is assumed.
b33395
-
b33395
-For example:
b33395
-.IP
b33395
-DEVICE /dev/hda* /dev/hdc*
b33395
-.br
b33395
-DEV    /dev/sd*
b33395
-.br
b33395
-DEVICE /dev/disk/by-path/pci*
b33395
-.br
b33395
-DEVICE partitions
b33395
-
b33395
-.TP
b33395
-.B ARRAY
b33395
-The ARRAY lines identify actual arrays.  The second word on the line
b33395
-may be the name of the device where the array is normally
b33395
-assembled, such as
b33395
-.B /dev/md1
b33395
-or
b33395
-.BR /dev/md/backup .
b33395
-If the name does not start with a slash
b33395
-.RB (' / '),
b33395
-it is treated as being in
b33395
-.BR /dev/md/ .
b33395
-Alternately the word
b33395
-.B <ignore>
b33395
-(complete with angle brackets) can be given in which case any array
b33395
-which matches the rest of the line will never be automatically assembled.
b33395
-If no device name is given,
b33395
-.I mdadm
b33395
-will use various heuristics to determine an appropriate name.
b33395
-
b33395
-Subsequent words identify the array, or identify the array as a member
b33395
-of a group. If multiple identities are given,
b33395
-then a component device must match ALL identities to be considered a
b33395
-match.  Each identity word has a tag, and equals sign, and some value.
b33395
-The tags are:
b33395
-.RS 4
b33395
-.TP
b33395
-.B uuid=
b33395
-The value should be a 128 bit uuid in hexadecimal, with punctuation
b33395
-interspersed if desired.  This must match the uuid stored in the
b33395
-superblock.
b33395
-.TP
b33395
-.B name=
b33395
-The value should be a simple textual name as was given to
b33395
-.I mdadm
b33395
-when the array was created.  This must match the name stored in the
b33395
-superblock on a device for that device to be included in the array.
b33395
-Not all superblock formats support names.
b33395
-.TP
b33395
-.B super\-minor=
b33395
-The value is an integer which indicates the minor number that was
b33395
-stored in the superblock when the array was created. When an array is
b33395
-created as /dev/mdX, then the minor number X is stored.
b33395
-.TP
b33395
-.B devices=
b33395
-The value is a comma separated list of device names or device name
b33395
-patterns.
b33395
-Only devices with names which match one entry in the list will be used
b33395
-to assemble the array.  Note that the devices
b33395
-listed there must also be listed on a DEVICE line.
b33395
-.TP
b33395
-.B level=
b33395
-The value is a RAID level.  This is not normally used to
b33395
-identify an array, but is supported so that the output of
b33395
-
b33395
-.B "mdadm \-\-examine \-\-scan"
b33395
-
b33395
-can be use directly in the configuration file.
b33395
-.TP
b33395
-.B num\-devices=
b33395
-The value is the number of devices in a complete active array.  As with
b33395
-.B level=
b33395
-this is mainly for compatibility with the output of
b33395
-
b33395
-.BR "mdadm \-\-examine \-\-scan" .
b33395
-
b33395
-.TP
b33395
-.B spares=
b33395
-The value is a number of spare devices to expect the array to have.
b33395
-The sole use of this keyword and value is as follows:
b33395
-.B mdadm \-\-monitor
b33395
-will report an array if it is found to have fewer than this number of
b33395
-spares when
b33395
-.B \-\-monitor
b33395
-starts or when
b33395
-.B \-\-oneshot
b33395
-is used.
b33395
-
b33395
-.TP
b33395
-.B spare\-group=
b33395
-The value is a textual name for a group of arrays.  All arrays with
b33395
-the same
b33395
-.B spare\-group
b33395
-name are considered to be part of the same group.  The significance of
b33395
-a group of arrays is that
b33395
-.I mdadm
b33395
-will, when monitoring the arrays, move a spare drive from one array in
b33395
-a group to another array in that group if the first array had a failed
b33395
-or missing drive but no spare.
b33395
-
b33395
-.TP
b33395
-.B auto=
b33395
-This option is rarely needed with mdadm-3.0, particularly if use with
b33395
-the Linux kernel v2.6.28 or later.
b33395
-It tells
b33395
-.I mdadm
b33395
-whether to use partitionable array or non-partitionable arrays and,
b33395
-in the absence of
b33395
-.IR udev ,
b33395
-how many partition devices to create.  From 2.6.28 all md array
b33395
-devices are partitionable, hence this option is not needed.
b33395
-
b33395
-The value of this option can be "yes" or "md" to indicate that a
b33395
-traditional, non-partitionable md array should be created, or "mdp",
b33395
-"part" or "partition" to indicate that a partitionable md array (only
b33395
-available in linux 2.6 and later) should be used.  This later set can
b33395
-also have a number appended to indicate how many partitions to create
b33395
-device files for, e.g.
b33395
-.BR auto=mdp5 .
b33395
-The default is 4.
b33395
-
b33395
-.TP
b33395
-.B bitmap=
b33395
-The option specifies a file in which a write-intent bitmap should be
b33395
-found.  When assembling the array,
b33395
-.I mdadm
b33395
-will provide this file to the
b33395
-.B md
b33395
-driver as the bitmap file.  This has the same function as the
b33395
-.B \-\-bitmap\-file
b33395
-option to
b33395
-.BR \-\-assemble .
b33395
-
b33395
-.TP
b33395
-.B metadata=
b33395
-Specify the metadata format that the array has.  This is mainly
b33395
-recognised for comparability with the output of
b33395
-.BR "mdadm \-Es" .
b33395
-
b33395
-.TP
b33395
-.B container=
b33395
-Specify that this array is a member array of some container.  The
b33395
-value given can be either a path name in /dev, or a UUID of the
b33395
-container array.
b33395
-
b33395
-.TP
b33395
-.B member=
b33395
-Specify that this array is a member array of some container.  Each
b33395
-type of container has some way to enumerate member arrays, often a
b33395
-simple sequence number.  The value identifies which member of a
b33395
-container the array is.  It will usually accompany a "container=" word.
b33395
-.RE
b33395
-
b33395
-.TP
b33395
-.B MAILADDR
b33395
-The
b33395
-.B mailaddr
b33395
-line gives an E-mail address that alerts should be
b33395
-sent to when
b33395
-.I mdadm
b33395
-is running in
b33395
-.B \-\-monitor
b33395
-mode (and was given the
b33395
-.B \-\-scan
b33395
-option).  There should only be one
b33395
-.B MAILADDR
b33395
-line and it should have only one address.  Any subsequent addresses
b33395
-are silently ignored.
b33395
-
b33395
-.TP
b33395
-.B MAILFROM
b33395
-The
b33395
-.B mailfrom
b33395
-line (which can only be abbreviated to at least 5 characters) gives an
b33395
-address to appear in the "From" address for alert mails.  This can be
b33395
-useful if you want to explicitly set a domain, as the default from
b33395
-address is "root" with no domain.  All words on this line are
b33395
-catenated with spaces to form the address.
b33395
-
b33395
-Note that this value cannot be set via the
b33395
-.I mdadm
b33395
-commandline.  It is only settable via the config file.
b33395
-
b33395
-.TP
b33395
-.B PROGRAM
b33395
-The
b33395
-.B program
b33395
-line gives the name of a program to be run when
b33395
-.B "mdadm \-\-monitor"
b33395
-detects potentially interesting events on any of the arrays that it
b33395
-is monitoring.  This program gets run with two or three arguments, they
b33395
-being the Event, the md device, and possibly the related component
b33395
-device.
b33395
-
b33395
-There should only be one
b33395
-.B program
b33395
-line and it should be give only one program.
b33395
-
b33395
-
b33395
-.TP
b33395
-.B CREATE
b33395
-The
b33395
-.B create
b33395
-line gives default values to be used when creating arrays, new members
b33395
-of arrays, and device entries for arrays.
b33395
-These include:
b33395
-
b33395
-.RS 4
b33395
-.TP
b33395
-.B owner=
b33395
-.TP
b33395
-.B group=
b33395
-These can give user/group ids or names to use instead of system
b33395
-defaults (root/wheel or root/disk).
b33395
-.TP
b33395
-.B mode=
b33395
-An octal file mode such as 0660 can be given to override the default
b33395
-of 0600.
b33395
-.TP
b33395
-.B auto=
b33395
-This corresponds to the
b33395
-.B \-\-auto
b33395
-flag to mdadm.  Give
b33395
-.BR yes ,
b33395
-.BR md ,
b33395
-.BR mdp ,
b33395
-.B part
b33395
-\(em possibly followed by a number of partitions \(em to indicate how
b33395
-missing device entries should be created.
b33395
-
b33395
-.TP
b33395
-.B metadata=
b33395
-The name of the metadata format to use if none is explicitly given.
b33395
-This can be useful to impose a system-wide default of version-1 superblocks.
b33395
-
b33395
-.TP
b33395
-.B symlinks=no
b33395
-Normally when creating devices in
b33395
-.B /dev/md/
b33395
-.I mdadm
b33395
-will create a matching symlink from
b33395
-.B /dev/
b33395
-with a name starting
b33395
-.B md
b33395
-or
b33395
-.BR md_ .
b33395
-Give
b33395
-.B symlinks=no
b33395
-to suppress this symlink creation.
b33395
-
b33395
-.TP
b33395
-.B names=yes
b33395
-Since Linux 2.6.29 it has been possible to create
b33395
-.B md
b33395
-devices with a name like
b33395
-.B md_home
b33395
-rather than just a number, like
b33395
-.BR md3 .
b33395
-.I mdadm
b33395
-will use the numeric alternative by default as other tools that interact
b33395
-with md arrays may expect only numbers.
b33395
-If
b33395
-.B names=yes
b33395
-is given in
b33395
-.I mdadm.conf
b33395
-then
b33395
-.I mdadm
b33395
-will use a name when appropriate.
b33395
-If
b33395
-.B names=no
b33395
-is given, then non-numeric
b33395
-.I md
b33395
-device names will not be used even if the default changes in a future
b33395
-release of
b33395
-.IR mdadm .
b33395
-
b33395
-.TP
b33395
-.B bbl=no
b33395
-By default,
b33395
-.I mdadm
b33395
-will reserve space for a bad block list (bbl) on all devices
b33395
-included in or added to any array that supports them.  Setting
b33395
-.B bbl=no
b33395
-will prevent this, so newly added devices will not have a bad
b33395
-block log.
b33395
-.RE
b33395
-
b33395
-.TP
b33395
-.B HOMEHOST
b33395
-The
b33395
-.B homehost
b33395
-line gives a default value for the
b33395
-.B \-\-homehost=
b33395
-option to mdadm.  There should normally be only one other word on the line.
b33395
-It should either be a host name, or one of the special words
b33395
-.BR <system>,
b33395
-.B <none>
b33395
-and
b33395
-.BR <ignore> .
b33395
-If
b33395
-.B <system>
b33395
-is given, then the
b33395
-.BR gethostname ( 2 )
b33395
-systemcall is used to get the host name.  This is the default.
b33395
-
b33395
-If
b33395
-.B <ignore>
b33395
-is given, then a flag is set so that when arrays are being
b33395
-auto-assembled the checking of the recorded
b33395
-.I homehost
b33395
-is disabled.
b33395
-If
b33395
-.B <ignore>
b33395
-is given it is also possible to give an explicit name which will be
b33395
-used when creating arrays.  This is the only case when there can be
b33395
-more that one other word on the
b33395
-.B HOMEHOST
b33395
-line.  If there are other words, or other
b33395
-.B HOMEHOST
b33395
-lines, they are silently ignored.
b33395
-
b33395
-If
b33395
-.B <none>
b33395
-is given, then the default of using
b33395
-.BR gethostname ( 2 )
b33395
-is over-ridden and no homehost name is assumed.
b33395
-
b33395
-When arrays are created, this host name will be stored in the
b33395
-metadata.  When arrays are assembled using auto-assembly, arrays which
b33395
-do not record the correct homehost name in their metadata will be
b33395
-assembled using a "foreign" name.  A "foreign" name alway ends with a
b33395
-digit string preceded by an underscore to differentiate it
b33395
-from any possible local name. e.g.
b33395
-.B /dev/md/1_1
b33395
-or
b33395
-.BR /dev/md/home_0 .
b33395
-.TP
b33395
-.B AUTO
b33395
-A list of names of metadata format can be given, each preceded by a
b33395
-plus or minus sign.  Also the word
b33395
-.I homehost
b33395
-is allowed as is
b33395
-.I all
b33395
-preceded by plus or minus sign.
b33395
-.I all
b33395
-is usually last.
b33395
-
b33395
-When
b33395
-.I mdadm
b33395
-is auto-assembling an array, either via
b33395
-.I \-\-assemble
b33395
-or
b33395
-.I \-\-incremental
b33395
-and it finds metadata of a given type, it checks that metadata type
b33395
-against those listed in this line.  The first match wins, where
b33395
-.I all
b33395
-matches anything.
b33395
-If a match is found that was preceded by a plus sign, the auto
b33395
-assembly is allowed.  If the match was preceded by a minus sign, the
b33395
-auto assembly is disallowed.  If no match is found, the auto assembly
b33395
-is allowed.
b33395
-
b33395
-If the metadata indicates that the array was created for
b33395
-.I this
b33395
-host, and the word
b33395
-.I homehost
b33395
-appears before any other match, then the array is treated as a valid
b33395
-candidate for auto-assembly.
b33395
-
b33395
-This can be used to disable all auto-assembly (so that only arrays
b33395
-explicitly listed in mdadm.conf or on the command line are assembled),
b33395
-or to disable assembly of certain metadata types which might be
b33395
-handled by other software.  It can also be used to disable assembly of
b33395
-all foreign arrays - normally such arrays are assembled but given a
b33395
-non-deterministic name in
b33395
-.BR /dev/md/ .
b33395
-
b33395
-The known metadata types are
b33395
-.BR 0.90 ,
b33395
-.BR 1.x ,
b33395
-.BR ddf ,
b33395
-.BR imsm .
b33395
-
b33395
-.B AUTO
b33395
-should be given at most once.  Subsequent lines are silently ignored.
b33395
-Thus an earlier config file in a config directory will over-ride
b33395
-the setting in a later config file.
b33395
-
b33395
-.TP
b33395
-.B POLICY
b33395
-This is used to specify what automatic behavior is allowed on devices
b33395
-newly appearing in the system and provides a way of marking spares that can
b33395
-be moved to other arrays as well as the migration domains.
b33395
-.I Domain
b33395
-can be defined through
b33395
-.I policy
b33395
-line by specifying a domain name for a number of paths from
b33395
-.BR /dev/disk/by-path/ .
b33395
-A device may belong to several domains. The domain of an array is a union
b33395
-of domains of all devices in that array.  A spare can be automatically
b33395
-moved from one array to another if the set of the destination array's
b33395
-.I domains
b33395
-contains all the
b33395
-.I domains
b33395
-of the new disk or if both arrays have the same
b33395
-.IR spare-group .
b33395
-
b33395
-To update hot plug configuration it is necessary to execute
b33395
-.B mdadm \-\-udev\-rules
b33395
-command after changing the config file
b33395
-
b33395
-Keywords used in the
b33395
-.I POLICY
b33395
-line and supported values are:
b33395
-
b33395
-.RS 4
b33395
-.TP
b33395
-.B domain=
b33395
-any arbitrary string
b33395
-.TP
b33395
-.B metadata=
b33395
-0.9 1.x ddf or imsm
b33395
-.TP
b33395
-.B path=
b33395
-file glob matching anything from
b33395
-.B /dev/disk/by-path
b33395
-.TP
b33395
-.B type=
b33395
-either
b33395
-.B disk
b33395
-or
b33395
-.BR part .
b33395
-.TP
b33395
-.B action=
b33395
-include, re-add, spare, spare-same-slot, or force-spare
b33395
-.TP
b33395
-.B auto=
b33395
-yes, no, or homehost.
b33395
-
b33395
-.P
b33395
-The
b33395
-.I action
b33395
-item determines the automatic behavior allowed for devices matching the
b33395
-.I path
b33395
-and
b33395
-.I type
b33395
-in the same line.  If a device matches several lines with different
b33395
-.I  actions
b33395
-then the most permissive will apply. The ordering of policy lines
b33395
-is irrelevant to the end result.
b33395
-.TP
b33395
-.B include
b33395
-allows adding a disk to an array if metadata on that disk matches that array
b33395
-.TP
b33395
-.B re\-add
b33395
-will include the device in the array if it appears to be a current member
b33395
-or a member that was recently removed and the array has a
b33395
-write-intent-bitmap to allow the
b33395
-.B re\-add
b33395
-functionality.
b33395
-.TP
b33395
-.B spare
b33395
-as above and additionally: if the device is bare it can
b33395
-become a spare if there is any array that it is a candidate for based
b33395
-on domains and metadata.
b33395
-.TP
b33395
-.B spare\-same\-slot
b33395
-as above and additionally if given slot was used by an array that went
b33395
-degraded recently and the device plugged in has no metadata then it will
b33395
-be automatically added to that array (or it's container)
b33395
-.TP
b33395
-.B force\-spare
b33395
-as above and the disk will become a spare in remaining cases
b33395
-.RE
b33395
-
b33395
-.TP
b33395
-.B PART-POLICY
b33395
-This is similar to
b33395
-.B POLICY
b33395
-and accepts the same keyword assignments.  It allows a consistent set
b33395
-of policies to applied to each of the partitions of a device.
b33395
-
b33395
-A
b33395
-.B PART-POLICY
b33395
-line should set
b33395
-.I type=disk
b33395
-and identify the path to one or more disk devices.  Each partition on
b33395
-these disks will be treated according to the
b33395
-.I action=
b33395
-setting  from this line.  If a
b33395
-.I domain
b33395
-is set in the line, then the domain associated with each patition will
b33395
-be based on the domain, but with
b33395
-.RB \(dq -part N\(dq
b33395
-appended, when N is the partition number for the partition that was
b33395
-found.
b33395
-
b33395
-.TP
b33395
-.B SYSFS
b33395
-The
b33395
-.B SYSFS
b33395
-line lists custom values of MD device's sysfs attributes which will be
b33395
-stored in sysfs after the array is assembled. Multiple lines are allowed and each
b33395
-line has to contain the uuid or the name of the device to which it relates.
b33395
-.RS 4
b33395
-.TP
b33395
-.B uuid=
b33395
-hexadecimal identifier of MD device. This has to match the uuid stored in the
b33395
-superblock.
b33395
-.TP
b33395
-.B name=
b33395
-name of the MD device as was given to
b33395
-.I mdadm
b33395
-when the array was created. It will be ignored if
b33395
-.B uuid
b33395
-is not empty.
b33395
-.RE
b33395
-
b33395
-.TP
b33395
-.B MONITORDELAY
b33395
-The
b33395
-.B monitordelay
b33395
-line gives a delay in seconds
b33395
-.I mdadm
b33395
-shall wait before pooling md arrays
b33395
-when
b33395
-.I mdadm
b33395
-is running in
b33395
-.B \-\-monitor
b33395
-mode.
b33395
-.B \-d/\-\-delay
b33395
-command line argument takes precedence over the config file
b33395
-
b33395
-.SH EXAMPLE
b33395
-DEVICE /dev/sd[bcdjkl]1
b33395
-.br
b33395
-DEVICE /dev/hda1 /dev/hdb1
b33395
-
b33395
-# /dev/md0 is known by its UUID.
b33395
-.br
b33395
-ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
b33395
-.br
b33395
-# /dev/md1 contains all devices with a minor number of
b33395
-.br
b33395
-#   1 in the superblock.
b33395
-.br
b33395
-ARRAY /dev/md1 superminor=1
b33395
-.br
b33395
-# /dev/md2 is made from precisely these two devices
b33395
-.br
b33395
-ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1
b33395
-
b33395
-# /dev/md4 and /dev/md5 are a spare-group and spares
b33395
-.br
b33395
-#  can be moved between them
b33395
-.br
b33395
-ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df
b33395
-.br
b33395
-           spare\-group=group1
b33395
-.br
b33395
-ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977
b33395
-.br
b33395
-           spare\-group=group1
b33395
-.br
b33395
-# /dev/md/home is created if need to be a partitionable md array
b33395
-.br
b33395
-# any spare device number is allocated.
b33395
-.br
b33395
-ARRAY /dev/md/home UUID=9187a482:5dde19d9:eea3cc4a:d646ab8b
b33395
-.br
b33395
-           auto=part
b33395
-.br
b33395
-# The name of this array contains a space.
b33395
-.br
b33395
-ARRAY /dev/md9 name='Data Storage'
b33395
-.sp
b33395
-POLICY domain=domain1 metadata=imsm path=pci-0000:00:1f.2-scsi-*
b33395
-.br
b33395
-           action=spare
b33395
-.br
b33395
-POLICY domain=domain1 metadata=imsm path=pci-0000:04:00.0-scsi-[01]*
b33395
-.br
b33395
-           action=include
b33395
-.br
b33395
-# One domain comprising of devices attached to specified paths is defined.
b33395
-.br
b33395
-# Bare device matching first path will be made an imsm spare on hot plug.
b33395
-.br
b33395
-# If more than one array is created on devices belonging to domain1 and
b33395
-.br
b33395
-# one of them becomes degraded, then any imsm spare matching any path for
b33395
-.br
b33395
-# given domain name can be migrated.
b33395
-.br
b33395
-MAILADDR root@mydomain.tld
b33395
-.br
b33395
-PROGRAM /usr/sbin/handle\-mdadm\-events
b33395
-.br
b33395
-CREATE group=system mode=0640 auto=part\-8
b33395
-.br
b33395
-HOMEHOST <system>
b33395
-.br
b33395
-AUTO +1.x homehost \-all
b33395
-.br
b33395
-SYSFS name=/dev/md/raid5 group_thread_cnt=4 sync_speed_max=1000000
b33395
-.br
b33395
-SYSFS uuid=bead5eb6:31c17a27:da120ba2:7dfda40d group_thread_cnt=4
b33395
-sync_speed_max=1000000
b33395
-.br
b33395
-MONITORDELAY 60
b33395
-
b33395
-.SH SEE ALSO
b33395
-.BR mdadm (8),
b33395
-.BR md (4).
b33395
diff --git a/mdadm.conf.5.in b/mdadm.conf.5.in
b33395
new file mode 100644
b33395
index 00000000..83edd008
b33395
--- /dev/null
b33395
+++ b/mdadm.conf.5.in
b33395
@@ -0,0 +1,706 @@
b33395
+.\" Copyright Neil Brown and others.
b33395
+.\"   This program is free software; you can redistribute it and/or modify
b33395
+.\"   it under the terms of the GNU General Public License as published by
b33395
+.\"   the Free Software Foundation; either version 2 of the License, or
b33395
+.\"   (at your option) any later version.
b33395
+.\" See file COPYING in distribution for details.
b33395
+.TH MDADM.CONF 5
b33395
+.SH NAME
b33395
+mdadm.conf \- configuration for management of Software RAID with mdadm
b33395
+.SH SYNOPSIS
b33395
+{CONFFILE}
b33395
+.SH DESCRIPTION
b33395
+.PP
b33395
+.I mdadm
b33395
+is a tool for creating, managing, and monitoring RAID devices using the
b33395
+.B md
b33395
+driver in Linux.
b33395
+.PP
b33395
+Some common tasks, such as assembling all arrays, can be simplified
b33395
+by describing the devices and arrays in this configuration file.
b33395
+
b33395
+.SS SYNTAX
b33395
+The file should be seen as a collection of words separated by white
b33395
+space (space, tab, or newline).
b33395
+Any word that beings with a hash sign (#) starts a comment and that
b33395
+word together with the remainder of the line is ignored.
b33395
+
b33395
+Spaces can be included in a word using quotation characters.  Either
b33395
+single quotes
b33395
+.RB ( ' )
b33395
+or double quotes (\fB"\fP)
b33395
+may be used.  All the characters from one quotation character to
b33395
+next identical character are protected and will not be used to
b33395
+separate words to start new quoted strings.  To include a single quote
b33395
+it must be between double quotes.  To include a double quote it must
b33395
+be between single quotes.
b33395
+
b33395
+Any line that starts with white space (space or tab) is treated as
b33395
+though it were a continuation of the previous line.
b33395
+
b33395
+Empty lines are ignored, but otherwise each (non continuation) line
b33395
+must start with a keyword as listed below.  The keywords are case
b33395
+insensitive and can be abbreviated to 3 characters.
b33395
+
b33395
+The keywords are:
b33395
+.TP
b33395
+.B DEVICE
b33395
+A
b33395
+.B device
b33395
+line lists the devices (whole devices or partitions) that might contain
b33395
+a component of an MD array.  When looking for the components of an
b33395
+array,
b33395
+.I mdadm
b33395
+will scan these devices (or any devices listed on the command line).
b33395
+
b33395
+The
b33395
+.B device
b33395
+line may contain a number of different devices (separated by spaces)
b33395
+and each device name can contain wild cards as defined by
b33395
+.BR glob (7).
b33395
+
b33395
+Also, there may be several device lines present in the file.
b33395
+
b33395
+Alternatively, a
b33395
+.B device
b33395
+line can contain either or both of the  words
b33395
+.B containers
b33395
+and
b33395
+.BR partitions .
b33395
+The word
b33395
+.B containers
b33395
+will cause
b33395
+.I mdadm
b33395
+to look for assembled CONTAINER arrays and included them as a source
b33395
+for assembling further arrays.
b33395
+
b33395
+The word
b33395
+.I partitions
b33395
+will cause
b33395
+.I mdadm
b33395
+to read
b33395
+.I /proc/partitions
b33395
+and include all devices and partitions found therein.
b33395
+.I mdadm
b33395
+does not use the names from
b33395
+.I /proc/partitions
b33395
+but only the major and minor device numbers.  It scans
b33395
+.I /dev
b33395
+to find the name that matches the numbers.
b33395
+
b33395
+If no DEVICE line is present, then "DEVICE partitions containers" is assumed.
b33395
+
b33395
+For example:
b33395
+.IP
b33395
+DEVICE /dev/hda* /dev/hdc*
b33395
+.br
b33395
+DEV    /dev/sd*
b33395
+.br
b33395
+DEVICE /dev/disk/by-path/pci*
b33395
+.br
b33395
+DEVICE partitions
b33395
+
b33395
+.TP
b33395
+.B ARRAY
b33395
+The ARRAY lines identify actual arrays.  The second word on the line
b33395
+may be the name of the device where the array is normally
b33395
+assembled, such as
b33395
+.B /dev/md1
b33395
+or
b33395
+.BR /dev/md/backup .
b33395
+If the name does not start with a slash
b33395
+.RB (' / '),
b33395
+it is treated as being in
b33395
+.BR /dev/md/ .
b33395
+Alternately the word
b33395
+.B <ignore>
b33395
+(complete with angle brackets) can be given in which case any array
b33395
+which matches the rest of the line will never be automatically assembled.
b33395
+If no device name is given,
b33395
+.I mdadm
b33395
+will use various heuristics to determine an appropriate name.
b33395
+
b33395
+Subsequent words identify the array, or identify the array as a member
b33395
+of a group. If multiple identities are given,
b33395
+then a component device must match ALL identities to be considered a
b33395
+match.  Each identity word has a tag, and equals sign, and some value.
b33395
+The tags are:
b33395
+.RS 4
b33395
+.TP
b33395
+.B uuid=
b33395
+The value should be a 128 bit uuid in hexadecimal, with punctuation
b33395
+interspersed if desired.  This must match the uuid stored in the
b33395
+superblock.
b33395
+.TP
b33395
+.B name=
b33395
+The value should be a simple textual name as was given to
b33395
+.I mdadm
b33395
+when the array was created.  This must match the name stored in the
b33395
+superblock on a device for that device to be included in the array.
b33395
+Not all superblock formats support names.
b33395
+.TP
b33395
+.B super\-minor=
b33395
+The value is an integer which indicates the minor number that was
b33395
+stored in the superblock when the array was created. When an array is
b33395
+created as /dev/mdX, then the minor number X is stored.
b33395
+.TP
b33395
+.B devices=
b33395
+The value is a comma separated list of device names or device name
b33395
+patterns.
b33395
+Only devices with names which match one entry in the list will be used
b33395
+to assemble the array.  Note that the devices
b33395
+listed there must also be listed on a DEVICE line.
b33395
+.TP
b33395
+.B level=
b33395
+The value is a RAID level.  This is not normally used to
b33395
+identify an array, but is supported so that the output of
b33395
+
b33395
+.B "mdadm \-\-examine \-\-scan"
b33395
+
b33395
+can be use directly in the configuration file.
b33395
+.TP
b33395
+.B num\-devices=
b33395
+The value is the number of devices in a complete active array.  As with
b33395
+.B level=
b33395
+this is mainly for compatibility with the output of
b33395
+
b33395
+.BR "mdadm \-\-examine \-\-scan" .
b33395
+
b33395
+.TP
b33395
+.B spares=
b33395
+The value is a number of spare devices to expect the array to have.
b33395
+The sole use of this keyword and value is as follows:
b33395
+.B mdadm \-\-monitor
b33395
+will report an array if it is found to have fewer than this number of
b33395
+spares when
b33395
+.B \-\-monitor
b33395
+starts or when
b33395
+.B \-\-oneshot
b33395
+is used.
b33395
+
b33395
+.TP
b33395
+.B spare\-group=
b33395
+The value is a textual name for a group of arrays.  All arrays with
b33395
+the same
b33395
+.B spare\-group
b33395
+name are considered to be part of the same group.  The significance of
b33395
+a group of arrays is that
b33395
+.I mdadm
b33395
+will, when monitoring the arrays, move a spare drive from one array in
b33395
+a group to another array in that group if the first array had a failed
b33395
+or missing drive but no spare.
b33395
+
b33395
+.TP
b33395
+.B auto=
b33395
+This option is rarely needed with mdadm-3.0, particularly if use with
b33395
+the Linux kernel v2.6.28 or later.
b33395
+It tells
b33395
+.I mdadm
b33395
+whether to use partitionable array or non-partitionable arrays and,
b33395
+in the absence of
b33395
+.IR udev ,
b33395
+how many partition devices to create.  From 2.6.28 all md array
b33395
+devices are partitionable, hence this option is not needed.
b33395
+
b33395
+The value of this option can be "yes" or "md" to indicate that a
b33395
+traditional, non-partitionable md array should be created, or "mdp",
b33395
+"part" or "partition" to indicate that a partitionable md array (only
b33395
+available in linux 2.6 and later) should be used.  This later set can
b33395
+also have a number appended to indicate how many partitions to create
b33395
+device files for, e.g.
b33395
+.BR auto=mdp5 .
b33395
+The default is 4.
b33395
+
b33395
+.TP
b33395
+.B bitmap=
b33395
+The option specifies a file in which a write-intent bitmap should be
b33395
+found.  When assembling the array,
b33395
+.I mdadm
b33395
+will provide this file to the
b33395
+.B md
b33395
+driver as the bitmap file.  This has the same function as the
b33395
+.B \-\-bitmap\-file
b33395
+option to
b33395
+.BR \-\-assemble .
b33395
+
b33395
+.TP
b33395
+.B metadata=
b33395
+Specify the metadata format that the array has.  This is mainly
b33395
+recognised for comparability with the output of
b33395
+.BR "mdadm \-Es" .
b33395
+
b33395
+.TP
b33395
+.B container=
b33395
+Specify that this array is a member array of some container.  The
b33395
+value given can be either a path name in /dev, or a UUID of the
b33395
+container array.
b33395
+
b33395
+.TP
b33395
+.B member=
b33395
+Specify that this array is a member array of some container.  Each
b33395
+type of container has some way to enumerate member arrays, often a
b33395
+simple sequence number.  The value identifies which member of a
b33395
+container the array is.  It will usually accompany a "container=" word.
b33395
+.RE
b33395
+
b33395
+.TP
b33395
+.B MAILADDR
b33395
+The
b33395
+.B mailaddr
b33395
+line gives an E-mail address that alerts should be
b33395
+sent to when
b33395
+.I mdadm
b33395
+is running in
b33395
+.B \-\-monitor
b33395
+mode (and was given the
b33395
+.B \-\-scan
b33395
+option).  There should only be one
b33395
+.B MAILADDR
b33395
+line and it should have only one address.  Any subsequent addresses
b33395
+are silently ignored.
b33395
+
b33395
+.TP
b33395
+.B MAILFROM
b33395
+The
b33395
+.B mailfrom
b33395
+line (which can only be abbreviated to at least 5 characters) gives an
b33395
+address to appear in the "From" address for alert mails.  This can be
b33395
+useful if you want to explicitly set a domain, as the default from
b33395
+address is "root" with no domain.  All words on this line are
b33395
+catenated with spaces to form the address.
b33395
+
b33395
+Note that this value cannot be set via the
b33395
+.I mdadm
b33395
+commandline.  It is only settable via the config file.
b33395
+
b33395
+.TP
b33395
+.B PROGRAM
b33395
+The
b33395
+.B program
b33395
+line gives the name of a program to be run when
b33395
+.B "mdadm \-\-monitor"
b33395
+detects potentially interesting events on any of the arrays that it
b33395
+is monitoring.  This program gets run with two or three arguments, they
b33395
+being the Event, the md device, and possibly the related component
b33395
+device.
b33395
+
b33395
+There should only be one
b33395
+.B program
b33395
+line and it should be give only one program.
b33395
+
b33395
+
b33395
+.TP
b33395
+.B CREATE
b33395
+The
b33395
+.B create
b33395
+line gives default values to be used when creating arrays, new members
b33395
+of arrays, and device entries for arrays.
b33395
+These include:
b33395
+
b33395
+.RS 4
b33395
+.TP
b33395
+.B owner=
b33395
+.TP
b33395
+.B group=
b33395
+These can give user/group ids or names to use instead of system
b33395
+defaults (root/wheel or root/disk).
b33395
+.TP
b33395
+.B mode=
b33395
+An octal file mode such as 0660 can be given to override the default
b33395
+of 0600.
b33395
+.TP
b33395
+.B auto=
b33395
+This corresponds to the
b33395
+.B \-\-auto
b33395
+flag to mdadm.  Give
b33395
+.BR yes ,
b33395
+.BR md ,
b33395
+.BR mdp ,
b33395
+.B part
b33395
+\(em possibly followed by a number of partitions \(em to indicate how
b33395
+missing device entries should be created.
b33395
+
b33395
+.TP
b33395
+.B metadata=
b33395
+The name of the metadata format to use if none is explicitly given.
b33395
+This can be useful to impose a system-wide default of version-1 superblocks.
b33395
+
b33395
+.TP
b33395
+.B symlinks=no
b33395
+Normally when creating devices in
b33395
+.B /dev/md/
b33395
+.I mdadm
b33395
+will create a matching symlink from
b33395
+.B /dev/
b33395
+with a name starting
b33395
+.B md
b33395
+or
b33395
+.BR md_ .
b33395
+Give
b33395
+.B symlinks=no
b33395
+to suppress this symlink creation.
b33395
+
b33395
+.TP
b33395
+.B names=yes
b33395
+Since Linux 2.6.29 it has been possible to create
b33395
+.B md
b33395
+devices with a name like
b33395
+.B md_home
b33395
+rather than just a number, like
b33395
+.BR md3 .
b33395
+.I mdadm
b33395
+will use the numeric alternative by default as other tools that interact
b33395
+with md arrays may expect only numbers.
b33395
+If
b33395
+.B names=yes
b33395
+is given in
b33395
+.I mdadm.conf
b33395
+then
b33395
+.I mdadm
b33395
+will use a name when appropriate.
b33395
+If
b33395
+.B names=no
b33395
+is given, then non-numeric
b33395
+.I md
b33395
+device names will not be used even if the default changes in a future
b33395
+release of
b33395
+.IR mdadm .
b33395
+
b33395
+.TP
b33395
+.B bbl=no
b33395
+By default,
b33395
+.I mdadm
b33395
+will reserve space for a bad block list (bbl) on all devices
b33395
+included in or added to any array that supports them.  Setting
b33395
+.B bbl=no
b33395
+will prevent this, so newly added devices will not have a bad
b33395
+block log.
b33395
+.RE
b33395
+
b33395
+.TP
b33395
+.B HOMEHOST
b33395
+The
b33395
+.B homehost
b33395
+line gives a default value for the
b33395
+.B \-\-homehost=
b33395
+option to mdadm.  There should normally be only one other word on the line.
b33395
+It should either be a host name, or one of the special words
b33395
+.BR <system>,
b33395
+.B <none>
b33395
+and
b33395
+.BR <ignore> .
b33395
+If
b33395
+.B <system>
b33395
+is given, then the
b33395
+.BR gethostname ( 2 )
b33395
+systemcall is used to get the host name.  This is the default.
b33395
+
b33395
+If
b33395
+.B <ignore>
b33395
+is given, then a flag is set so that when arrays are being
b33395
+auto-assembled the checking of the recorded
b33395
+.I homehost
b33395
+is disabled.
b33395
+If
b33395
+.B <ignore>
b33395
+is given it is also possible to give an explicit name which will be
b33395
+used when creating arrays.  This is the only case when there can be
b33395
+more that one other word on the
b33395
+.B HOMEHOST
b33395
+line.  If there are other words, or other
b33395
+.B HOMEHOST
b33395
+lines, they are silently ignored.
b33395
+
b33395
+If
b33395
+.B <none>
b33395
+is given, then the default of using
b33395
+.BR gethostname ( 2 )
b33395
+is over-ridden and no homehost name is assumed.
b33395
+
b33395
+When arrays are created, this host name will be stored in the
b33395
+metadata.  When arrays are assembled using auto-assembly, arrays which
b33395
+do not record the correct homehost name in their metadata will be
b33395
+assembled using a "foreign" name.  A "foreign" name alway ends with a
b33395
+digit string preceded by an underscore to differentiate it
b33395
+from any possible local name. e.g.
b33395
+.B /dev/md/1_1
b33395
+or
b33395
+.BR /dev/md/home_0 .
b33395
+.TP
b33395
+.B AUTO
b33395
+A list of names of metadata format can be given, each preceded by a
b33395
+plus or minus sign.  Also the word
b33395
+.I homehost
b33395
+is allowed as is
b33395
+.I all
b33395
+preceded by plus or minus sign.
b33395
+.I all
b33395
+is usually last.
b33395
+
b33395
+When
b33395
+.I mdadm
b33395
+is auto-assembling an array, either via
b33395
+.I \-\-assemble
b33395
+or
b33395
+.I \-\-incremental
b33395
+and it finds metadata of a given type, it checks that metadata type
b33395
+against those listed in this line.  The first match wins, where
b33395
+.I all
b33395
+matches anything.
b33395
+If a match is found that was preceded by a plus sign, the auto
b33395
+assembly is allowed.  If the match was preceded by a minus sign, the
b33395
+auto assembly is disallowed.  If no match is found, the auto assembly
b33395
+is allowed.
b33395
+
b33395
+If the metadata indicates that the array was created for
b33395
+.I this
b33395
+host, and the word
b33395
+.I homehost
b33395
+appears before any other match, then the array is treated as a valid
b33395
+candidate for auto-assembly.
b33395
+
b33395
+This can be used to disable all auto-assembly (so that only arrays
b33395
+explicitly listed in mdadm.conf or on the command line are assembled),
b33395
+or to disable assembly of certain metadata types which might be
b33395
+handled by other software.  It can also be used to disable assembly of
b33395
+all foreign arrays - normally such arrays are assembled but given a
b33395
+non-deterministic name in
b33395
+.BR /dev/md/ .
b33395
+
b33395
+The known metadata types are
b33395
+.BR 0.90 ,
b33395
+.BR 1.x ,
b33395
+.BR ddf ,
b33395
+.BR imsm .
b33395
+
b33395
+.B AUTO
b33395
+should be given at most once.  Subsequent lines are silently ignored.
b33395
+Thus an earlier config file in a config directory will over-ride
b33395
+the setting in a later config file.
b33395
+
b33395
+.TP
b33395
+.B POLICY
b33395
+This is used to specify what automatic behavior is allowed on devices
b33395
+newly appearing in the system and provides a way of marking spares that can
b33395
+be moved to other arrays as well as the migration domains.
b33395
+.I Domain
b33395
+can be defined through
b33395
+.I policy
b33395
+line by specifying a domain name for a number of paths from
b33395
+.BR /dev/disk/by-path/ .
b33395
+A device may belong to several domains. The domain of an array is a union
b33395
+of domains of all devices in that array.  A spare can be automatically
b33395
+moved from one array to another if the set of the destination array's
b33395
+.I domains
b33395
+contains all the
b33395
+.I domains
b33395
+of the new disk or if both arrays have the same
b33395
+.IR spare-group .
b33395
+
b33395
+To update hot plug configuration it is necessary to execute
b33395
+.B mdadm \-\-udev\-rules
b33395
+command after changing the config file
b33395
+
b33395
+Keywords used in the
b33395
+.I POLICY
b33395
+line and supported values are:
b33395
+
b33395
+.RS 4
b33395
+.TP
b33395
+.B domain=
b33395
+any arbitrary string
b33395
+.TP
b33395
+.B metadata=
b33395
+0.9 1.x ddf or imsm
b33395
+.TP
b33395
+.B path=
b33395
+file glob matching anything from
b33395
+.B /dev/disk/by-path
b33395
+.TP
b33395
+.B type=
b33395
+either
b33395
+.B disk
b33395
+or
b33395
+.BR part .
b33395
+.TP
b33395
+.B action=
b33395
+include, re-add, spare, spare-same-slot, or force-spare
b33395
+.TP
b33395
+.B auto=
b33395
+yes, no, or homehost.
b33395
+
b33395
+.P
b33395
+The
b33395
+.I action
b33395
+item determines the automatic behavior allowed for devices matching the
b33395
+.I path
b33395
+and
b33395
+.I type
b33395
+in the same line.  If a device matches several lines with different
b33395
+.I  actions
b33395
+then the most permissive will apply. The ordering of policy lines
b33395
+is irrelevant to the end result.
b33395
+.TP
b33395
+.B include
b33395
+allows adding a disk to an array if metadata on that disk matches that array
b33395
+.TP
b33395
+.B re\-add
b33395
+will include the device in the array if it appears to be a current member
b33395
+or a member that was recently removed and the array has a
b33395
+write-intent-bitmap to allow the
b33395
+.B re\-add
b33395
+functionality.
b33395
+.TP
b33395
+.B spare
b33395
+as above and additionally: if the device is bare it can
b33395
+become a spare if there is any array that it is a candidate for based
b33395
+on domains and metadata.
b33395
+.TP
b33395
+.B spare\-same\-slot
b33395
+as above and additionally if given slot was used by an array that went
b33395
+degraded recently and the device plugged in has no metadata then it will
b33395
+be automatically added to that array (or it's container)
b33395
+.TP
b33395
+.B force\-spare
b33395
+as above and the disk will become a spare in remaining cases
b33395
+.RE
b33395
+
b33395
+.TP
b33395
+.B PART-POLICY
b33395
+This is similar to
b33395
+.B POLICY
b33395
+and accepts the same keyword assignments.  It allows a consistent set
b33395
+of policies to applied to each of the partitions of a device.
b33395
+
b33395
+A
b33395
+.B PART-POLICY
b33395
+line should set
b33395
+.I type=disk
b33395
+and identify the path to one or more disk devices.  Each partition on
b33395
+these disks will be treated according to the
b33395
+.I action=
b33395
+setting  from this line.  If a
b33395
+.I domain
b33395
+is set in the line, then the domain associated with each patition will
b33395
+be based on the domain, but with
b33395
+.RB \(dq -part N\(dq
b33395
+appended, when N is the partition number for the partition that was
b33395
+found.
b33395
+
b33395
+.TP
b33395
+.B SYSFS
b33395
+The
b33395
+.B SYSFS
b33395
+line lists custom values of MD device's sysfs attributes which will be
b33395
+stored in sysfs after the array is assembled. Multiple lines are allowed and each
b33395
+line has to contain the uuid or the name of the device to which it relates.
b33395
+.RS 4
b33395
+.TP
b33395
+.B uuid=
b33395
+hexadecimal identifier of MD device. This has to match the uuid stored in the
b33395
+superblock.
b33395
+.TP
b33395
+.B name=
b33395
+name of the MD device as was given to
b33395
+.I mdadm
b33395
+when the array was created. It will be ignored if
b33395
+.B uuid
b33395
+is not empty.
b33395
+.RE
b33395
+
b33395
+.TP
b33395
+.B MONITORDELAY
b33395
+The
b33395
+.B monitordelay
b33395
+line gives a delay in seconds
b33395
+.I mdadm
b33395
+shall wait before pooling md arrays
b33395
+when
b33395
+.I mdadm
b33395
+is running in
b33395
+.B \-\-monitor
b33395
+mode.
b33395
+.B \-d/\-\-delay
b33395
+command line argument takes precedence over the config file
b33395
+
b33395
+.SH EXAMPLE
b33395
+DEVICE /dev/sd[bcdjkl]1
b33395
+.br
b33395
+DEVICE /dev/hda1 /dev/hdb1
b33395
+
b33395
+# /dev/md0 is known by its UUID.
b33395
+.br
b33395
+ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
b33395
+.br
b33395
+# /dev/md1 contains all devices with a minor number of
b33395
+.br
b33395
+#   1 in the superblock.
b33395
+.br
b33395
+ARRAY /dev/md1 superminor=1
b33395
+.br
b33395
+# /dev/md2 is made from precisely these two devices
b33395
+.br
b33395
+ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1
b33395
+
b33395
+# /dev/md4 and /dev/md5 are a spare-group and spares
b33395
+.br
b33395
+#  can be moved between them
b33395
+.br
b33395
+ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df
b33395
+.br
b33395
+           spare\-group=group1
b33395
+.br
b33395
+ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977
b33395
+.br
b33395
+           spare\-group=group1
b33395
+.br
b33395
+# /dev/md/home is created if need to be a partitionable md array
b33395
+.br
b33395
+# any spare device number is allocated.
b33395
+.br
b33395
+ARRAY /dev/md/home UUID=9187a482:5dde19d9:eea3cc4a:d646ab8b
b33395
+.br
b33395
+           auto=part
b33395
+.br
b33395
+# The name of this array contains a space.
b33395
+.br
b33395
+ARRAY /dev/md9 name='Data Storage'
b33395
+.sp
b33395
+POLICY domain=domain1 metadata=imsm path=pci-0000:00:1f.2-scsi-*
b33395
+.br
b33395
+           action=spare
b33395
+.br
b33395
+POLICY domain=domain1 metadata=imsm path=pci-0000:04:00.0-scsi-[01]*
b33395
+.br
b33395
+           action=include
b33395
+.br
b33395
+# One domain comprising of devices attached to specified paths is defined.
b33395
+.br
b33395
+# Bare device matching first path will be made an imsm spare on hot plug.
b33395
+.br
b33395
+# If more than one array is created on devices belonging to domain1 and
b33395
+.br
b33395
+# one of them becomes degraded, then any imsm spare matching any path for
b33395
+.br
b33395
+# given domain name can be migrated.
b33395
+.br
b33395
+MAILADDR root@mydomain.tld
b33395
+.br
b33395
+PROGRAM /usr/sbin/handle\-mdadm\-events
b33395
+.br
b33395
+CREATE group=system mode=0640 auto=part\-8
b33395
+.br
b33395
+HOMEHOST <system>
b33395
+.br
b33395
+AUTO +1.x homehost \-all
b33395
+.br
b33395
+SYSFS name=/dev/md/raid5 group_thread_cnt=4 sync_speed_max=1000000
b33395
+.br
b33395
+SYSFS uuid=bead5eb6:31c17a27:da120ba2:7dfda40d group_thread_cnt=4
b33395
+sync_speed_max=1000000
b33395
+.br
b33395
+MONITORDELAY 60
b33395
+
b33395
+.SH SEE ALSO
b33395
+.BR mdadm (8),
b33395
+.BR md (4).
b33395
-- 
b33395
2.31.1
b33395