bsdinstall(8): Fix GPT label conflicts with disks not managed by us

Signed-off-by: Phil Krylov <phil@krylov.eu>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1735
This commit is contained in:
Phil Krylov
2025-06-22 02:39:30 +00:00
committed by Warner Losh
parent 925f536824
commit a62eaf71dd
+19
View File
@@ -242,6 +242,7 @@ ZPOOL_SET='zpool set %s "%s"'
hline_alnum_arrows_punc_tab_enter="Use alnum, arrows, punctuation, TAB or ENTER"
hline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER"
hline_arrows_tab_enter="Press arrows, TAB or ENTER"
msg_all_possible_gpt_labels_already_taken="All possible GPT labels already taken"
msg_an_unknown_error_occurred="An unknown error occurred"
msg_back="Back"
msg_cancel="Cancel"
@@ -840,6 +841,24 @@ zfs_create_diskpart()
case "$ZFSBOOT_PARTITION_SCHEME" in
""|GPT*) f_dprintf "$funcname: Creating GPT layout..."
#
# 0. Check for potential GPT label conflicts with disks not
# managed by us and adjust $index accordingly
#
while [ -e /dev/gpt/efiboot$index ] ||
[ -e /dev/gpt/gptboot$index ] ||
[ -e /dev/gpt/boot$index ] ||
[ -e /dev/gpt/swap$index ] ||
[ -e /dev/gpt/zfs$index ]; do
index=$(( $index + 1 ))
if [ $index -ge 4096 ]; then
f_dprintf "$funcname: all possible GPT labels already taken"
msg_error="$msg_error: $funcname" f_show_err \
"$msg_all_possible_gpt_labels_already_taken"
return $FAILURE
fi
done
#
# 1. Create GPT layout using labels
#