#!/bin/sh # don't let udev and this script step on eachother's toes for x in 61-dmraid-imsm.rules 64-md-raid.rules 65-md-incremental-imsm.rules 65-md-incremental.rules 64-lvm.rules 70-mdadm.rules 99-mount-rules; do rm -f -- "/etc/udev/rules.d/$x" done rm -f -- /etc/lvm/lvm.conf udevadm control --reload # dmraid does not want symlinks in --disk "..." if [ -e /dev/hda ] ; then echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/hdb /dev/hdc" else echo y|dmraid -f isw -C Test0 --type 1 --disk "/dev/sdb /dev/sdc" fi udevadm settle SETS=$(dmraid -c -s) # scan and activate all DM RAIDS for s in $SETS; do dmraid -ay -i -p --rm_partitions "$s" [ -e "/dev/mapper/$s" ] && kpartx -a -p p "/dev/mapper/$s" done udevadm settle sfdisk -g /dev/mapper/isw*Test0 # save a partition at the beginning for future flagging purposes sfdisk -C 2560 -H 2 -S 32 -L /dev/mapper/isw*Test0 < /tmp/mduuid . /tmp/mduuid echo "MD_UUID=$MD_UUID" { echo "dracut-root-block-created"; echo MD_UUID=$MD_UUID;} > /dev/sda mdadm --wait-clean /dev/md0 poweroff -f