23 |
fi |
fi |
24 |
|
|
25 |
mdadm -C $md -l 1 -n 2 -R $part missing |
mdadm -C $md -l 1 -n 2 -R $part missing |
|
echo "DEVICE $part" >> /tmp/mdadm.conf |
|
26 |
|
|
27 |
if grep -q "^$part .*Id=83" /tmp/oldparts |
if grep -q "^$part .*Id=83" /tmp/oldparts |
28 |
then |
then |
30 |
resize2fs -fp $md |
resize2fs -fp $md |
31 |
|
|
32 |
mount $md /mnt/tmp |
mount $md /mnt/tmp |
33 |
[ -r /mnt/tmp/etc/fstab ] && root=$md |
[ -r /mnt/tmp/etc/fstab ] && sed -i "s|/dev/$device\([0-9]\+\)|/dev/md\1|" /mnt/tmp/etc/fstab |
34 |
umount /mnt/tmp |
umount /mnt/tmp |
35 |
|
|
36 |
|
|
39 |
mkswap $md |
mkswap $md |
40 |
fi |
fi |
41 |
done |
done |
|
|
|
|
echo >> /tmp/mdadm.conf |
|
|
mdadm -Es -c /tmp/mdadm.conf >> /tmp/mdadm.conf |
|
|
|
|
|
if [ -n "$root" ] |
|
|
then |
|
|
mount $root /mnt/tmp |
|
|
sed -i "s|/dev/$device\([0-9]\+\)|/dev/md\1|" /mnt/tmp/etc/fstab |
|
|
cp /tmp/mdadm.conf /mnt/tmp/etc/mdadm.conf |
|
|
umount /mnt/tmp |
|
|
fi |
|
42 |
rmdir /mnt/tmp |
rmdir /mnt/tmp |
43 |
|
|
44 |
mdadm --stop --scan |
mdadm --stop --scan |
|
|
|
45 |
sfdisk --force /dev/$device < /tmp/newparts |
sfdisk --force /dev/$device < /tmp/newparts |
46 |
fi |
fi |