summaryrefslogtreecommitdiff
path: root/scripts/install-system
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-11-24 15:06:18 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2008-11-24 15:06:18 -0800
commit633f5cc115bd1482aa4cd6901715d72fd625c218 (patch)
treef64cce08cba5bdfccaa3c64f0bed910a66394378 /scripts/install-system
parent62af8baf3a696f774430117927440c114248a81d (diff)
parent32a07da80b4a23a254b8d1190aca1b61bca47fdd (diff)
downloadvyatta-cfg-system-633f5cc115bd1482aa4cd6901715d72fd625c218.tar.gz
vyatta-cfg-system-633f5cc115bd1482aa4cd6901715d72fd625c218.zip
Merge branch 'jenner' of suva.vyatta.com:/git/vyatta-cfg-system into jenner
Diffstat (limited to 'scripts/install-system')
-rwxr-xr-xscripts/install-system36
1 files changed, 34 insertions, 2 deletions
diff --git a/scripts/install-system b/scripts/install-system
index 2cd16d65..e8f469c8 100755
--- a/scripts/install-system
+++ b/scripts/install-system
@@ -254,9 +254,41 @@ check_for_old_raid () {
response=$(get_response "Yes" "Yes No Y N")
if [ "$response" == "no" ] || [ "$response" == "n" ]; then
+ echo
echo "Ok. Not using existing RAID groups."
- echo "Stopping existing RAID groups:"
- mdadm --stop --scan
+ echo
+
+ # pick the first RAID group to be broken
+ raid_drive=$(echo $raid_drives | /usr/bin/awk '{ print $1 }')
+
+ echo "Would you like to break RAID group $raid_drive so that its"
+ echo "members can be re-used for a new installation, understanding"
+ echo -n "that doing so will destroy all data on it? (Yes/No) [No]:"
+ destroy_raid=$(get_response "No" "Yes No Y N")
+ echo
+
+ if [ "${destroy_raid:0:1}" = "y" ]; then
+ echo "OK. Breaking the RAID group $raid_drive."
+
+ members=`ls /sys/block/$raid_drive/slaves`
+
+ echo "First, stopping all existing RAID groups:"
+ mdadm --stop --scan
+
+ for member in $members ; do
+ drive=${member:0:3}
+ part=${member:3:1}
+ echo "Re-setting partition ID for RAID group $raid_drive member /dev/${member}:"
+ sfdisk --change-id /dev/$drive $part 0x83
+ echo "Clearing RAID superblock from RAID group $raid_drive member /dev/${member}."
+ mdadm --zero-superblock /dev/$member
+ done
+ else
+ echo "OK. Stopping, but not breaking, existing RAID groups:"
+ mdadm --stop --scan
+ fi
+
+ echo
return
fi