ALT Linux Bugzilla
– Attachment 1141 Details for
Bug 5955
move to mdadm for RAID startup in initramfs
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
support booting from root partition located on md-device
mkinitrd-2.9.4-alt1-raidsupport.patch (text/plain), 4.58 KB, created by
evseev
on 2005-09-27 01:24:24 MSD
(
hide
)
Description:
support booting from root partition located on md-device
Filename:
MIME Type:
Creator:
evseev
Created:
2005-09-27 01:24:24 MSD
Size:
4.58 KB
patch
obsolete
>--- mkinitrd.orig 2005-03-22 15:25:59 +0300 >+++ mkinitrd 2005-09-26 17:16:06 +0400 >@@ -134,6 +134,8 @@ > noscsi= > noide= > noraid= >+nomdadm= >+noraidtab= > pause= > MODULES= > MODULES_DIR= >@@ -643,10 +645,13 @@ > [0156]) > FindModule "raid$level" > ;; >- 4) >+ 4|raid4) > FindModule "raid5" > ;; >- -1|linear) >+ linear|multipath|raid[0156]) >+ FindModule $level >+ ;; >+ -1) > FindModule "linear" > ;; > *) >@@ -661,6 +666,45 @@ > awk '{print $2}' | LC_COLLATE=C sort -u > } > >+ MDADM=/usr/sbin/mdadm >+MDASSEMBLE=/sbin/mdassemble >+MDADM_CONF=/etc/mdadm.conf >+ MDDEVNUM=9 >+ >+mddev() # $1 = device to check => raiddevices, nonraiddevices (currently not used), stacked_md >+{ >+ local -i major >+ local dev md >+ local stack=${2-0} >+ : ${stacked_md=0} >+ major=$((0x$(stat -L -c '%t' $1))) >+ if [ $major = $MDDEVNUM ]; then >+ # need to reverse the raiddevices list to account for stacked md devices >+ raiddevices="$1 $raiddevices" >+ md=${1##*/} >+ md=md${md#md} # /dev/md/0 and /dev/md0 become md0 >+ mddevs=$(awk '/^'$md'[[:space:]]*:/ {for (i=5;i<=NF;i++) {sub("\\[[0-9]*\\]","",$i); print "/dev/" $i } }' /proc/mdstat) #' >+ [ -n "$mddevs" ] && stack=$(($stack + 1)) >+ [ $stack -gt $stacked_md ] && stacked_md=$stack >+ for dev in $mddevs; do >+ mddev $dev $stack >+ done >+ else >+ nonraiddevices="$nonraiddevices $1" >+ fi >+} >+ >+FindRaidModulesFromMdadm() >+{ >+ mddev $rootdev >+ for md in $raiddevices; do >+ md=${md##*/} >+ md=md${md#md} # /dev/md/0 and /dev/md0 become md0 >+ level=$(awk '/^'$md'[[:space:]]*:/ { print $4 }' /proc/mdstat) >+ FindRaidModuleForLevel $level >+ done >+} >+ > FindRaidModules() > { > [ -z "$noraid" ] || return >@@ -672,9 +716,14 @@ > > if [ -n "$HAVE_RAID" ]; then > FindModule -md >- if [ -r /etc/raidtab ]; then >+ if [ -z "$nomdadm" -a -r $MDADM_CONF ]; then >+ FindRaidModulesFromMdadm >+ noraidtab=1 >+ fi >+ if [ -z "$noraidtab" -a -r /etc/raidtab ]; then > for number in `ListRaidLevelsFromRaidtab`; do > FindRaidModuleForLevel "$number" >+ stacked_md=1 > done > fi > fi >@@ -695,7 +744,7 @@ > FindRootModules() > { > # In case the root filesystem is modular. >- #rootdev=$(awk '{if (($2 == "/") && ($1 !~ /^[ \t]*#/) {print $1}}' "$FSTAB_FILE") >+ rootdev=$(awk '{if (($2 == "/") && ($1 !~ /^[ \t]*#/)) {print $1}}' "$FSTAB_FILE") > local rootfs > rootfs=$(awk '{if (($2 == "/") && ($1 !~ /^[ \t]*#/)) {print $3}}' "$FSTAB_FILE") > [ -z "$rootfs" ] || FindModule -"$rootfs" >@@ -753,6 +802,38 @@ > Fatal "Failed to create \"$file\" device." > } > >+ActivateMdDevices() >+{ >+ echo "echo Create RAID devices" >> $RCFILE >+ [ -x $MDADM ] && echo "DEVICE partitions" >| ${MNTIMAGE}$MDADM_CONF >+ for dev in $raiddevices; do >+ md=${dev##*/} >+ md=${md#md} # /dev/md/0 and /dev/md0 become 0 >+ echo "mknod /safedev/md${md} b $MDDEVNUM ${md}" >> $RCFILE >+ if [ -x $MDADM ]; then >+ $MDADM -D -b $dev | grep '^ARRAY' \ >+ | sed -e 's,\/dev\/,\/safedev\/,g' \ >+ >> ${MNTIMAGE}$MDADM_CONF >+ fi >+ done >+ if [ -x $MDASSEMBLE ]; then >+ Cp -aL $MDASSEMBLE $MNTIMAGE/sbin/ >+ raidstart_command="mdassemble" >+ elif [ -x $MDADM ]; then >+ Cp -aL $MDADM $MNTIMAGE/sbin/ >+ raidstart_command="mdadm -A -s" >+ else >+ Ln -s sh "$MNTDIR/bin/raidautorun" >+ Mknod "$MNTDIR/safedev/md255" b 9 255 >+ raidstart_command="raidautorun /safedev/md255" >+ fi >+ echo "echo Activate RAID devices" >> $RCFILE >+ while [ $stacked_md -gt 0 ]; do >+ echo $raidstart_command >> $RCFILE >+ stacked_md=$(($stacked_md - 1)) >+ done >+} >+ > MakeMountDir() > { > MNTDIR="$WORKDIR/tree" >@@ -807,11 +888,7 @@ > done > > if [ -n "$HAVE_RAID" ]; then >- Mknod "$MNTDIR/safedev/md255" b 9 255 >- Ln -s sh "$MNTDIR/bin/raidautorun" >- cat >>"$RCFILE" <<EOF >-/bin/raidautorun /safedev/md255 >-EOF >+ ActivateMdDevices > fi > > if [ -n "$loopDev" ]; then >@@ -967,6 +1044,8 @@ > --omit-scsi-modules do not load any SCSI modules. > --omit-ide-modules do not load any IDE modules. > --omit-raid-modules do not load any raid modules. >+--omit-mdadm skip /etc/mdadm.conf, but check /etc/raidtab >+--omit-raidtab skip /etc/raidtab, but check /etc/mdadm.conf > --pause pause for manual initrd editing. > --nocompress do not compress initrd image. > --nobootsplash do not add bootsplash to the initrd image. >@@ -1035,6 +1114,14 @@ > noraid=1 > shift > ;; >+ --omit-mdadm) >+ nomdadm=1 >+ shift >+ ;; >+ --omit-raidtab) >+ noraidtab=1 >+ shift >+ ;; > --with-raid) > HAVE_RAID=1 > shift >@@ -1116,10 +1203,10 @@ > > FindScsiModules > >-FindRaidModules >- > FindRootModules > >+FindRaidModules >+ > FindLoopModules > > FindModules $POSTLOAD_MODNAMES
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 5955
: 1141