Go to file
Dimitri John Ledkov 18552ef041 udev.rules: make safe timeouts compatible with split-usr systems.
Instead of /usr/bin/sh, and /usr/bin/echo, use /bin/sh and shell
built-in echo respectively. This makes
udev-md-raid-safe-timeouts.rules to be compatible with both usr-merged
and split-usr systems alike.

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2018-07-31 11:43:14 -04:00
clustermd_tests mdadm/test: mdadm needn't make install on the system 2018-06-01 12:46:13 -04:00
misc mdcheck: improve cleanup 2017-10-10 16:42:39 -04:00
systemd systemd: add %I to description of mdadm-last-resort services. 2017-11-01 17:24:40 -04:00
tests tests, imsm: Calculate expected array_size in proper way 2018-07-11 13:17:29 -04:00
.gitignore Add raid6check to .gitignore 2013-08-26 15:26:54 +10:00
ANNOUNCE-3.0 Release mdadm-3.0 2009-06-02 15:37:56 +10:00
ANNOUNCE-3.1 Release 3.1 2009-10-22 14:07:05 +11:00
ANNOUNCE-3.1.1 Release mdadm-3.1.1 2009-11-19 16:10:58 +11:00
ANNOUNCE-3.1.2 Add ANNOUNCE-3.1.2 2010-04-07 09:13:16 +10:00
ANNOUNCE-3.1.3 Release mdadm-3.1.3 2010-08-06 16:55:23 +10:00
ANNOUNCE-3.1.4 Release mdadm-3.1.4 2010-08-31 17:21:13 +10:00
ANNOUNCE-3.1.5 Release mdadm-3.1.5 2011-03-23 15:50:18 +11:00
ANNOUNCE-3.2 Release mdadm-3.2 - developer only release 2011-02-01 16:11:13 +11:00
ANNOUNCE-3.2.1 Release 3.2.1 2011-03-28 13:30:29 +11:00
ANNOUNCE-3.2.2 Release mdadm-3.2.2 2011-06-17 15:15:37 +10:00
ANNOUNCE-3.2.3 Release mdadm-3.2.3 2011-12-23 14:32:44 +11:00
ANNOUNCE-3.2.4 Create new release: 3.2.4 2012-05-09 09:42:57 +10:00
ANNOUNCE-3.2.5 Create new release: 3.2.5 2012-05-18 17:10:03 +10:00
ANNOUNCE-3.2.6 Add ANNOUNCE-3.2.6 from different branch 2013-08-26 15:28:43 +10:00
ANNOUNCE-3.3 Release mdadm-3.3 2013-09-03 14:47:47 +10:00
ANNOUNCE-3.3.1 Release mdadm-3.3.1 2014-06-05 16:54:24 +10:00
ANNOUNCE-3.3.2 Release mdadm-3.3.2 2014-08-21 20:16:56 +10:00
ANNOUNCE-3.3.3 Release mdadm-3.3.3 2015-07-24 16:18:17 +10:00
ANNOUNCE-3.3.4 Release mdadm-3.3.4 2015-08-03 16:17:13 +10:00
ANNOUNCE-3.4 Release mdadm-3.4 2016-01-28 17:14:56 +11:00
ANNOUNCE-3.0.1 Release mdadm-3.0.1 2009-09-25 17:08:19 +10:00
ANNOUNCE-3.0.2 Release mdadm-3.0.2 2009-09-25 18:19:07 +10:00
ANNOUNCE-3.0.3 Release 3.0.3 2009-10-22 12:05:22 +11:00
ANNOUNCE-4.0 Release mdadm-4.0 2017-01-09 16:46:34 -05:00
ANNOUNCE-4.1-rc1 mdadm: 4.1-rc1 2018-03-22 13:06:56 -04:00
Assemble.c Assemble: remove the protection when clustered raid do assemble 2018-07-20 15:40:20 -04:00
bitmap.c mdadm/bitmap: examine-bitmap failed when bitmap is external mode 2017-09-01 11:19:58 -04:00
bitmap.h mdadm/bitmap:fixed typos in comments of bitmap.h 2017-03-28 14:08:04 -04:00
Build.c Error messages should end with a newline character. 2017-08-16 08:25:07 -04:00
ChangeLog Release mdadm-3.3 2013-09-03 14:47:47 +10:00
config.c Free map to avoid resource leak issues 2018-06-11 06:35:41 -04:00
COPYING Update COPYING file. 2011-08-18 12:55:24 +10:00
coverity-gcc-hack.h gcc-8 coverity hack 2018-06-04 14:49:59 -04:00
crc32.c Add zlib license to crc32.c 2012-10-03 18:17:26 +10:00
crc32.h Add crc32 files. 2008-05-15 16:48:10 +10:00
crc32c.c add crc32c and use it for r5l checksum 2015-10-30 17:38:28 +11:00
Create.c imsm: Allow create RAID volume with link to container 2018-04-10 16:12:00 -04:00
Detail.c Free map to avoid resource leak issues 2018-06-11 06:35:41 -04:00
dlink.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
dlink.h Remove scattered checks for malloc success. 2012-07-09 17:14:16 +10:00
Dump.c Coverity: Resource leak: close fds and free array before return 2018-07-11 13:08:25 -04:00
Examine.c examine: tidy up some code. 2017-03-06 16:33:44 -05:00
external-reshape-design.txt Remove some trailing white space 2015-07-02 08:26:30 +10:00
Grow.c Coverity: Resource leak: close fd before return 2018-07-11 13:11:17 -04:00
Incremental.c Free map to avoid resource leak issues 2018-06-11 06:35:41 -04:00
INSTALL mdadm-0.8.1 2002-04-05 22:00:28 +00:00
inventory mdadm: 4.1-rc1 2018-03-22 13:06:56 -04:00
Kill.c Generic support for --consistency-policy and PPL 2017-03-29 11:32:15 -04:00
lib.c lib: devid2kname() should take a dev_t 2017-09-29 17:54:12 -04:00
makedist makedist: Fix to handle rc releases 2018-03-22 13:06:56 -04:00
Makefile gcc-8 coverity hack 2018-06-04 14:49:59 -04:00
Manage.c Manage_subdevs(): Use a dev_t 2017-09-29 18:08:01 -04:00
managemon.c managemon: Don't add disk to the array after it has started 2017-12-07 09:20:16 -05:00
mapfile.c mapfile: set *mapp to NULL after map_free 2018-07-19 13:19:35 -04:00
maps.c Don't use UnSet with consistency_policy 2017-04-24 17:10:56 -04:00
md_p.h imsm: PPL support 2017-03-29 11:32:49 -04:00
md_u.h md_u: Remove unused ioctl declaration of START_ARRAY 2017-06-02 13:49:53 -04:00
md.4 mdadm/md.4: set page-length as 1000 to avoid warnings from grotty 2017-05-09 10:52:38 -04:00
md5.h mdadm fix compilation for uClibc 2009-02-02 09:53:51 +11:00
mdadm.8.in imsm: Do not require MDADM_EXPERIMENTAL flag anymore 2018-05-31 11:30:36 -04:00
mdadm.c Free map to avoid resource leak issues 2018-06-11 06:35:41 -04:00
mdadm.conf-example Remove some trailing white space 2015-07-02 08:26:30 +10:00
mdadm.conf.5 config: new option to suppress adding bad block lists. 2014-08-07 12:23:45 +10:00
mdadm.h imsm: Do not require MDADM_EXPERIMENTAL flag anymore 2018-05-31 11:30:36 -04:00
mdadm.spec mdadm: 4.1-rc1 2018-03-22 13:06:56 -04:00
mdmon-design.txt mdmon-design.txt 2010-12-16 22:12:26 +11:00
mdmon.8 mdadm: 4.1-rc1 2018-03-22 13:06:56 -04:00
mdmon.c mdmon: Stop bothering about md_get_version() 2017-04-05 15:39:51 -04:00
mdmon.h mdmon: get safe mode delay file descriptor early 2017-10-04 11:41:57 -04:00
mdopen.c mdopen: fix gcc 8.1 string overflow error 2018-05-31 13:11:21 -04:00
mdstat.c mdadm/mdstat: correct the strncmp number 4 as 6 2017-10-10 16:38:02 -04:00
mkinitramfs Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
monitor.c mdadm: Fixup a large number of bad formatting of logical operators 2017-05-16 13:52:15 -04:00
Monitor.c Monitor: Increase size of percentalert to avoid gcc warning 2018-05-31 11:45:21 -04:00
msg.c Monitor/msg: Don't print error message if mdmon doesn't run 2017-11-21 13:26:09 -05:00
msg.h Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
part.h Fix bus error when accessing MBR partition records 2016-10-19 12:38:02 -04:00
platform-intel.c mdadm: Fixup more broken logical operator formatting 2017-05-16 13:59:43 -04:00
platform-intel.h imsm: count arrays under VMD HBAs correctly 2017-01-09 07:48:55 -05:00
policy.c policy.c: Avoid to take spare without defined domain by imsm 2018-01-21 16:19:25 -05:00
probe_roms.c Move ARRAY_SIZE macro to common include file. 2013-09-10 09:48:06 +10:00
probe_roms.h probe_roms: allow to probe expansion ROMs using vendor and device id. 2011-03-10 11:41:46 +11:00
pwgr.c Improve compiling for static binaries. 2006-05-29 04:09:21 +00:00
Query.c Check major number of block device when querying md device 2018-06-01 12:45:10 -04:00
raid5extend.c Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
raid6check.8 RAID-6 check standalone man page 2011-08-09 10:43:58 +10:00
raid6check.c Get failed disk count from array state 2017-06-05 11:11:36 -04:00
ReadMe.c mdadm: 4.1-rc1 2018-03-22 13:06:56 -04:00
README.initramfs mdassemble: Kill off the last remains 2017-05-04 11:57:41 -04:00
restripe.c mdadm: Fixup != broken formatting 2017-05-16 14:09:57 -04:00
sg_io.c imsm: fix reading scsi serial 2017-11-02 11:33:09 -04:00
sha1.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
sha1.h Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
super-ddf.c super-ddf: Fix gcc-8.1 overflow warnings 2018-05-31 16:07:33 -04:00
super-gpt.c Retire mdassemble 2017-04-11 12:54:26 -04:00
super-intel.c imsm: correct num_data_stripes in metadata map for migration 2018-06-08 13:36:36 -04:00
super-mbr.c Retire mdassemble 2017-04-11 12:54:26 -04:00
super1.c super1: Fix cases triggering gcc-8.1 strncpy truncate warning 2018-05-31 13:49:46 -04:00
super0.c super0: Use memmove() when adjusting sparc2.2 superblock data 2018-05-31 13:19:57 -04:00
swap_super.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
sysfs.c sysfs: include faulty drive in disk count 2017-11-09 15:45:52 -05:00
test tests/func.sh: Fix some total breakage in the test scripts 2018-04-11 17:27:28 -04:00
TODO Initial DDF support code. 2008-05-15 16:48:14 +10:00
udev-md-clustered-confirm-device.rules udev rules: introduce rules for cluster-md to confirm device 2017-08-02 09:30:51 -04:00
udev-md-raid-arrays.rules install: use BINDIR consistently to locate mdadm and mdmon 2014-05-22 17:13:02 +10:00
udev-md-raid-assembly.rules Use correct syntax for passing DEVLINKS to mdadm from udev 2017-08-16 08:25:07 -04:00
udev-md-raid-creating.rules Fix typo in new udev rule. 2017-05-05 11:07:00 -04:00
udev-md-raid-safe-timeouts.rules udev.rules: make safe timeouts compatible with split-usr systems. 2018-07-31 11:43:14 -04:00
util.c imsm: Do not require MDADM_EXPERIMENTAL flag anymore 2018-05-31 11:30:36 -04:00
xmalloc.c Don't ignore return value from read and write 2015-07-24 16:11:23 +10:00

Assembling md arrays at boot time.
---------------------------------
December 2005

These notes apply to 2.6 kernels only and, in some cases,
to 2.6.15 or later.

Md arrays can be assembled at boot time using the 'autodetect' functionality
which is triggered by storing components of an array in partitions of type
'fd' - Linux Raid Autodetect.
They can also be assembled by specifying the component devices in a
kernel parameter such as
  md=0,/dev/sda,/dev/sdb
In this case, /dev/md0 will be assembled (because of the 0) from the listed
devices.

These mechanisms, while useful, do not provide complete functionality
and are unlikely to be extended.  The preferred way to assemble md
arrays at boot time is using 'mdadm'.  To assemble an array which
contains the root filesystem, mdadm needs to be run before that
filesystem is mounted, and so needs to be run from an initial-ram-fs.
It is how this can work that is the primary focus of this document.

It should be noted up front that only the array containing the root
filesystem should be assembled from the initramfs.  Any other arrays
should be assembled under the control of files on the main filesystem
as this enhanced flexibility and maintainability.

A minimal initramfs for assembling md arrays can be created using 3
files and one directory.  These are:

/bin           Directory
/bin/mdadm     statically linked mdadm binary
/bin/busybox   statically linked busybox binary
/bin/sh        hard link to /bin/busybox
/init          a shell script which call mdadm appropriately.

An example init script is:

==============================================
#!/bin/sh

echo 'Auto-assembling boot md array'
mkdir /proc
mount -t proc proc /proc
if [ -n "$rootuuid" ]
then arg=--uuid=$rootuuid
elif [ -n "$mdminor" ]
then arg=--super-minor=$mdminor
else arg=--super-minor=0
fi
echo "Using $arg"
mdadm -Acpartitions $arg --auto=part /dev/mda
cd /
mount /dev/mda1 /root ||  mount /dev/mda /root
umount /proc
cd /root
exec chroot . /sbin/init < /dev/console > /dev/console 2>&1
=============================================

This could certainly be extended, or merged into a larger init script.
Though tested and in production use, it is not presented here as
"The Right Way" to do it, but as a useful example.
Some key points are:

  /proc needs to be mounted so that /proc/partitions can be accessed
  by mdadm, and so that /proc/filesystems can be accessed by mount.

  The uuid of the array can be passed in as a kernel parameter
  (rootuuid).  As the kernel doesn't use this value, it is made available
  in the environment for /init

  If no uuid is given, we default to md0, (--super-minor=0) which is a
  commonly used to store the root filesystem.  This may not work in
  all situations.

  We assemble the array as a partitionable array (/dev/mda) even if we
  end up using the whole array.  There is no cost in using the partitionable
  interface, and in this context it is simpler.

  We try mounting both /dev/mda1 and /dev/mda as they are the most like
  part of the array to contain the root filesystem.

  The --auto flag is given to mdadm so that it will create /dev/md*
  files automatically.  This is needed as /dev will not contain
  and md files, and udev will not create them (as udev only created device
  files after the device exists, and mdadm need the device file to create
  the device).  Note that the created md files may not exist in /dev
  of the mounted root filesystem.  This needs to be deal with separately
  from mdadm - possibly using udev.

  We do not need to create device files for the components which will
  be assembled into /dev/mda.  mdadm finds the major/minor numbers from
  /proc/partitions and creates a temporary /dev file if one doesn't already
  exist.

The script "mkinitramfs" which is included with the mdadm distribution
can be used to create a minimal initramfs.  It creates a file called
'init.cpio.gz' which can be specified as an 'initrd' to lilo or grub
(or whatever boot loader is being used).




Resume from an md array
-----------------------

If you want to make use of the suspend-to-disk/resume functionality in Linux,
and want to have swap on an md array, you will need to assemble the array
before resume is possible.
However, because the array is active in the resumed image, you do not want
anything written to any drives during the resume process, such as superblock
updates or array resync.

This can be achieved in 2.6.15-rc1 and later kernels using the
'start_readonly' module parameter.
Simply include the command
  echo 1 > /sys/module/md_mod/parameters/start_ro
before assembling the array with 'mdadm'.
You can then echo
  9:0
or whatever is appropriate to /sys/power/resume to trigger the resume.