mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
bsdinstall: use the GPT label for swap in fstab
The GPT layout already labels the swap partition swapN, but fstab named the disk device. That name changes when disks are added or reordered, and swap does not come up until fstab is edited. Write /dev/gpt/swapN instead, appending .eli when swap encryption is on. Mirrored swap still uses /dev/mirror/swap, with the same suffix. Submitted by: Wanpeng Qian <[email protected]> Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D32936
This commit is contained in:
1 parent
3593be37a4
commit
49e3c256e4
1 file changed
+18
-13
@@ -1000,29 +1000,34 @@ zfs_create_diskpart()
|
||||
|
||||
# Update fstab(5)
|
||||
local swapsize
|
||||
local suffix=
|
||||
|
||||
f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize
|
||||
if [ "$ZFSBOOT_SWAP_ENCRYPTION" ]; then
|
||||
suffix=".eli"
|
||||
fi
|
||||
if [ "$isswapmirror" ]; then
|
||||
# This is not the first disk in the mirror, do nothing
|
||||
elif [ ${swapsize:-0} -eq 0 ]; then
|
||||
# If swap is 0 sized, don't add it to fstab
|
||||
elif [ "$ZFSBOOT_SWAP_ENCRYPTION" -a "$ZFSBOOT_SWAP_MIRROR" ]; then
|
||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
|
||||
/dev/mirror/swap.eli none swap sw 0 0 \
|
||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE
|
||||
isswapmirror=1
|
||||
elif [ "$ZFSBOOT_SWAP_MIRROR" ]; then
|
||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
|
||||
/dev/mirror/swap none swap sw 0 0 \
|
||||
/dev/mirror/swap$suffix none swap sw 0 0 \
|
||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE
|
||||
isswapmirror=1
|
||||
elif [ "$ZFSBOOT_SWAP_ENCRYPTION" ]; then
|
||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
|
||||
/dev/$disk${swappart}.eli none swap sw 0 0 \
|
||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE
|
||||
else
|
||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
|
||||
/dev/$disk$swappart none swap sw 0 0 \
|
||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE
|
||||
case "$ZFSBOOT_PARTITION_SCHEME" in
|
||||
GPT*)
|
||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
|
||||
/dev/gpt/swap$index$suffix none swap sw 0 0 \
|
||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE
|
||||
;;
|
||||
*)
|
||||
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
|
||||
/dev/$disk$swappart$suffix none swap sw 0 0 \
|
||||
$BSDINSTALL_TMPETC/fstab || return $FAILURE
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
return $SUCCESS
|
||||
|
||||
Reference in new issue
Block a user