Go to file
NeilBrown 624c5ad4cb Make sure reshape_active is cleared by getinfo_super
There were cases where --detail would report phantom reshapes.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 16:15:29 +11:00
misc mdadm-1.8.0 2004-11-01 04:49:34 +00:00
tests Set default bitmap-chunksize for internal bitmaps to at least 64Meg 2009-11-17 13:15:34 +11:00
.gitignore .gitignore update 2009-04-14 10:19:04 +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.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
Assemble.c config: add 'homehost' option to 'AUTO' line. 2010-03-03 14:33:55 +11:00
bitmap.c imsm: add support for checkpointing via 'curr_migr_unit' 2009-12-21 17:54:32 -07:00
bitmap.h Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
Build.c Update copyright dates and remove references to @cse.unsw.edu.au 2009-06-02 14:35:45 +10:00
ChangeLog Release mdadm-3.1.1 2009-11-19 16:10:58 +11:00
config.c config: add 'homehost' option to 'AUTO' line. 2010-03-03 14:33:55 +11:00
COPYING mdctl-0.6 2002-03-06 23:17:40 +00:00
crc32.c Add crc32 files. 2008-05-15 16:48:10 +10:00
crc32.h Add crc32 files. 2008-05-15 16:48:10 +10:00
Create.c Create: Improve warning message about booting from v1.x 2010-02-01 10:37:58 +11:00
Detail.c Detail: Report state of FAILED when an array has too few devices to work. 2010-01-29 15:46:23 +11:00
dlink.c mdadm-1.5.0 2004-01-22 02:10:29 +00:00
dlink.h This is to avoid gcc warnings when building with strict-aliasing optimization 2006-05-29 02:06:32 +00:00
Examine.c Examine: don't count containers as spares 2009-09-15 11:35:28 -07:00
Grow.c Grow: fix problem with validating chunk size 2010-03-09 14:14:39 +11:00
Incremental.c config: add 'homehost' option to 'AUTO' line. 2010-03-03 14:33:55 +11:00
INSTALL mdadm-0.8.1 2002-04-05 22:00:28 +00:00
inventory Release mdadm-3.1.1 2009-11-19 16:10:58 +11:00
kernel-patch-2.6.18 Add new mode: --incremental 2006-12-21 17:10:52 +11:00
kernel-patch-2.6.18.6 Add new mode: --incremental 2006-12-21 17:10:52 +11:00
kernel-patch-2.6.19 Add new mode: --incremental 2006-12-21 17:10:52 +11:00
kernel-patch-2.6.25 Fix kernel patch 2008-07-12 20:27:39 +10:00
kernel-patch-2.6.27 mdmon: periodically retry to create the socket 2008-10-15 14:15:52 -07:00
Kill.c Kill: fix when zeroing busy devices. 2010-01-29 20:53:24 +11:00
makedist Release mdadm-3.0-devel3 2009-03-10 16:59:57 +11:00
Makefile allow redefinition of VAR_RUN 2010-03-03 12:23:30 +11:00
Manage.c Manage: fix regression on removing detached devices. 2010-03-03 13:16:24 +11:00
managemon.c mdmon: insist on creating .pid file at startup. 2010-02-08 17:26:18 +11:00
mapfile.c mapfile: use ALT_RUN as alternate place to store mapfile 2010-02-08 17:26:18 +11:00
md_p.h Assemble: include ACTIVE but not in-sync devices as non-spares. 2009-11-17 12:30:54 +11:00
md_u.h Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
md.4 md.4: various improvements to new section on scrubbing. 2010-01-29 10:21:56 +11:00
md5.h mdadm fix compilation for uClibc 2009-02-02 09:53:51 +11:00
mdadm.8 mdadm.8: improve hosthost documentation 2010-03-09 14:22:39 +11:00
mdadm.c Assemble: Handle assembling from config file which is out of order. 2010-02-24 11:16:56 +11:00
mdadm.conf-example config: add 'homehost' option to 'AUTO' line. 2010-03-03 14:33:55 +11:00
mdadm.conf.5 config: add 'homehost' option to 'AUTO' line. 2010-03-03 14:33:55 +11:00
mdadm.h config: add 'homehost' option to 'AUTO' line. 2010-03-03 14:33:55 +11:00
mdadm.spec Release mdadm-3.1.1 2009-11-19 16:10:58 +11:00
mdassemble.8 Release mdadm-3.1.1 2009-11-19 16:10:58 +11:00
mdassemble.c Replace all relevant occurrences of -4 with LEVEL_MULTIPATH 2009-11-17 12:31:12 +11:00
mdmon.8 mdmon.8: minor manpage update 2010-03-09 14:34:03 +11:00
mdmon.c mdmon: Check both RUN directories to find running mdmon 2010-03-03 12:07:18 +11:00
mdmon.h mdmon: insist on creating .pid file at startup. 2010-02-08 17:26:18 +11:00
mdopen.c Free some malloced memory that wasn't being freed. 2009-10-22 11:00:56 +11:00
mdstat.c mdmon: don't monitor /proc/mounts to decide when to create .pid file. 2010-02-08 17:26:18 +11:00
mkinitramfs Guides on how to use mdadm with initramfs 2005-12-05 05:56:42 +00:00
monitor.c mdmon: insist on creating .pid file at startup. 2010-02-08 17:26:18 +11:00
Monitor.c Monitor: add option to specify rebuild increments 2009-10-19 13:13:58 +11:00
msg.c fix mdmon takeover 2010-03-03 11:35:26 +11:00
msg.h mdmon: preserve socket over chroot 2009-10-13 17:41:58 -07:00
platform-intel.c Fix for buffer overflow defect. 2009-12-10 12:03:40 -07:00
platform-intel.h imsm: validate arrays being created against firmware capabilities 2008-12-08 16:59:18 -07:00
probe_roms.c Fix for resource leak on error path. 2009-12-10 12:03:40 -07:00
probe_roms.h platform: relax rom scanning alignment for ahci platforms 2009-07-31 17:11:41 -07:00
pwgr.c Improve compiling for static binaries. 2006-05-29 04:09:21 +00:00
Query.c Update copyright dates and remove references to @cse.unsw.edu.au 2009-06-02 14:35:45 +10:00
raid5extend.c Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
ReadMe.c mdadm-3.1.1 segfaults when mdadm -G -Z is used. 2010-02-01 09:12:31 +11:00
README.initramfs Guides on how to use mdadm with initramfs 2005-12-05 05:56:42 +00:00
restripe.c Add _FORTIFY_SOURCE to mdadm.O2 build. 2010-03-03 10:54:17 +11:00
sg_io.c update copyright headers 2008-10-28 10:55:29 -07:00
sha1.c Make homehost information appear in superblock. 2006-05-19 06:56:06 +00:00
sha1.h Make homehost information appear in superblock. 2006-05-19 06:56:06 +00:00
super-ddf.c Make sure reshape_active is cleared by getinfo_super 2010-03-09 16:15:29 +11:00
super-intel.c Make sure reshape_active is cleared by getinfo_super 2010-03-09 16:15:29 +11:00
super1.c super1: encourage data alignment on 1Meg boundary 2010-03-03 15:22:56 +11:00
super0.c Assemble: fix --force assembly of v1.x arrays which are recovering. 2010-02-04 12:02:09 +11:00
swap_super.c Getting ready for 2.0 release... 2005-08-26 02:26:37 +00:00
sysfs.c Merge branch 'klockwork' of git://github.com/djbw/mdadm 2009-12-30 13:46:52 +11:00
test Change default metadata from 0.90 to 1.1 2009-11-17 13:15:32 +11:00
TODO Initial DDF support code. 2008-05-15 16:48:14 +10:00
udev-md-raid.rules vol_id was removed by the udev upstream maintainer in May 2009. 2009-10-29 10:14:43 +11:00
util.c Improve partition table code. 2010-03-09 10:57:57 +11: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' or 'mdassemble' (which is a
trimmed-down 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.