.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\" See file COPYING in distribution for details.
-.TH MDADM 8 "" v2.6.7
+.TH MDADM 8 "" v3.0-rc1
.SH NAME
mdadm \- manage MD devices
.I aka
.BR RAID6 ,
.BR RAID10 ,
.BR MULTIPATH ,
+.BR FAULTY ,
and
-.BR FAULTY .
+.BR CONTAINER .
.B MULTIPATH
is not a Software RAID mechanism, but does involve
multiple devices:
each device is a path to one common physical storage device.
+New installations should not use md/multipath as it is not well
+supported and has no ongoing development. Use the Device Mapper based
+multipath-tools instead.
.B FAULTY
is also not true RAID, and it only involves one device. It
provides a layer over a true device that can be used to inject faults.
-.\".I mdadm
-.\"is a program that can be used to create, manage, and monitor
-.\"MD devices. As
-.\"such it provides a similar set of functionality to the
-.\".B raidtools
-.\"packages.
-.\"The key differences between
-.\".I mdadm
-.\"and
-.\".B raidtools
-.\"are:
-.\".IP \(bu 4
-.\".I mdadm
-.\"is a single program and not a collection of programs.
-.\".IP \(bu 4
-.\".I mdadm
-.\"can perform (almost) all of its functions without having a
-.\"configuration file and does not use one by default. Also
-.\".I mdadm
-.\"helps with management of the configuration
-.\"file.
-.\".IP \(bu 4
-.\".I mdadm
-.\"can provide information about your arrays (through Query, Detail, and Examine)
-.\"that
-.\".B raidtools
-.\"cannot.
-.\".P
-.\".I mdadm
-.\"does not use
-.\".IR /etc/raidtab ,
-.\"the
-.\".B raidtools
-.\"configuration file, at all. It has a different configuration file
-.\"with a different format and a different purpose.
+.B CONTAINER
+is different again. A
+.B CONTAINER
+is a collection of devices that are
+managed as a set. This is similar to the set of devices connected to
+a hardware RAID controller. The set of devices may contain a number
+of different RAID arrays each utilising some (or all) of the blocks from a
+number of the devices in the set. For example, two devices in a 5-device set
+might form a RAID1 using the whole devices. The remaining three might
+have a RAID5 over the first half of each device, and a RAID0 over the
+second half.
+
+With a
+.BR CONTAINER ,
+there is one set of metadata that describes all of
+the arrays in the container. So when
+.I mdadm
+creates a
+.B CONTAINER
+device, the device just represents the metadata. Other normal arrays (RAID1
+etc) can be created inside the container.
.SH MODES
mdadm has several major modes of operation:
.I mdadm
has a chance to include it in some array as appropriate.
+If a
+.B CONTAINER
+is passed to
+.I mdadm
+in this mode, then any arrays within that container will be assembled
+and started.
+
.TP
.B Manage
This is for doing things to specific components of an array such as
then nothing will be read, but
.I mdadm
will act as though the config file contained exactly
-.B "DEVICE partitions"
+.B "DEVICE partitions containers"
and will read
.B /proc/partitions
-to find a list of devices to scan.
+to find a list of devices to scan, and
+.B /proc/mdstat
+to find a list of containers to examine.
If the word
.B "none"
is given for the config file, then
The different sub-versions store the superblock at different locations
on the device, either at the end (for 1.0), at the start (for 1.1) or
4K from the start (for 1.2).
+.IP ddf
+Use the "Industry Standard" DDF (Disk Data Format) format. When
+creating a DDF array a
+.B CONTAINER
+will be created, and normal arrays can be created in that container.
+.IP imsm
+Use the Intel(R) Matrix Storage Manager metadata format. This creates a
+.B CONTAINER
+which is managed in a similar manner to DDF, and is supported by an
+option-rom on some platforms:
+.IP
+.B http://www.intel.com/design/chipsets/matrixstorage_sb.htm
+.PP
.RE
.TP
for the given homehost will be reported as such.
When using Auto-Assemble, only arrays tagged for the given homehost
-will be assembled.
+will be allowed to use 'local' names (i.e. not ending in '_' followed
+by a digit string).
.SH For create, build, or grow:
.B max
which means to choose the largest size that fits on all current drives.
+This value can not be used with
+.B CONTAINER
+metadata such as DDF and IMSM.
+
.TP
.BR \-c ", " \-\-chunk=
Specify chunk size of kibibytes. The default is 64.
Set raid level. When used with
.BR \-\-create ,
options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid4, 4,
-raid5, 5, raid6, 6, raid10, 10, multipath, mp, faulty. Obviously some of these are synonymous.
+raid5, 5, raid6, 6, raid10, 10, multipath, mp, faulty, container.
+Obviously some of these are synonymous.
+
+When a
+.B CONTAINER
+metadata type is requested, only the
+.B container
+level is permitted, and it does not need to be explicitly given.
When used with
.BR \-\-build ,
See the section below on RAID_DEVICE CHANGES. The file should be
stored on a separate device, not on the raid array being reshaped.
+.TP
+.BR \-\-array-size= ", " \-Z
+Set the size of the array which is seen by users of the device such as
+filesystems. This can be less that the real size, but never greater.
+The size set this way does not persist across restarts of the array.
+
+This is most useful when reducing the number of devices in a RAID5 or
+RAID6. Such arrays require the array-size to be reduced before a
+reshape can be performed that reduces the real size.
+
+A value of
+.B max
+restores the apparent size of the array to be whatever the real
+amount of available space is.
+
.TP
.BR \-N ", " \-\-name=
Set a
will not try to be so clever.
.TP
-.BR \-a ", " "\-\-auto{=no,yes,md,mdp,part,p}{NN}"
-Instruct mdadm to create the device file if needed, possibly allocating
+.BR \-a ", " "\-\-auto{=yes,md,mdp,part,p}{NN}"
+Instruct mdadm how to create the device file if needed, possibly allocating
an unused minor number. "md" causes a non-partitionable array
-to be used. "mdp", "part" or "p" causes a partitionable array (2.6 and
+to be used (though since Linux 2.6.28, these array devices are in fact
+partitionable). "mdp", "part" or "p" causes a partitionable array (2.6 and
later) to be used. "yes" requires the named md device to have
a 'standard' format, and the type and minor number will be determined
-from this. See DEVICE NAMES below.
+from this. With mdadm 3.0, device creation is normally left up to
+.I udev
+so this option is unlikely to be needed.
+See DEVICE NAMES below.
The argument can also come immediately after
"\-a". e.g. "\-ap".
end of this option (e.g.
.BR \-\-auto=p7 ).
If the device name ends with a digit, the partition names add a 'p',
-and a number, e.g. "/dev/home1p3". If there is no
+and a number, e.g. "/dev/md/home1p3". If there is no
trailing digit, then the partition names just have a number added,
-e.g. "/dev/scratch3".
+e.g. "/dev/md/scratch3".
If the md device name is in a 'standard' format as described in DEVICE
NAMES, then it will be created, if necessary, with the appropriate
formats, then a unused minor number will be allocated. The minor
number will be considered unused if there is no active array for that
number, and there is no entry in /dev for that number and with a
-non-standard name.
-
-.TP
-.BR \-\-symlink = no
-Normally when
-.B \-\-auto
-causes
-.I mdadm
-to create devices in
-.B /dev/md/
-it will also create symlinks from
-.B /dev/
-with names starting with
-.B md
-or
-.BR md_ .
-Use
-.B \-\-symlink=no
-to suppress this, or
-.B \-\-symlink=yes
-to enforce this even if it is suppressing
-.IR mdadm.conf .
-
+non-standard name. Name that are not in 'standard' format are only
+allowed in "/dev/md/".
+
+\".TP
+\".BR \-\-symlink = no
+\"Normally when
+\".B \-\-auto
+\"causes
+\".I mdadm
+\"to create devices in
+\".B /dev/md/
+\"it will also create symlinks from
+\".B /dev/
+\"with names starting with
+\".B md
+\"or
+\".BR md_ .
+\"Use
+\".B \-\-symlink=no
+\"to suppress this, or
+\".B \-\-symlink=yes
+\"to enforce this even if it is suppressing
+\".IR mdadm.conf .
+\"
.SH For assemble:
same as
.BR \-\-fail .
+.TP
+.BR \-\-write\-mostly
+Subsequent devices that are added or re-added will have the 'write-mostly'
+flag set. This is only valid for RAID! and means that the 'md' driver
+will avoid reading from these devices if possible.
+.TP
+.BR \-\-readwrite
+Subsequent devices that are added or re-added will have the 'write-mostly'
+flag cleared.
+
+
.P
Each of these options require that the first device listed is the array
to be acted upon, and the remainder are component devices to be added,
.BR \-D ", " \-\-detail
Print detail of one or more md devices.
+.TP
+.BR \-\-detail\-platform
+Print detail of the platform's raid capabilities (firmware / hardware
+topology) for a given metadata format.
+
.TP
.BR \-Y ", " \-\-export
When used with
will return with success if it actually waited for every device
listed, otherwise it will return failure.
+.TP
+.BR \-\-wait\-clean
+For each md device given, or each device in /proc/mdstat if
+.B \-\-scan
+is given, arrange for the array to be marked clean as soon as possible.
+Also, quiesce resync so that the monitor for external metadata arrays
+(mdmon) has an opportunity to checkpoint the resync position.
+.I mdadm
+will return with success if the array uses external metadata and we
+successfully waited. For native arrays this returns immediately as the
+kernel handles both dirty-clean transitions and resync checkpointing in
+the kernel at shutdown. No action is taken if safe-mode handling is
+disabled.
+
.SH For Incremental Assembly mode:
.TP
.BR \-\-rebuild\-map ", " \-r
Run any array assembled as soon as a minimal number of devices are
available, rather than waiting until all expected devices are present.
+.TP
+.B \-\-no\-degraded
+This allows the hot-plug system to prevent arrays from running when it knows
+that more disks may arrive later in the discovery process.
+
.TP
.BR \-\-scan ", " \-s
Only meaningful with
In the second usage example, all devices listed are treated as md
devices and assembly is attempted.
In the third (where no devices are listed) all md devices that are
-listed in the configuration file are assembled.
+listed in the configuration file are assembled. Then any arrays that
+can be found on unused devices will also be assembled.
If precisely one device is listed, but
.B \-\-scan
.BR \-\-scan .
In the later case,
.B /etc/mdadm.conf
+or
+.B /etc/mdadm/mdadm.conf
is used.
If
will first attempt to assemble all the arrays listed in the config
file.
-If a
-.B homehost
-has been specified (either in the config file or on the command line),
-.I mdadm
-will look further for possible arrays and will try to assemble
-anything that it finds which is tagged as belonging to the given
-homehost. This is the only situation where
-.I mdadm
-will assemble arrays without being given specific device name or
-identity information for the array.
+It will then look further for possible arrays and will try to assemble
+anything that it finds. Arrays which are tagged as belonging to the given
+homehost will be assembled and started normally. Arrays which do not
+obviously belong to this host are given names that are expected not to
+conflict with anything local, and are started "read-auto" so that
+nothing is written to any device until the array is written to. i.e.
+automatic resync etc is delayed.
If
.I mdadm
.\".B \-\-size
.\"is given, the apparent size of the smallest drive given is used.
+When creating an array within a
+.B CONTAINER
+.I mdadm
+can be given either the list of devices to use, or simply the name of
+the container. The former case gives control over which devices in
+the container will be used for the array. The latter case allows
+.I mdadm
+to automatically choose which devices to use based on how much spare
+space is available.
+
The General Management options that are valid with
.B \-\-create
are:
There was an error while trying to get information about the device.
.RE
+.TP
+.B \-\-detail\-platform
+Print detail of the platform's raid capabilities (firmware / hardware
+topology). If the metadata is specified with
+.B \-e
+or
+.B \-\-metadata=
+then the return status will be:
+.RS
+.TP
+0
+metadata successfully enumerated its platform components on this system
+.TP
+1
+metadata is platform independent
+.TP
+2
+metadata failed to find its platform components on this system
+.RE
+
.TP
.B \-\-examine
The device should be a component of an md array.
remove a write-intent bitmap from such an array.
.PP
+GROW mode is not currently supported for
+.B CONTAINERS
+or arrays inside containers.
+
.SS SIZE CHANGES
Normally when an array is built the "size" it taken from the smallest
of the drives. If all the small drives in an arrays are, one at a
.B "mdadm \-\-incremental"
to be conditionally added to an appropriate array.
+If the device passed is a
+.B CONTAINER
+device created by a previous call to
+.IR mdadm ,
+then rather than trying to add that device to an array, all the arrays
+described by the metadata of the container will be started.
+
.I mdadm
performs a number of tests to determine if the device is part of an
array, and which array it should be part of. If an appropriate array
(active or spare) parts of that array. It does not currently support
automatic inclusion of a new drive as a spare in some array.
-.B "mdadm \-\-incremental"
-requires a bug-fix in all kernels through 2.6.19.
-Hopefully, this will be fixed in 2.6.20; alternately, apply the patch
-which is included with the mdadm source distribution. If
-.I mdadm
-detects that this bug is present, it will abort any attempt to use
-.BR \-\-incremental .
-
The tests that
.I mdadm
makes are as follow:
Setting this value to 1 will prevent mdadm from automatically launching
mdmon. This variable is intended primarily for debugging mdadm/mdmon.
+.TP
+.B MDADM_NO_UDEV
+Normally,
+.I mdadm
+does not create any device nodes in /dev, but leaves that task to
+.IR udev .
+If
+.I udev
+appears not to be configured, or if this environment variable is set
+to '1', the
+.I mdadm
+will create and devices that are needed.
+
.SH EXAMPLES
.B " mdadm \-\-query /dev/name-of-device"
Any devices which are components of /dev/md4 will be marked as faulty
and then remove from the array.
+.B " mdadm --create /dev/md/ddf --metadata=ddf --raid-disks 6 /dev/sd[a-f]"
+.br
+Create a DDF array over 6 devices.
+
+.B " mdadm --create /dev/md/home -n3 -l5 -z 30000000 /dev/md/ddf"
+.br
+Create a raid5 array over any 3 devices in the given DDF set. Use
+only 30 gigabytes of each device.
+
+.B " mdadm -A /dev/md/ddf1 /dev/sd[a-f]"
+.br
+Assemble a pre-exist ddf array.
+
+.B " mdadm -I /dev/md/ddf1"
+.br
+Assemble all arrays contained in the ddf array, assigning names as
+appropriate.
+
.B " mdadm \-\-create \-\-help"
.br
Provide help about the Create mode.
.SH DEVICE NAMES
-While entries in the /dev directory can have any format you like,
.I mdadm
-has an understanding of 'standard' formats which it uses to guide its
-behaviour when creating device files via the
-.B \-\-auto
-option.
+understand two sorts of names for array devices.
+
+The first is the so-called 'standard' format name, which matches the
+names used by the kernel and which appear in
+.IR /proc/mdstat .
+
+The second sort can be freely chosen, but must reside in
+.IR /dev/md/ .
+When giving a device name to
+.I mdadm
+to create or assemble an array, either full path name such as
+.I /dev/md0
+or
+.I /dev/md/home
+can be given, or just the suffix of the second sort of name, such as
+.I home
+can be given.
+
+When
+.I mdadm
+chooses device names during auto-assembly, it will normally add a
+small sequence number to the end of the name to avoid conflicted
+between multiple arrays that have the same name. If
+.I mdadm
+can reasonably determine that the array really is meant for this host,
+either by a hostname in the metadata, or by the presence of the array
+in /etc/mdadm.conf, then it will leave of the suffix if possible.
The standard names for non-partitioned arrays (the only sort of md
-array available in 2.4 and earlier) are either of
+array available in 2.4 and earlier) are of the form
.IP
/dev/mdNN
-.br
-/dev/md/NN
.PP
where NN is a number.
The standard names for partitionable arrays (as available from 2.6
-onwards) are either of
+onwards) are of the form
.IP
-/dev/md/dNN
-.br
/dev/md_dNN
.PP
Partition numbers should be indicated by added "pMM" to these, thus "/dev/md/d1p2".
+.PP
+From kernel version, 2.6.28 the "non-partitioned array" can actually
+be partitioned. So the "md_dNN" names are no longer needed, and
+partitions such as "/dev/mdNNpXX" are possible.
.SH NOTE
.I mdadm
.SH SEE ALSO
For further information on mdadm usage, MD and the various levels of
RAID, see:
-
.IP
-.UR http://linux-raid.osdl.org/
-http://linux\-raid.osdl.org/
-.UE
+.B http://linux\-raid.osdl.org/
.PP
(based upon Jakob \(/Ostergaard's Software\-RAID.HOWTO)
.\".PP
.I mdadm
should always be available from
.IP
-.UR http://www.kernel.org/pub/linux/utils/raid/mdadm/
-http://www.kernel.org/pub/linux/utils/raid/mdadm/
-.UE
+.B http://www.kernel.org/pub/linux/utils/raid/mdadm/
+.PP
+Related man pages:
.PP
.IR mdadm.conf (5),
.IR md (4).