Fixed mdadm invocation, added raid names

This commit is contained in:
oddlama 2020-04-21 23:29:06 +02:00
parent 9133dcb37c
commit cfcefae1ec
No known key found for this signature in database
GPG Key ID: 88EA325D51D53908
3 changed files with 17 additions and 7 deletions

View File

@ -24,7 +24,10 @@ create_default_disk_layout swap=8GiB /dev/sdX
################################################
# System configuration
# Enter the desired system hostname here
# Enter the desired system hostname here,
# be aware that when creating raid arrays, this value will be
# recorded in metadata block. If you change it later, you should
# also update the metadata.
HOSTNAME="gentoo"
# The timezone for the new system

View File

@ -211,16 +211,17 @@ disk_create_partition() {
disk_create_raid() {
local new_id="${arguments[new_id]}"
local level="${arguments[level]}"
local name="${arguments[name]}"
local ids="${arguments[ids]}"
if [[ $disk_action_summarize_only == true ]]; then
local id
# Splitting is intentional here
# shellcheck disable=SC2086
for id in ${ids//';'/ }; do
add_summary_entry "$id" "_$new_id" "raid$level" "" ""
add_summary_entry "$id" "_$new_id" "raid$level" "" "$(summary_color_args name)"
done
add_summary_entry __root__ "$new_id" "raid$level" "" ""
add_summary_entry __root__ "$new_id" "raid$level" "" "$(summary_color_args name)"
return 0
fi
@ -240,7 +241,12 @@ disk_create_raid() {
disk_id_to_resolvable[$new_id]="uuid:$uuid"
einfo "Creating raid$level ($new_id) on $devices_desc"
mdadm --create \
mdadm \
--create "/dev/md/$name" \
--verbose \
--homehost="$HOSTNAME" \
--metadata=1.2 \
--raid-devices="${#devices[@]}" \
--uuid="$uuid" \
--level="$level" \
"${devices[@]}" \

View File

@ -136,11 +136,12 @@ create_partition() {
# Named arguments:
# new_id: Id for the new raid
# level: Raid level
# name: Raid name (/dev/md/<name>)
# ids: Comma separated list of all member ids
create_raid() {
USED_RAID=true
local known_arguments=('+new_id' '+level' '+ids')
local known_arguments=('+new_id' '+level' '+name' '+ids')
local extra_arguments=()
declare -A arguments; parse_arguments "$@"
@ -264,8 +265,8 @@ create_raid0_luks_layout() {
done
[[ $size_swap != "false" ]] && \
create_raid new_id=part_raid_swap level=0 ids="$(expand_ids '^part_swap_dev[[:digit:]]$')"
create_raid new_id=part_raid_root level=0 ids="$(expand_ids '^part_root_dev[[:digit:]]$')"
create_raid new_id=part_raid_swap name="swap" level=0 ids="$(expand_ids '^part_swap_dev[[:digit:]]$')"
create_raid new_id=part_raid_root name="root" level=0 ids="$(expand_ids '^part_root_dev[[:digit:]]$')"
create_luks new_id=part_luks_root id=part_raid_root
format id="part_${type}_dev0" type="$type" label="$type"