SHA256
1
0
forked from pool/mdadm
OBS User unknown 2007-01-10 16:49:57 +00:00 committed by Git OBS Bridge
parent c6d3953365
commit 80762580fa
14 changed files with 398 additions and 774 deletions

View File

@ -1,35 +0,0 @@
# do not edit this file, it will be overwritten on update
SUBSYSTEM!="block", GOTO="md_end"
ACTION!="add|change", GOTO="md_end"
# import data from a raid member and activate it
ENV{ID_FS_TYPE}=="linux_raid_member", PROGRAM="grep -qs '^AUTO -all' /etc/mdadm.conf", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
# import data from a raid set
KERNEL!="md*", GOTO="md_end"
# container devices have a metadata version of e.g. 'external:ddf' and
# never leave state 'inactive'
ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
LABEL="md_ignore_state"
IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
ENV{DEVTYPE}!="partition", GOTO="md_vol_id"
IMPORT{program}="/sbin/mdadm --detail --export %r/$parent"
ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
LABEL="md_vol_id"
IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
OPTIONS+="link_priority=100"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
LABEL="md_end"

44
boot.md
View File

@ -22,9 +22,7 @@
### BEGIN INIT INFO
# Provides: boot.md
# Required-Start: boot.udev boot.rootfsck
# Required-Stop: $null
# Should-Start: boot.scsidev boot.multipath
# Should-Stop: boot.scsidev boot.multipath
# X-SUSE-Should-Start: boot.scsidev boot.multipath
# Default-Start: B
# Default-Stop:
# Short-Description: Multiple Device RAID
@ -77,11 +75,13 @@ rc_reset
# considered a success.
mdadm_BIN=/sbin/mdadm
mdrun_BIN=/sbin/mdrun
raidautorun_BIN=/sbin/raidautorun
mdadm_CONFIG="/etc/mdadm.conf"
mdadm_SYSCONFIG="/etc/sysconfig/mdadm"
# udev integration
if [ -x /sbin/udevadm ] ; then
if [ -x /sbin/udevsettle ] ; then
[ -z "$MDADM_DEVICE_TIMEOUT" ] && MDADM_DEVICE_TIMEOUT=60
else
MDADM_DEVICE_TIMEOUT=0
@ -98,14 +98,6 @@ case "$1" in
start)
echo -n "Starting MD Raid "
# create the /var/run/mdadm symlink if needed
mkdir -p /dev/.mdadm
if test ! /dev/.mdadm -ef /var/run/mdadm; then
rm -rf /var/run/mdadm
ln -s /dev/.mdadm /var/run/mdadm
fi
# restart mdmon (exits silently if there is nothing to monitor)
/sbin/mdmon /proc/mdstat /
# Check for existence of needed config file and read it
[ -r $mdadm_SYSCONFIG ] || _rc_exit 6 "... $mdadm_SYSCONFIG not existing "
@ -116,25 +108,31 @@ case "$1" in
# Check for missing binaries (stale symlinks should not happen)
[ -x $mdadm_BIN ] || _rc_exit 5 "... $mdadm_BIN not installed "
[ -x $mdrun_BIN ] || _rc_exit 5 "... $mdrun_BIN not installed "
# Try to load md_mod
[ ! -f /proc/mdstat -a -x /sbin/modprobe ] && /sbin/modprobe md_mod
[ ! -f /proc/mdstat -a -x /sbin/modprobe ] && /sbin/modprobe -k md_mod 2>&1 | :
[ -f /proc/mdstat ] || _rc_exit 5 "... no MD support in kernel "
# Wait for udev to settle
if [ "$MDADM_DEVICE_TIMEOUT" -gt 0 ] ; then
/sbin/udevadm settle --timeout="$MDADM_DEVICE_TIMEOUT"
/sbin/udevsettle --timeout="$MDADM_DEVICE_TIMEOUT"
fi
if ! grep -qs '^[^#]*[^[:blank:]#]' $mdadm_CONFIG; then
# empty or missing /etc/mdadm.conf, "unused"
rc_status -u
else
$mdadm_BIN -A -s -c $mdadm_CONFIG
# a status of 2 is not an error
test $? -eq 0 -o $? -eq 2
rc_status -v
# Fallback to raidautorun / mdrun when $mdadm_CONFIG missing
# or mdadm exits with an error
[ "$BOOT_MD_USE_MDADM_CONFIG" = "yes" -a -s "$mdadm_CONFIG" ]
[ $? = 0 ] && { $mdadm_BIN -A -s -c $mdadm_CONFIG || rc_failed 1; }
if [ $? != 0 ]; then
if test -b /dev/md0; then
$raidautorun_BIN
else
$mdrun_BIN
fi
fi
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down MD Raid "
@ -152,5 +150,3 @@ case "$1" in
;;
esac
rc_exit
# vim:ft=sh

11
mdadm-2.5.3-infoname.diff Normal file
View File

@ -0,0 +1,11 @@
--- super1.c
+++ super1.c
@@ -538,7 +538,7 @@
strncpy(info->name, c+1, 31 - (c-sb->set_name));
else
strncpy(info->name, sb->set_name, 32);
- info->name[33] = 0;
+ info->name[32] = 0;
}
if (strcmp(update, "name") == 0) {
if (info->name[0] == 0)

3
mdadm-2.5.3.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:22e8364dcc528b1e5e4ee8f25ef4a6f0e9c648f1f1d2d7dbe688c929a3369672
size 135019

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b51a52aebfb83b09ae7faee9eebb4d49a7ad27767bcc9569079df62c7d510599
size 257554

View File

@ -1,472 +1,3 @@
-------------------------------------------------------------------
Thu Mar 11 10:18:18 CET 2010 - mmarek@suse.cz
- 64-md-raid.rules: Use blkid instead of vol_id.
-------------------------------------------------------------------
Thu Mar 11 09:58:21 CET 2010 - mmarek@suse.cz
- 64-md-raid.rules: Allow --incremental assembly if "AUTO -all" is
given in mdadm.conf (fate#307478).
-------------------------------------------------------------------
Tue Mar 9 16:15:41 CET 2010 - mmarek@suse.cz
- Install udev rules in /lib/udev/rules.d (fate#307478).
-------------------------------------------------------------------
Mon Feb 22 15:14:03 CET 2010 - mmarek@suse.cz
- mkinitrd-setup.sh: call mdadm --scan only if necessary
(bnc#581769).
Fri Jan 15 17:37:26 CET 2010 - mmarek@suse.cz
- fix modprobe invocation in boot.md (bnc#565293).
-------------------------------------------------------------------
Fri Jan 15 17:04:06 CET 2010 - mmarek@suse.cz
- store mdmon runtime files in /dev/.mdadm, to make it easier to
transfer mdmon from the initrd to the real root.
- rework the mkinitrd setup script a bit.
-------------------------------------------------------------------
Wed Jan 6 15:47:03 CET 2010 - mmarek@suse.cz
- mkinitrd-*.sh: fix booting from partitionable md devices and
from container devices (bnc#565219).
-------------------------------------------------------------------
Tue Dec 15 20:26:46 CET 2009 - jengelh@medozas.de
- enable parallel building
-------------------------------------------------------------------
Fri Dec 4 18:00:40 CET 2009 - mmarek@suse.cz
- Support for partitionable md devices in mkinitrd scripts
(fate#305883).
-------------------------------------------------------------------
Tue Nov 3 11:03:54 CET 2009 - mmarek@suse.cz
- update to 3.0.3 (fate#307159)
* mdmon improvements (needed for fate#306823)
* other fixes
-------------------------------------------------------------------
Fri Oct 30 16:49:40 CET 2009 - mmarek@suse.cz
- mkinitrd-boot.sh: add /sbin/mdmon to the initrd (fate#306823).
-------------------------------------------------------------------
Thu Oct 1 10:51:38 CEST 2009 - mmarek@suse.cz
- updated to 3.0.2 + 2 patches
* bugfixes only
-------------------------------------------------------------------
Fri Jun 12 09:43:43 CEST 2009 - mmarek@suse.cz
- remove static md* device nodes, they should not be needed
anymore.
-------------------------------------------------------------------
Thu Jun 11 11:32:55 CEST 2009 - mmarek@suse.cz
- updated to 3.0 final
- dropped all patches
-------------------------------------------------------------------
Tue Mar 3 10:36:11 CET 2009 - mmarek@suse.cz
- super0: Do all metadata IO with 4096byte alignment
- super1 - do metadata IO in sector_size units.
(bnc#466172)
-------------------------------------------------------------------
Sat Feb 21 15:37:55 CET 2009 - mmarek@suse.cz
- mkinitrd-setup.sh: filter out duplicate devices (bnc#461673,
patch by Xin Wei Hu)
-------------------------------------------------------------------
Tue Feb 17 17:01:23 CET 2009 - mmarek@suse.cz
- disable auto-assemly in boot.md completely as it can collide with
dmraid (bnc#474652). If someone wants to auto-assemble md arrays
in the rescue system, they can run
'mdadm -Es -c partitions >mdadm.conf && mdadm -As -c mdadm.conf'
manually.
-------------------------------------------------------------------
Mon Feb 16 16:00:11 CET 2009 - mmarek@suse.cz
- fix segfault when stopping imsm arrays
(bnc#473947, patch by Dan Williams)
-------------------------------------------------------------------
Mon Jan 26 11:47:59 CET 2009 - ro@suse.de
- change fillup call from "-Y" to "-y" the boot script has
been present in this package for long enough (SLES10-GA)
-------------------------------------------------------------------
Fri Dec 5 10:21:10 CET 2008 - hare@suse.de
- Wait for udev to settle before continuing (bnc#435778)
-------------------------------------------------------------------
Fri Dec 5 06:18:44 CET 2008 - nfbrown@suse.de
- boot.md : an exit status of '2' from "mdadm --assemble"
should not be seen as failure by boot.md.
It happens if one or more arrays is already
assembled.
(bnc#456028)
-------------------------------------------------------------------
Thu Nov 20 07:07:06 CET 2008 - nfbrown@suse.de
- don-t-auto-assemble-if-any-arrays-are-list.patch
Avoid assembling extra arrays during initrd
processing. bnc#445438
-------------------------------------------------------------------
Thu Nov 20 04:57:30 CET 2008 - nfbrown@suse.de
- mdmon-pass-symbolic-name-to-mdmon-instead-of-device.patch
avoid problems if mdmon is run before
udev creates any devices.
-------------------------------------------------------------------
Fri Nov 14 05:33:41 CET 2008 - nfbrown@suse.de
- intel.fixes.patch : various fixes from intel for
proper handling of their metadata
- name.fixes.patch : various fixes for new handling
of device names - one could cause a crash.
-------------------------------------------------------------------
Sun Nov 9 23:38:39 CET 2008 - ro@suse.de
- fix patch apply depth
-------------------------------------------------------------------
Fri Nov 7 12:34:30 CET 2008 - nfbrown@suse.de
- mdadm-auto-assemble.patch - fix various bugs in
auto-assemble
- start-kpartx-for-imsm-devices.patch - IMSM devices
need to be partitioned, and may programs including
YaST don't understand partitioned md devices,
so run kpartx to create 'dm' based partitions which
have a better chance for being understood
This relates to FATE#304220
-------------------------------------------------------------------
Fri Nov 7 10:32:35 CET 2008 - ro@suse.de
- remove udev rule (conflicting with file in udev package)
-------------------------------------------------------------------
Fri Nov 7 02:58:40 CET 2008 - ro@suse.de
- buildfix: add missing DESTDIR to Makefile for udev rule
- fix len in snprintf to silence compiler warning about potential
overflow
-------------------------------------------------------------------
Thu Nov 6 03:22:50 CET 2008 - nfbrown@suse.de
- Update from mdadm-3.0-devel1 to mdadm-3.0-devel2.
This includes various bug fixes and enhancements to the
extent that DDF and IMSM work reasonably well and can be
auto-assembled much like other arrays.
- Allow BOOT_MD_USE_MDADM_CONFIG to have the value 'part'
that, like 'no', arrays are auto-assembled. However they
get assembled as 'mdp' partitionable arrays where possible.
This currently only affect arrays with v1.x metadata.
This supports FATE#303894
-------------------------------------------------------------------
Fri Oct 3 15:28:49 CEST 2008 - mmarek@suse.cz
- fixed mdmon's clone_monitor on ia64
-------------------------------------------------------------------
Fri Oct 3 14:28:55 CEST 2008 - mmarek@suse.cz
- fixed byte swapping in super-intel.c on big endian.
-------------------------------------------------------------------
Wed Sep 24 18:24:25 CEST 2008 - ro@suse.de
- change "udevsettle" to "udevadm settle"
-------------------------------------------------------------------
Fri Sep 19 11:14:05 CEST 2008 - mmarek@suse.cz
- added /var/run/mdadm for mdmon
- fixed build
-------------------------------------------------------------------
Thu Sep 18 09:33:19 CEST 2008 - nfbrown@suse.de
- update to mdadm-3.0-devel1
package version number is set to 3.0 to avodi future confusion.
This is a substantial update that provides support for handling
the metadata entirely in userspace and thus making easier to
handle a variety of metadata formats. Support is included for
DDF and for the Intel Matrix metadata used by recent ICH chipsets.
An extra program 'mdmon' is needed and included. It is run to
monitor any array using 'external' (to the kernel) metadata
and will update the metadata in response to device failures etc.
This is required for FATE 304219
-------------------------------------------------------------------
Wed Sep 3 11:09:34 CEST 2008 - hare@suse.de
- Call mkinitrd_setup during %post and %postun (bnc#413709)
-------------------------------------------------------------------
Sun Aug 17 08:04:26 CEST 2008 - aj@suse.de
- Fix init scripts.
-------------------------------------------------------------------
Wed Jul 23 15:21:59 CEST 2008 - hare@suse.de
- Include mkinitrd scriptlets.
-------------------------------------------------------------------
Fri Jun 20 14:28:20 CEST 2008 - mmarek@suse.cz
- updated to 2.6.7 + fixes from git
* Avoid segfault when parsing /proc/mdstat with auto-read-only
arrays.
* For v0.90 superblocks, print the 'Events' count as a real
count, not 2 numbers separated by a dot.
* Allow creation of a RAID6 with exactly one missing device.
* Use LOG_PID for syslog, so you get the pid of mdadm in the
log files.
* --export now works with --examine too (not just --detail)
* Improve auto-creation of device special file when using
--incremental
* Simple locking for --incremental so mdadm doesn't get
confused when run concurrently with itself.
* Make --incremental cope better with arrays that are being
reshaped.
* Fix autoassemble for stack arrays.
- remove /tmp/mdadm.conf in boot.md (bnc#401138)
-------------------------------------------------------------------
Wed Apr 30 15:57:14 CEST 2008 - mmarek@suse.cz
- added some fixes from Neil's git repo, fixing bnc#368704 among
others
-------------------------------------------------------------------
Mon Feb 4 19:24:54 CET 2008 - mmarek@suse.cz
- correctly display rc_status in boot.md
-------------------------------------------------------------------
Wed Jan 23 15:55:24 CET 2008 - mmarek@suse.cz
- fixed auto-assembly part of boot.md
* if /etc/mdadm.conf is empy or only contains whitespace or
comments, no autoassembly is done
* remove /tmp/mdadm.conf even if a directory [#329678]
- dropped mdrun and raidautorun (no longer needed)
-------------------------------------------------------------------
Wed Oct 24 17:08:11 CEST 2007 - mmarek@suse.cz
- updated to 2.6.4
* Make "--create --auto=mdp" work for non-standard device names.
* Fix restarting of a 'reshape' if it was stopped in the middle.
* Fix a segfault when using v1 superblock.
* Make --write-mostly effective when re-adding a device to an
array.
* Various minor fixes
- changes in 2.6.3:
* allow --write-behind to be set for --grow.
* When adding new disk to an array, don't reserve so much bitmap
space that the disk cannot store the required data. (Needed
when 1.x array was created with older mdadm).
* When adding a drive that was a little too small, we did not get
the correct error message.
* Make sure that if --assemble find an array in the critical
region of a reshape, and cannot find the critical data to
restart the reshape, it gives an error message.
* Fix segfault with '--detail --export' and non-persistent
superblocks.
* Various manpage updates.
* Improved 'raid4' support (--assemble, --monitor)
* Option parsing fixes w.r.t -a
* Interpret "--assemble --metadata=1" to allow any version 1.x
metadata, and be more specific in the "metadata=" message
printed with --examine --brief
* Fix spare migration in --monitor.
-------------------------------------------------------------------
Fri Jul 27 13:01:01 CEST 2007 - mmarek@suse.cz
- changes to the init script [#288454]
* don't try to autoassemble if /etc/mdadm.conf exists (even an
empty one)
* ony autoassemble partitions found in /proc/partitions
-------------------------------------------------------------------
Fri Jul 13 15:02:21 CEST 2007 - mmarek@suse.cz
- updated to 2.6.2
* --fail detached and --remove faulty can be used to fail and
remove devices that are no longer physically present.
* --export option for --detail or present information in a format
that can be processed by udev.
* fix internal bitmap allocation problems with v1.1, v1.2
metadata.
* --help now goes to stdout so you can direct it to a pager.
* Various manpage updates.
* Make "--grow --add" for linear arrays really work.
* --auto-detect to trigger in-kernel autodetect.
* Make return code for "--detail --test" more reliable. Missing
devices as well as failed devices cause an error.
- added some fixes from Neil's git repo (mdadm-git-fixes.patch)
-------------------------------------------------------------------
Thu Jun 21 15:58:37 CEST 2007 - adrian@suse.de
- fix changelog entry order
-------------------------------------------------------------------
Mon Apr 2 15:00:10 CEST 2007 - mmarek@suse.cz
- updated to 2.6.1
* --monitor was producing some meaningless warnings due to a bug.
* Fix some compiler warnings.
* Fully support --grow for raid6. If a reshape crashed during
the critical period, mdadm wouldn't restore the Q information
properly.
* Update documentation for --grow.
* Report bitmap status in --detail and --examine
* Default to v1 superblocks instead of v0.90 if the array
is too big for 0.90 to handle.
* Sort the output of "mdadm --detail --scan" so that it is
in a suitable order for assembling arrays. i.e. components come
before an array that they are part of.
* Require bitmap files to have a '/' in their name.
* Rewrite 'reshape' support including performing a backup
of the critical region for a raid5 growth, and restoring that
backup after a crash.
* Put a 'canary' at each end of the backup so a corruption
can be more easily detected.
* Support --backup-file for backing-up critical section during
growth.
* Erase old superblocks (of different versions) when creating new
array.
* Allow --monitor to work with arrays with >28 devices
* Report reshape information in --detail
* Handle symlinks in /dev better
* Fix mess in --detail output which a device is missing.
* Support 'bitmap=' in mdadm.conf for auto-assembling arrays with
write-intent bitmaps in separate files.
* Fix alignment problem in version-1 superblocks.
NOTE: This is an incompatable change affecting raid5 reshape.
If you want to reshape a raid5 using version-1 superblocks,
use 2.6.17-rc2 or later, and mdadm-2.4.1 or later.
* Support 'mailfrom' line in mdadm.conf so the From: line in alert
emails can be explicitly set.
* Arrange that SparesMissing (which is similar in import to
DegradedArray) generates an Email.
* Assume "DEVICE partitions" if no DEVICE line is given.
* Support new 'offset' layout for raid10.
* When creating a bitmap file, choose a chunksize to limit number
of bitmap chunks to 2 million. More than this can cause kmalloc
failure.
* New 'CREATE' line in mdadm.conf for defaults such as owner, group,
mode and auto-flag
* --detail checks if array has been started or not and includes that
in report.
* When using --update=uuid on an array with a bitmap, update the
bitmap's uuid too.
* Add a copy of /proc/mdstat to the mail message sent by mdadm
--monitor.
* New flag --no-degraded to avoid starting arrays if there are
fewer devices available than last time the array was started.
This is only needed with --scan, as with --scan, that behaviour
is the default.
* Support for 'homehost' concept. This is a fairly major update.
It includes a configfile option and a command line option for
specifying a homehost, records that host in the superblock,
and reports the homehost where possible.
* Support for Auto Assembly. "mdadm -As" will, if provided with
the name of a homehost, try to assemble all arrays it can find
that were created for that homehost. See man pages for more details.
* Don't try to create devices with --manage or --grow
* allow default metadata (superblock) type to be specified
in mdadm.conf
* Avoid some misdetection of overlapping partitions
* Add 'Array Slot' line to --examine for version-1 superblocks
to make it a bit easier to see what is happening.
* Work around bug in --add handling for version-1 superblocks
in 2.6.17 (and prior).
* Make -assemble a bit more resilient to finding strange
information in superblocks.
* When creating devices in /dev/md/ create matching symlinks
from /dev. e.g. /dev/md0 -> /dev/md/0.
Allow this to be disabled in mdadm.conf or on command line.
* Allow a number (of partitions) after the 'yes' option to --auto=
This is particularly useful in the 'create' line in mdadm.conf.
* Remove partitions from any whole device that is made part of
an md array. This is a work-around for annoying messages
when the first block on some drive accidentally looks like a
partition table.
* Close stray fd in mdassemble so that it can assemble stacked
devices
* If mdassemble finds an array already assembled, it marks it
read-write.
* Remove error in md_open if array is already active. This isn't
needed and gets in the ways if an array was created e.g. in
initramfs, but device doesn't yet exist in /dev.
* When --assemble --scan is run, if all arrays that could be found
have already been started, don't report an error.
* Allow --assemble --force to mark a raid6 clean when it has two
missing devices (which is needed else if won't assemble.
Without this fix it would only assemble if one or zero
missing devices.
* Support --update=devicesize for cases where the underlying device
can change size.
* Default to --auto=yes so the array devices with 'standard' names
get created automatically, as this is almost always what is wanted.
* Give useful message if raid4/5/6 cannot be started because it is
not clean and is also degraded.
* Increase raid456 stripe cache size if needed to --grow the array.
The setting used unfortunately requires intimate knowledge of the
kernel, and it not reset when the reshape finishes.
* Change 'Device Size' to 'Used Dev Size' because it only shows how
much of each device is actually used, not how big they are.
* --wait or -W will wait for resync activity to finish on the given
devices.
* If two drives in a raid5 disappear at the same time, then "-Af"
will add them both in rather than just one and forcing the array
to 'clean'. This is slightly safer in some cases.
* Don't hold md device open for so long in --monitor mode - map_dev
can be slow and interferes with trying to stop the array.
* Support --uuid= with --create to choose your own UUID.
* New major more "--incremental" for incremental assemble of arrays,
intended for use with udev.
* lots of bugfixes
* manpage updates
-------------------------------------------------------------------
Wed Jan 10 11:58:14 CET 2007 - mmarek@suse.cz
@ -724,16 +255,16 @@ Mon Dec 2 11:30:52 CET 2002 - fehr@suse.de
- Fix for new glibc/gcc
-------------------------------------------------------------------
Tue Sep 17 17:34:28 CEST 2002 - ro@suse.de
- removed bogus self-provides
-------------------------------------------------------------------
Mon Sep 13 15:10:00 CEST 2002 - lmb@suse.de
- Fix for 64bit arch; ioctl returns long instead of int (#20339)
-------------------------------------------------------------------
Tue Sep 17 17:34:28 CEST 2002 - ro@suse.de
- removed bogus self-provides
-------------------------------------------------------------------
Fri Aug 23 11:16:51 MEST 2002 - lmb@suse.de
@ -755,3 +286,4 @@ Mon Aug 5 16:05:19 CEST 2002 - fehr@suse.de
- make SuSE package from version 1.0.1 of mdadm
-------------------------------------------------------------------

View File

@ -1,33 +1,25 @@
#
# spec file for package mdadm (Version 3.0.3)
# spec file for package mdadm (Version 2.5.3)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: mdadm
Version: 3.0.3
Release: 3
BuildRequires: sgmltool
Version: 2.5.3
Release: 20
BuildRequires: opensp sgmltool
PreReq: %fillup_prereq %insserv_prereq
Obsoletes: raidtools
AutoReqProv: on
Autoreqprov: on
Group: System/Base
License: GPLv2+
Url: http://www.kernel.org/pub/linux/utils/raid/mdadm/
License: GNU General Public License (GPL)
URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/
Summary: Utility for Configuring MD Setup
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: %{name}-%{version}.tar.bz2
@ -35,9 +27,9 @@ Source1: Software-RAID.HOWTO.tar.bz2
Source2: sysconfig.mdadm
Source3: mdadmd
Source4: boot.md
Source5: mkinitrd-setup.sh
Source6: mkinitrd-boot.sh
Source7: 64-md-raid.rules
Source5: mdrun
Source6: raidautorun.c
Patch: %{name}-%{version}-infoname.diff
%description
Mdadm is a program that can be used to control Linux md devices. It is
@ -48,14 +40,16 @@ programs but with a very different interface.
Authors:
--------
Neil Brown <neilb@suse.de>
Neil Brown <neilb@cse.unsw.edu.au>
%prep
%setup -q -a1
%patch
%build
%{suse_update_config -f}
make %{?jobs:-j%jobs} CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-error"
make CXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-error"
gcc $RPM_OPT_FLAGS %{S:6} -o raidautorun
cd Software-RAID.HOWTO
sgml2html Software-RAID.HOWTO.sgml
sgml2txt Software-RAID.HOWTO.sgml
@ -65,35 +59,16 @@ make install DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_var}/adm/fillup-templates
install -d $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/init.d}
install -d $RPM_BUILD_ROOT/lib/udev/devices
install -m 755 %{S:5} raidautorun $RPM_BUILD_ROOT/sbin/
install -m 755 %{S:4} %{S:3} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-md.sh
install -m 755 %{S:6} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-md.sh
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_var}/adm/fillup-templates/
ln -sf ../../etc/init.d/mdadmd $RPM_BUILD_ROOT/%{_sbindir}/rcmdadmd
rm -rf $RPM_BUILD_ROOT/var/run/mdadm
mkdir -p $RPM_BUILD_ROOT/var/run
ln -s mdadm $RPM_BUILD_ROOT/var/run/mdadm
install -d $RPM_BUILD_ROOT/lib/udev/rules.d
install -m 644 %_sourcedir/64-md-raid.rules $RPM_BUILD_ROOT/lib/udev/rules.d
%post
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%{fillup_and_insserv -y boot.md}
mkdir -p /dev/.mdadm
# replace the /var/run/mdadm directory (installed by sle11/11.1) with
# a symlink pointing to /dev/.mdadm. Do not do this when /var/run/mdadm is
# not empty, let /etc/init.d/boot.md do it at the next reboot.
if test -e /var/run/mdadm -a ! /var/run/mdadm -ef /dev/.mdadm; then
if ! rmdir /var/run/mdadm 2>/dev/null; then
exit 0
fi
ln -s /dev/.mdadm /var/run/mdadm
fi
%{fillup_and_insserv -Y boot.md}
%postun
%restart_on_update mdadmd
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%{insserv_cleanup}
%preun
@ -105,21 +80,176 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%attr(0755,root,root) %config %{_sysconfdir}/init.d/*
%doc COPYING ChangeLog README.initramfs TODO mdadm.conf-example mkinitramfs
%attr(640,root,disk) %dev(b,9,0) /lib/udev/devices/md0
%attr(640,root,disk) %dev(b,9,1) /lib/udev/devices/md1
%attr(640,root,disk) %dev(b,9,2) /lib/udev/devices/md2
%attr(640,root,disk) %dev(b,9,3) /lib/udev/devices/md3
%attr(640,root,disk) %dev(b,9,4) /lib/udev/devices/md4
%attr(640,root,disk) %dev(b,9,5) /lib/udev/devices/md5
%attr(640,root,disk) %dev(b,9,6) /lib/udev/devices/md6
%attr(640,root,disk) %dev(b,9,7) /lib/udev/devices/md7
%attr(640,root,disk) %dev(b,9,8) /lib/udev/devices/md8
%attr(640,root,disk) %dev(b,9,9) /lib/udev/devices/md9
%attr(640,root,disk) %dev(b,9,10) /lib/udev/devices/md10
%attr(640,root,disk) %dev(b,9,11) /lib/udev/devices/md11
%attr(640,root,disk) %dev(b,9,12) /lib/udev/devices/md12
%attr(640,root,disk) %dev(b,9,13) /lib/udev/devices/md13
%attr(640,root,disk) %dev(b,9,14) /lib/udev/devices/md14
%attr(640,root,disk) %dev(b,9,15) /lib/udev/devices/md15
%attr(640,root,disk) %dev(b,9,16) /lib/udev/devices/md16
%attr(640,root,disk) %dev(b,9,17) /lib/udev/devices/md17
%attr(640,root,disk) %dev(b,9,18) /lib/udev/devices/md18
%attr(640,root,disk) %dev(b,9,19) /lib/udev/devices/md19
%attr(640,root,disk) %dev(b,9,20) /lib/udev/devices/md20
%attr(640,root,disk) %dev(b,9,21) /lib/udev/devices/md21
%attr(640,root,disk) %dev(b,9,22) /lib/udev/devices/md22
%attr(640,root,disk) %dev(b,9,23) /lib/udev/devices/md23
%attr(640,root,disk) %dev(b,9,24) /lib/udev/devices/md24
%attr(640,root,disk) %dev(b,9,25) /lib/udev/devices/md25
%attr(640,root,disk) %dev(b,9,26) /lib/udev/devices/md26
%attr(640,root,disk) %dev(b,9,27) /lib/udev/devices/md27
%attr(640,root,disk) %dev(b,9,28) /lib/udev/devices/md28
%attr(640,root,disk) %dev(b,9,29) /lib/udev/devices/md29
%attr(640,root,disk) %dev(b,9,30) /lib/udev/devices/md30
%attr(640,root,disk) %dev(b,9,31) /lib/udev/devices/md31
%doc ANNOUNCE-2.0 ANNOUNCE-2.1 ANNOUNCE-2.2 COPYING ChangeLog README.initramfs TODO mdadm.conf-example mkinitramfs
%doc Software-RAID.HOWTO/Software-RAID.HOWTO*{.txt,.html}
%doc %{_mandir}/man?/*
/sbin/*
%dir /lib/udev
%dir /lib/udev/devices
/lib/udev
%{_sbindir}/*
%{_var}/adm/fillup-templates/sysconfig.mdadm
%ghost /var/run/mdadm
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/setup-md.sh
/lib/mkinitrd/scripts/boot-md.sh
%dir /lib/udev
%dir /lib/udev/rules.d
/lib/udev/rules.d/64-md-raid.rules
%changelog
%changelog -n mdadm
* Wed Jan 10 2007 - mmarek@suse.cz
- use raidautorun instead of mdrun to autodetect the raid arrays in
boot.md [#230733]
* Wed Nov 08 2006 - prusnak@suse.cz
- fixed subscript out of range [#212697]
* Wed Sep 20 2006 - mjancar@suse.cz
- update to 2.5.3
* lots bugfixes
* drop all patches (integrated upstream)
* Fri Jul 28 2006 - olh@suse.de
- remove dropped boot.ibmsis from boot.md
- boot.rootfsck should start before boot.md (#181972)
* Fri Jul 21 2006 - olh@suse.de
- remove boot.proc from Required-Start: in boot.md (#178753)
* Wed May 03 2006 - mjancar@suse.cz
- fix false SparesMissing error (#171326)
* Wed Apr 26 2006 - hare@suse.de
- Fix init script dependencies
- Implement MDADM_DEVICE_TIMEOUT to set a timeout for
udevsettle (#149979)
* Tue Apr 25 2006 - mjancar@suse.cz
- add static device nodes for udev (#168824)
* Wed Apr 19 2006 - mjancar@suse.cz
- set $BOOT_MD_USE_MDADM_CONFIG to "yes" by default (#155120)
* Fri Apr 07 2006 - mjancar@suse.cz
- detach mdadmd from tty in rcmdadmd (#160881)
* Mon Apr 03 2006 - mjancar@suse.cz
- fix garbled output with --detail (#160827)
- fix fix write-mostly with --add and --re-add (#162968)
* Fri Mar 24 2006 - mjancar@suse.cz
- add /sbin/raidautorun (#159460)
* Wed Mar 08 2006 - mjancar@suse.cz
- add $BOOT_MD_USE_MDADM_CONFIG sysconfig variable (#155120)
* Thu Feb 09 2006 - mjancar@suse.cz
- round free size to chunk size multiply on --create (#148562)
* Tue Feb 07 2006 - mjancar@suse.cz
- move boot.multipath to Should-Start instead of Required-Start
* Mon Feb 06 2006 - mjancar@suse.cz
- add "Obsoletes: raidtools"
- start boot.md after boot.multipath
- call mdadm without -a from mdrun, an argument is required in 2.2
* Mon Feb 06 2006 - mjancar@suse.de
- don't start mdadmd by default
* Sun Feb 05 2006 - mjancar@suse.cz
- include option for email to be sent on start (#142105)
- fix missing md autostart due to raidtools dropped (#148234)
* include mdrun script from Debian
* create boot.md initscipt
* Sun Feb 05 2006 - schwab@suse.de
- Fix memset parameters.
* Thu Feb 02 2006 - mjancar@suse.cz
- fix segfault on --assemble (#146514)
* Fri Jan 27 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jan 25 2006 - olh@suse.de
- fix uninitialized variable, memset call and memcmp/memcpy bug
mdadm.bug144647-array.init.patch
mdadm.bug144647-update_super1-memcpy.patch
mdadm.bug144647-add_internal_bitmap0-memcpy.patch
* Wed Jan 11 2006 - mjancar@suse.cz
- update ro 2.2
* Tue Dec 20 2005 - ro@suse.de
- at least output errors if they occur (instead of ignoring)
* Wed Nov 30 2005 - schwab@suse.de
- Fix broken formats.
* Tue Oct 25 2005 - aj@suse.de
- Build with -fno-strict-aliasing.
* Wed Oct 12 2005 - mjancar@suse.cz
- update to 2.1
* Thu Jul 28 2005 - anicka@suse.cz
- update to 1.12.0
* Wed Jun 15 2005 - meissner@suse.de
- use RPM_OPT_FLAGS correctly.
* Tue Apr 19 2005 - postadal@suse.de
- updated to version 1.11.0
- fixed for gcc 4.0
- removed obsoleted patch config-fix
* Wed Mar 30 2005 - postadal@suse.cz
- fixed parsing command line option '--config=partions' [#74603]
* Fri Feb 04 2005 - postadal@suse.cz
- updated to version 1.9.0
* Thu Jan 13 2005 - postadal@suse.cz
- updated to version 1.8.1
- extended comment in sysconfig.mdadm [#48567]
* Fri Aug 06 2004 - postadal@suse.cz
- updated to version 1.6.0
* added --auto= and --assume-clean options
* added "degraded" and "recovering" options to the "Status:" entry
* Tue Feb 10 2004 - postadal@suse.cz
- updated to version 1.5.0
* new commands "mdassemble"
* support for raid6 as found in 2.6.2
* support partitioned md arrays with a different major number and
naming scheme
* added "SparesMissing" event when --monitor first sees an array and
it doesn't have the enough spare devices.
* Sun Jan 11 2004 - adrian@suse.de
- add %%defattr
* Mon Dec 01 2003 - fehr@suse.de
- fix quoting problem in start script (#33392)
* Fri Aug 29 2003 - fehr@suse.de
- add PreReq for fillup
* Tue Aug 26 2003 - fehr@suse.de
- add %%stop_on_removal and %%restart_on_update
* Thu Aug 14 2003 - fehr@suse.de
- add missing activation metadata in sysconfig (#28901)
* Tue Jul 29 2003 - fehr@suse.de
- update to new version 1.3.0 of package
* Mon Apr 14 2003 - postadal@suse.cz
- fixed init script (added return value for unimplemented reload function)
* Mon Mar 31 2003 - postadal@suse.cz
- added buildroot, init script, sysconfig
- bzip2 sources and cleaned specfile
* Thu Mar 20 2003 - fehr@suse.de
- update to version 1.2.0 of package
* Mon Mar 03 2003 - fehr@suse.de
- update to version 1.1.0 of package
* Mon Dec 02 2002 - fehr@suse.de
- Fix for new glibc/gcc
* Tue Sep 17 2002 - ro@suse.de
- removed bogus self-provides
* Fri Sep 13 2002 - lmb@suse.de
- Fix for 64bit arch; ioctl returns long instead of int (#20339)
* Fri Aug 23 2002 - lmb@suse.de
- Multipath arrays can now be build manually even without a superblock.
- One debugging chunk removed from patch.
* Tue Aug 13 2002 - lmb@suse.de
- Fix for the assembly of multipath arrays.
* Mon Aug 12 2002 - lmb@suse.de
- Added patch to support the enhanced multipath features.
* Mon Aug 05 2002 - fehr@suse.de
- make SuSE package from version 1.0.1 of mdadm

4
mdadmd
View File

@ -13,9 +13,9 @@
### BEGIN INIT INFO
# Provides: mdadmd
# Required-Start: $local_fs
# Should-Start: $time sendmail
# X-UnitedLinux-Should-Start: $time sendmail
# Required-Stop: $local_fs
# Should-Stop: $time sendmail
# X-UnitedLinux-Should-Stop: $time sendmail
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: mdadmd daemon monitoring MD devices

147
mdrun Normal file
View File

@ -0,0 +1,147 @@
#!/bin/sh
# mdrun, (c) Eduard Bloch <blade@debian.org> 2003
# Usage:
# Without arguments: autodetect all RAID partitions and activate MDs
# Arguments: [ DEVDIR ] NUMBER UUID [ <NUMBER UUID> ... ]
# a number of number/uuid pairs, where NUMBER is the one from /dev/md/*
# Argument: LIST
# lists all raids in the syntax needed for the pairs (see above)
# IMPORTANT: create /dev/fs directory if you have devfs support in the kernel
# but do not want to mount it over /dev. Usage of /dev/fs directory will keep
# mdrun away from /dev.
# If the first argument is a directory, it will be used as a writeable
# temporary directory for device nodes. mdrun needs mknod to create them
# on-the-fly
# Environment:
# MORERAIDVOLUMES (list of strings) : additional raid disks to scan,
# eg. loop devices
if ! test -e /proc/partitions ; then
echo "/proc not mounted!"
exit 1
fi
DEVDIR=/dev
if [ -d "$1" ] ; then
AUTOCREATE=true
DEVDIR="$1"
shift
fi
# For people that compile the kernel with devfs (means: different
# proc/partitions content), but without auto-mounting it
if ! uname -r | grep "^2.6" 1>/dev/null && [ -z "$AUTOCREATE" ] && grep " devfs" /proc/filesystems >/dev/null 2>&1 && ! grep "^devfs" /proc/mounts >/dev/null 2>&1 ; then
mkdir /dev/fs 2>/dev/null
# if we can do it - good, we will use it. Otherwise, use /dev even if it is ugly
# mount devfs for now to make the device names match, umount later
if [ -d /dev/fs ] ; then
DEVDIR=/dev/fs
fi
mount none $DEVDIR -tdevfs
UMNTDEVFS="umount $DEVDIR"
fi
# arr(array, index): return contents in array[index]; as with Bourne shell
# in general, there is no easy way to distinguish between index not
# existing and empty string assigned.
arr() { sa_i=`arr_index $2`; eval "echo \"\$$1_${sa_i}\""; unset sa_i; }
# seterr(array, index, value): assign the given value to array[index].
setarr() { sa_i=`arr_index $2`; eval "$1_${sa_i}=\"$3\""; unset sa_i; }
# arr_index(index): make sure the given index is valid for use.
arr_index() { echo $1 | sed -e 's/:/_/g' | sed 's;/;_;g'; }
BASE=$DEVDIR/md
export BASE
#devfs
test -d $BASE && BASE=$BASE/
next_free_md() {
for raidnr in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24; do
if ! mdadm -D $BASE$raidnr >/dev/null 2>&1 ; then
echo $BASE$raidnr
return 0
fi
done
return 1
}
listpairs() {
for NUMBER in `cat /proc/mdstat | grep "^md. : active" | sed -e 's/^md\(.\) :.*/\1/'`; do
echo $NUMBER
mdadm -D ${BASE}$NUMBER 2>/dev/null |grep UUID | sed 's/.*: \(.*\)/\1/'
done
}
if [ "$1" = LIST ] ; then
echo `listpairs`
$UMNTDEVFS
exit 0
fi
DEVDIRESC=$(echo $DEVDIR | sed -e 's!/!\\/!g')
if [ "$AUTOCREATE" ] ; then
CREATECMD=$(sed -e "s/.*major.*//; s/.*\ \([:0-9:]\+\)\ \+\ \([:0-9:]\+\)\ \+\ [:0-9:]\+\ \+\([:a-z0-9\/:]\+\).*/mknod \3 b \1 \2 ; / ; s/\//_/g" < /proc/partitions)
export CREATECMD
export DEVDIR
# and we need array nodes, of course
(
cd $DEVDIR ;
eval $CREATECMD ;
for x in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ; do
mknod ${BASE}$x b 9 $x
done
)
PARTLIST=$(sed -e "s/.*major.*//; s/.*\ \([:0-9:]\+\)\ \+\ \([:0-9:]\+\)\ \+\ [:0-9:]\+\ \+\([:a-z0-9\/:]\+\).*/DEVDIR\3 /; s/\//_/g ; s/DEVDIR/$DEVDIRESC\//;" < /proc/partitions)
else
PARTLIST=$(sed -e "s/.*major.*//; s/^[:0-9 :]* \([:a-z:].[:a-z0-9\/:]*\).*/\1/; s/^\([:a-z:].*\)/$DEVDIRESC\/\1/g" < /proc/partitions)
fi
for SRC in $PARTLIST $MORERAIDVOLUMES ; do
SUM=$(mdadm -E $SRC 2>/dev/null | grep UUID | sed 's/.*: \(.*\)/\1/')
for x in $SUM; do
UUIDS="$UUIDS $SUM"
setarr MDS $SUM "`arr MDS $SUM` $SRC"
done
done
if [ "$#" -gt 1 ] ; then
NUMBER=${BASE}$1
MD=$2
shift ; shift
if [ "`arr MDS $MD`" != "started" ] ; then
mdadm -A $NUMBER -f `arr MDS $MD` && setarr MDS $MD "started"
# just to be sure
ln /dev/md/$NUMBER /dev/md$NUMBER 2>/dev/null
fi
fi
# and process the rest, if it exists
# do not touch active arrays
#dropactive() {
for NUMBER in `cat /proc/mdstat | grep "^md. : active" | sed -e 's/^md\(.\) :.*/\1/'`; do
setarr MDS `mdadm -D ${BASE}$NUMBER 2>/dev/null |grep UUID | sed 's/.*: \(.*\)/\1/'` "started"
done
#}
for MD in $UUIDS; do
if [ "`arr MDS $MD`" != "started" ] ; then
NUMBER=`next_free_md`
mdadm -A $NUMBER -f `arr MDS $MD` && setarr MDS $MD "started"
# just to be sure
ln /dev/md/$NUMBER /dev/md$NUMBER 2>/dev/null
fi
done
$UMNTDEVFS

View File

@ -1,88 +0,0 @@
#!/bin/bash
#%stage: softraid
#%programs: /sbin/mdadm /sbin/mdmon
#%modules: raid0 raid1 raid10 raid456
#%if: -n "$need_mdadm"
#
##### MD (Software-)Raid
##
## This activates and waits for an MD software raid.
##
## Command line parameters
## -----------------------
##
## need_mdadm=1 use MD raid
## md_uuid the uuid of the raid to activate
##
# load the necessary module before we initialize the raid system
load_modules
# put the mdmon socked and pid file to /dev/.mdadm
rm -rf /var/run/mdadm
mkdir -p /var/run
ln -s /dev/.mdadm /var/run/mdadm
mkdir -p /dev/.mdadm
[ "$mduuid" ] && md_uuid="$mduuid"
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)
if [ -n "$md_major" -a "$md_major" = "$maj" ]; then
md_minor="$min"
md_dev="/dev/md$md_minor"
fi
# Always start md devices read/only. They will get set to rw as soon
# as the first write occurs. This way we can guarantee that no
# restore occurs before resume.
if [ -f /sys/module/md_mod/parameters/start_ro ]; then
echo 1 > /sys/module/md_mod/parameters/start_ro
fi
md_assemble()
{
local dev=$1 mdconf container
case "$dev" in
/dev/md[0-9]*p[0-9]*)
dev=${dev%p[0-9]*}
esac
if test -f /etc/mdadm.conf; then
mdconf="-c /etc/mdadm.conf"
container=$( \
sed -rn "s:^ARRAY +$dev .*container=([^ ]*).*:\\1:p" \
/etc/mdadm.conf)
else
mdconf="-c partitions"
fi
case "$container" in
"")
;;
/dev/*)
mdadm -A $mdconf $container
;;
[0-9a-f]*[0-9a-f])
mdadm -A $mdconf --uuid="$container" /dev/md/container
;;
*)
echo "unrecognized container for $dev: $container"
;;
esac
mdadm -A $mdconf $mdarg "$dev"
}
if [ -n "$need_mdadm" ]; then
if [ -n "$md_uuid" ] ; then
mdarg="--uuid=$md_uuid"
fi
case $resumedev in
/dev/md*)
md_assemble "$resumedev"
esac
if [ -n "$md_dev" ] ; then
md_assemble "$md_dev"
fi
wait_for_events
fi

View File

@ -1,92 +0,0 @@
#!/bin/bash
#
#%stage: softraid
#
mdblockdev=
# Full mdadm.conf generated by mdadm.
# Contains all created MD RAIDs
mdadm_conf=
cont_list=
md_devs=
# blockdev contains real devices (/dev/X) for root, resume, journal, dumb
for bd in $blockdev ; do
is_part_dev=false
case $bd in
/dev/md[0-9]*p[0-9]*)
# Partitionable MD RAID. This is partition on RAID. Get the RAID
bd=${bd%%p[0-9]*}
is_part_dev=true
;;
/dev/md[0-9]*)
;;
*)
mdblockdev="$mdblockdev $bd"
continue
;;
esac
# Check if this device is already added (possible for partitionable).
md_dev=${bd##/dev/}
dup_found=false
for dup in $md_devs; do
if [ x"$dup" = x"$md_dev" ]; then
dup_found=true
break
fi
done
if $dup_found; then
if ! $is_part_dev; then
echo "setup-md.sh: $md_dev found multiple times" >&2
fi
continue
fi
mdconf=$(mdadm -Db "$bd")
if test -z "$mdconf"; then
mdblockdev="$mdblockdev $bd"
continue
fi
md_tmpblockdev=$(mdadm -Dbv $bd | sed -n "1D;s/,/ /g;s/^ *devices=//p")
mdblockdev="$mdblockdev $md_tmpblockdev"
md_devs="$md_devs $md_dev"
container=$(echo "$mdconf" | sed -rn 's/.* container=([^ ]*) .*/\1/p')
for cnt in $cont_list; do
if [ x"$container"= x"$cnt" ]; then
container=
break
fi
done
case "$container" in
"")
;;
/dev/*)
mdconf="$(mdadm -Db "$container")\\n$mdconf"
;;
[0-9a-f]*[0-9a-f])
if test -z "$mdadm_conf"; then
mdadm_conf=$(mdadm --examine --brief --scan)
fi
mdconf="$(echo "$mdadm_conf" | grep "UUID=$container")\\n$mdconf"
;;
*)
echo "unrecognized container for $md_dev: $container"
;;
esac
eval md_conf_${md_dev}=\"$mdconf\"
root_md=1
done
# Any 'md' device is replaced by it's component disks.
blockdev="$mdblockdev"
if [ -n "$root_md" ] ; then
need_mdadm=1
echo -n "" > $tmp_mnt/etc/mdadm.conf
for md in $md_devs; do
eval echo -e \"\$md_conf_$md\" >> $tmp_mnt/etc/mdadm.conf
done
fi
save_var need_mdadm
save_var root_md

16
raidautorun.c Normal file
View File

@ -0,0 +1,16 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/major.h>
#include <linux/raid/md_u.h>
int main(int argc, char *argv[])
{
int fd = open("/dev/md0", O_RDWR);
if (fd >= 0) {
ioctl(fd, RAID_AUTORUN, 0);
close(fd);
}
return (0);
}

0
ready Normal file
View File

View File

@ -51,6 +51,13 @@ MDADM_CONFIG="/etc/mdadm.conf"
#
MDADM_SEND_MAIL_ON_START=no
## Type: yesno
## Default: no
#
# "yes" for mdadm.conf to be used for array assembly on boot
#
BOOT_MD_USE_MDADM_CONFIG=yes
## Type: integer
## Default: 60
#