126 |
# from https://wiki.contribs.org/Raid |
# from https://wiki.contribs.org/Raid |
127 |
# 2 Drives - Software RAID 1 |
# 2 Drives - Software RAID 1 |
128 |
# 3 Drives - Software RAID 1 + 1 Hot-spare |
# 3 Drives - Software RAID 1 + 1 Hot-spare |
129 |
# 4-6 Drives - Software RAID 5 + 1 Hot-spare |
# 4 Drives - Software RAID 6 |
130 |
# 7+ Drives - Software RAID 6 + 1 Hot-spare |
# 5+ Drives - Software RAID 6 + 1 Hot-spare |
131 |
|
|
132 |
if [ ${#DRIVES[@]} == 2 ] ; then |
if [ ${#DRIVES[@]} == 2 ] ; then |
133 |
LEVEL=1 |
LEVEL=1 |
135 |
elif [ ${#DRIVES[@]} == 3 ] ; then |
elif [ ${#DRIVES[@]} == 3 ] ; then |
136 |
LEVEL=1 |
LEVEL=1 |
137 |
SPARE=1 |
SPARE=1 |
138 |
elif (( ${#DRIVES[@]} > 3 && ${#DRIVES[@]} <= 6 )) ; then |
elif [ ${#DRIVES[@]} == 4 ] ; then |
139 |
LEVEL=5 |
LEVEL=6 |
140 |
SPARE=1 |
SPARE=0 |
141 |
else |
else |
142 |
LEVEL=6 |
LEVEL=6 |
143 |
SPARE=1 |
SPARE=1 |
150 |
|
|
151 |
# Include the EFI partition if necessary |
# Include the EFI partition if necessary |
152 |
if [ -d /sys/firmware/efi ] ; then |
if [ -d /sys/firmware/efi ] ; then |
153 |
printf "raid /boot/efi --fstype=efi --level=1 --spares=%s --device=md9 %s\n" "$SPARE" "$EFIDEVS" >> /tmp/part-include |
printf "raid /boot/efi --fstype=efi --level=1 --spares=0 --device=md9 %s\n" "$EFIDEVS" >> /tmp/part-include |
154 |
fi |
fi |
155 |
|
|
156 |
printf "raid /boot --fstype=xfs --level=1 --spares=%s --device=md0 %s\n" "$SPARE" "$BOOTDEVS" >> /tmp/part-include |
printf "raid /boot --fstype=xfs --level=1 --spares=0 --device=md0 %s\n" "$BOOTDEVS" >> /tmp/part-include |
157 |
printf "raid pv.01 --level=%s --spares=%s --device=md1 %s\n" "$LEVEL" "$SPARE" "$ROOTDEVS" >> /tmp/part-include |
printf "raid pv.01 --level=%s --spares=%s --device=md1 %s\n" "$LEVEL" "$SPARE" "$ROOTDEVS" >> /tmp/part-include |
158 |
|
|
159 |
# Set up LVM |
# Set up LVM |