diff options
author | Bob Gilligan <gilligan@vyatta.com> | 2008-11-24 10:51:26 -0800 |
---|---|---|
committer | Bob Gilligan <gilligan@vyatta.com> | 2008-11-24 10:51:26 -0800 |
commit | a692e814b585d9e55f47d64fa3794d11840f1111 (patch) | |
tree | 6308027607800c36a6a10a8a9d75a59f0af52107 /scripts/install-system | |
parent | 147fc08625ce3245c32367a4dac227b71f05b562 (diff) | |
download | vyatta-cfg-quagga-a692e814b585d9e55f47d64fa3794d11840f1111.tar.gz vyatta-cfg-quagga-a692e814b585d9e55f47d64fa3794d11840f1111.zip |
Bugfix 3747: Allow user to break previously existing RAID group.
Add logic to install system to allow user to break previously existing
RAID group. This completely destroys the RAID group so that nothing
remains even if the subsequent install doesn't use all of the disks that
make up the RAID group.
Diffstat (limited to 'scripts/install-system')
-rwxr-xr-x | scripts/install-system | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/scripts/install-system b/scripts/install-system index 65a31571..4993b97c 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 |