Go to file
NeilBrown 632dc30ccf Fix bug with adding to 0.90 array
commit 7ccc4cc4fc
    Manage: remove call to validate_geometry.

used entirely the wrong number for "4TB" !!

Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-14 15:20:02 +10:00
misc mdadm-1.8.0 2004-11-01 04:49:34 +00:00
systemd mdmon: add --foreground option 2013-02-05 15:57:09 +11:00
tests tests/10ddf-fail-create-race: test handling of fail/create race 2013-08-08 09:56:13 +10:00
.gitignore Add some built files to .gitignore. 2013-05-13 17:11:42 +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.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 Don't set 'hold' option for mdstat_read if not needed. 2013-07-10 11:02:10 +10:00
bitmap.c Avoid using BLKFLSBUF. 2013-02-05 16:00:55 +11:00
bitmap.h Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
Build.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
ChangeLog Release mdadm-3.1.4 2010-08-31 17:21:13 +10:00
config.c Don't set 'hold' option for mdstat_read if not needed. 2013-07-10 11:02:10 +10:00
COPYING Update COPYING file. 2011-08-18 12:55:24 +10: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
Create.c Make sure NOFILE resource limit is big enough. 2013-05-30 14:31:09 +10:00
Detail.c Detail: Factor out add_device() 2013-07-02 09:43:51 +10: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 Add --dump / --restore functionality. 2013-05-16 15:07:16 +10:00
Examine.c MISC: Add --examine-badblocks option 2012-12-05 12:56:31 +11:00
external-reshape-design.txt Refactor reshape monitoring. 2011-01-06 15:58:32 +11:00
Grow.c Grow: exit background thread cleanly on SIGTERM. 2013-08-01 13:58:10 +10:00
Incremental.c Manage: split Manage_runstop into Manage_run and Manage_stop 2013-06-19 11:23:44 +10:00
INSTALL mdadm-0.8.1 2002-04-05 22:00:28 +00:00
inventory Create new release: 3.2.5 2012-05-18 17:10:03 +10: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 Discard devnum in favour of devnm 2013-02-21 17:05:23 +11:00
lib.c Introduce devid2kname - slightly different to devid2devnm. 2013-08-01 14:32:04 +10:00
makedist Makefile/version: use version/date from .git if possible. 2013-06-25 16:27:05 +10:00
Makefile Makefile: check that 'run' directory exists. 2013-08-05 16:42:12 +10:00
Manage.c Fix bug with adding to 0.90 array 2013-08-14 15:20:02 +10:00
managemon.c mdmon: don't use 'ghost' values from an inactive array. 2013-08-05 15:40:16 +10:00
mapfile.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
maps.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
md_p.h Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
md_u.h Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
md.4 align spelling of “RAID” and RAID levels 2013-07-10 23:32:22 +02:00
md5.h mdadm fix compilation for uClibc 2009-02-02 09:53:51 +11:00
mdadm.8.in mdadm.8: growing RAID10 chunk size is possible 2013-07-08 14:10:46 +10:00
mdadm.c Don't lie to systemd about mdadm's status. 2013-08-01 14:04:07 +10:00
mdadm.conf-example Adjust to new standard of /run 2012-05-03 14:16:56 +10:00
mdadm.conf.5 align spelling of “RAID” and RAID levels 2013-07-10 23:32:22 +02:00
mdadm.h mdmon: don't lie to systemd. 2013-08-01 15:59:24 +10:00
mdadm.spec man pages: remove references to raidtools. 2013-05-15 11:07:17 +10:00
mdassemble.8 align spelling of “RAID” and RAID levels 2013-07-10 23:32:22 +02:00
mdassemble.c mdassemble - fix new compile-time problems. 2013-05-13 17:05:16 +10:00
mdmon-design.txt mdmon-design.txt 2010-12-16 22:12:26 +11:00
mdmon.8 align spelling of “RAID” and RAID levels 2013-07-10 23:32:22 +02:00
mdmon.c mdmon: don't lie to systemd. 2013-08-01 15:59:24 +10:00
mdmon.h Fix is_resync_complete for RAID10 2013-07-31 09:22:18 +10:00
mdopen.c Move find_free_devnum to mdopen.c 2013-07-02 10:24:50 +10:00
mdstat.c Grow: use mdstat_wait to wait for delayed reshape. 2013-07-10 11:10:54 +10:00
mkinitramfs Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
monitor.c mdmon: wait_and_act: fix debug message for SIGUSR1 2013-07-31 12:59:40 +10:00
Monitor.c New function: sysfs_wait 2013-07-01 13:28:13 +10:00
msg.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
msg.h Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
part.h Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
platform-intel.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
platform-intel.h Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
policy.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
probe_roms.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +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 Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10: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 Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
ReadMe.c Change version to 3.3-rc2 2013-07-25 17:55:18 +10:00
README.initramfs Guides on how to use mdadm with initramfs 2005-12-05 05:56:42 +00:00
restripe.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
sg_io.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10: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 DDF: ddf_open_new: check device status for new subarray 2013-08-08 10:33:21 +10:00
super-gpt.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
super-intel.c Grow: exit background thread cleanly on SIGTERM. 2013-08-01 13:58:10 +10:00
super-mbr.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
super1.c super1: simplify setting of array size. 2013-07-30 17:05:47 +10:00
super0.c Manage: remove call to validate_geometry. 2013-07-30 13:45:22 +10:00
swap_super.c Remove lots of unnecessary white space. 2013-06-19 12:31:45 +10:00
sysfs.c Introduce devid2kname - slightly different to devid2devnm. 2013-08-01 14:32:04 +10:00
test test: allow LVM volumes or RAM disks as test devices 2013-08-06 09:56:21 +10:00
TODO Initial DDF support code. 2008-05-15 16:48:14 +10:00
udev-md-raid-arrays.rules udev: Fix order of execution of the md rules 2013-02-11 11:15:34 +11:00
udev-md-raid-assembly.rules udev: Fix order of execution of the md rules 2013-02-11 11:15:34 +11:00
util.c Create: fix warning about pre-existing filesystems. 2013-08-08 09:16:43 +10:00
xmalloc.c Move xmalloc et al into their own file 2012-09-10 17:23:59 +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' 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.