2008-07-25 02:32:37 +02:00
|
|
|
#!/bin/bash
|
2013-09-13 03:49:53 +02:00
|
|
|
#%stage: boot
|
|
|
|
#%depends: start
|
2009-12-16 09:01:21 +01:00
|
|
|
#%programs: /sbin/mdadm /sbin/mdmon
|
2010-01-11 15:50:57 +01:00
|
|
|
#%modules: raid0 raid1 raid10 raid456
|
2008-07-25 02:32:37 +02:00
|
|
|
#%if: -n "$need_mdadm"
|
|
|
|
#
|
|
|
|
##### MD (Software-)Raid
|
|
|
|
##
|
2013-09-13 03:49:53 +02:00
|
|
|
## This only sets the 'start_ro' module parameter to ensure
|
|
|
|
## arrays don't start resync until after the first write.
|
|
|
|
## All array assembly is performed by udev -> "mdadm -I"
|
2008-07-25 02:32:37 +02:00
|
|
|
##
|
|
|
|
## Command line parameters
|
|
|
|
## -----------------------
|
|
|
|
##
|
|
|
|
## need_mdadm=1 use MD raid
|
2013-09-13 03:49:53 +02:00
|
|
|
##
|
2008-07-25 02:32:37 +02:00
|
|
|
|
|
|
|
# load the necessary module before we initialize the raid system
|
|
|
|
load_modules
|
|
|
|
|
2013-09-13 03:49:53 +02:00
|
|
|
#check_for_device uses $md_major
|
|
|
|
#we depend on 'start' to ensure /proc/devices exists
|
2008-07-25 02:32:37 +02:00
|
|
|
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)
|
|
|
|
|
|
|
|
# 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
|