2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-06-02 09:19:39 +00:00

Merge pull request #212 from Obihoernchen/swraid

Fix software RAID creation with newer mdadm versions

LGTM
This commit is contained in:
Jarrod Johnson
2026-05-22 09:41:31 -04:00
committed by GitHub
+10 -3
View File
@@ -7,17 +7,24 @@ NUMDEVS=$(for dev in $DEVICES; do
echo wipefs -a -f $dev
done|wc -l)
for dev in $DEVICES; do
mdadm --zero-superblock $dev
wipefs -a -f $dev
done
# must use older metadata format to leave disks looking normal for uefi
mdadm -C /dev/md/raid $DEVICES -n $NUMDEVS -e 1.0 -l $RAIDLEVEL
mdadm -C /dev/md/raid $DEVICES -n $NUMDEVS -e 1.0 -l $RAIDLEVEL -b internal
# shut and restart array to prime things for anaconda
mdadm -S -s
mdadm --assemble --scan
)
while [ ! -e /dev/md/raid ]; do
while :; do
# newer mdraid verions might have <hostname>:<raidname>
TARGET_RAID=$(ls /dev/md/raid /dev/md/*:raid 2>/dev/null | head -n 1)
[ -n "$TARGET_RAID" ] && break
echo 'Waiting on array to be linked...'
sleep 0.5
done
readlink /dev/md/raid|sed -e 's/.*\///' > /tmp/installdisk
# Extract the underlying block device name (e.g., md127) using the captured path
readlink "$TARGET_RAID" | sed -e 's/.*\///' > /tmp/installdisk