1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#!/bin/sh
. /lib/partman/definitions.sh
# Load modules
#depmod -a 1>/dev/null 2>&1
#modprobe md 1>/dev/null 2>&1
#
## Load supported personalities
#modprobe raid1 1>/dev/null 2>&1
#
## Detect and start MD devices
#/sbin/mdrun
# Mark all RAID partitions as being MD
for dev in /var/lib/partman/devices/*; do
[ -d "$dev" ] || continue
cd $dev
# Get all partitions, and check if they have the md flag set.
partitions=
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
if [ "$fs" != free ]; then
partitions="$partitions $id"
fi
done
close_dialog
for id in $partitions; do
md=no
open_dialog GET_FLAGS $id
while { read_line flag; [ "$flag" ]; }; do
if [ "$flag" = raid ]; then
md=yes
fi
done
close_dialog
if [ "$md" = yes ]; then
[ -d $id ] || mkdir $id
echo raid > $id/method
fi
done
# Next, check if the device is a part of an MD setup
# if [ -f device ]; then
# DEVICE=`sed -e "s/\/dev\///" device`
# grep -q "${DEVICE}" /proc/mdstat
# if [ $? -eq 0 ]; then
# open_dialog NEW_LABEL loop
# close_dialog
# fi
# fi
done
# Create the raid devices
#for i in `grep md /proc/mdstat|sed -e 's/^\(md.*\) : active \([[:alnum:]]*\).*/\1/'`; do
# NUMBER=`echo ${i}|sed -e "s/^md//"`
# DEVICE="/var/lib/partman/devices/=dev=md=${NUMBER}"
# mkdir ${DEVICE}
# cd ${DEVICE}
# echo "/dev/md/${NUMBER}" > ${DEVICE}/device
# echo "Unknown" > ${DEVICE}/model
# echo "0" > ${DEVICE}/size
# open_dialog OPEN "/dev/md/${NUMBER}"
# read_line response
# close_dialog
# if [ "$response" = "failed" ]; then
# rm -rf ${DEVICE}
# fi
#
# open_dialog NEW_LABEL loop
# close_dialog
#done
exit 0
|