summaryrefslogtreecommitdiff
path: root/scripts/install-system
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2008-10-20 10:57:33 -0700
committerBob Gilligan <gilligan@vyatta.com>2008-10-20 10:57:33 -0700
commit523d1b674931a3bf8c97706d237da06b4b425e63 (patch)
treed71436091c4fb63ee5997c8822dd12718c07ac55 /scripts/install-system
parentdcf88dd71fb7c6464464472ca829a5a59ca4d3b6 (diff)
downloadvyatta-cfg-quagga-523d1b674931a3bf8c97706d237da06b4b425e63.tar.gz
vyatta-cfg-quagga-523d1b674931a3bf8c97706d237da06b4b425e63.zip
Bugfix: 3775: Allow RAID-1 to be configured on disks with different sizes
Diffstat (limited to 'scripts/install-system')
-rw-r--r--scripts/install-system61
1 files changed, 40 insertions, 21 deletions
diff --git a/scripts/install-system b/scripts/install-system
index 9980e210..f5484e9a 100644
--- a/scripts/install-system
+++ b/scripts/install-system
@@ -305,9 +305,11 @@ check_for_new_raid () {
numdrives=`echo $drives | wc -w`
+ # Need at least two drives for RAID-1. We don't yet have the code
+ # to handle selection of two from a set of 3 or more, so for now, we
+ # only support two drives.
+ #
if [ $numdrives -ne 2 ]; then
- # debug
- echo "check_for_new_raid: don't have 2 drives"
return
fi
@@ -317,13 +319,14 @@ check_for_new_raid () {
drivesize1=$(get_drive_size $drive1)
drivesize2=$(get_drive_size $drive2)
- if [ $drivesize1 -ne $drivesize2 ]; then
- # debug
- echo "check_for_new_raid: have 2 drives, but different sizes"
+ # Both drives must have enough space to hold our minimum root filesystem
+ #
+ if [ $drivesize1 -lt $ROOT_MIN -o $drivesize2 -lt $ROOT_MIN ]; then
return
fi
- echo "You have two identical disk drives:"
+
+ echo "You have two disk drives:"
echo -e "\t$drive1 \t$drivesize1 MB"
echo -e "\t$drive2 \t$drivesize2 MB"
@@ -334,6 +337,13 @@ check_for_new_raid () {
return
fi
+ if [ $drivesize1 -ne $drivesize2 ]; then
+ echo "Since the disks are not the same size, we will use the smaller"
+ echo "of the two sizes in configuring the RAID-1 set. This will"
+ echo "waste some space on the larger drive."
+ echo ""
+ fi
+
# Configure RAID-1
echo "This process will erase all data on both drives."
echo -n "Are you sure you want to do this? (Yes/No) [No]: "
@@ -358,27 +368,36 @@ check_for_new_raid () {
part_start_offset=2
part_diag_size=60
- echo "Would you like me to create a $part_diag_size MB partition for diagnostics?"
- echo -n "(Yes/No) [No]: "
- diag_response=$(get_response "No" "Yes No Y N")
- if [ "$diag_response" == "yes" ] || [ "$diag_response" == "y" ]; then
- for drive in $drives
- do
- echo "Creating diag partition on drive $drive"
- create_partitions "$drive" $part_diag_size $part_start_offset "no"
- sfdisk --change-id /dev/$drive 1 0x6
- done
- data_dev=2
- let part_start_offset+=$part_diag_size
+ if [ $drivesize1 -gt $drivesize2 ]; then
+ size=$drivesize1
else
- data_dev=1
+ size=$drivesize2
fi
+ let min_size_with_diag=${MIN_ROOT}+${part_diag_size}
+ if [ $size -ge $min_size_with_diag ]; then
+ echo "Would you like me to create a $part_diag_size MB partition for diagnostics?"
+ echo -n "(Yes/No) [No]: "
+ diag_response=$(get_response "No" "Yes No Y N")
+ if [ "$diag_response" == "yes" ] || [ "$diag_response" == "y" ]; then
+ for drive in $drives
+ do
+ echo "Creating diag partition on drive $drive"
+ create_partitions "$drive" $part_diag_size $part_start_offset "no"
+ sfdisk --change-id /dev/$drive 1 0x6
+ done
+ data_dev=2
+ let part_start_offset+=$part_diag_size
+ else
+ data_dev=1
+ fi
+ fi
+
+ let size-=$part_start_offset
+
for drive in $drives
do
echo "Creating data partition: /dev/${drive}${data_dev}"
- size=$(get_drive_size $drive)
- let size-=$part_start_offset
create_partitions "$drive" $size $part_start_offset "no"
sfdisk --change-id /dev/$drive $data_dev 0xfd
done