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

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