Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150996737
D3062.id6882.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D3062.id6882.diff
View Options
Index: usr.sbin/bsdinstall/scripts/zfsboot
===================================================================
--- usr.sbin/bsdinstall/scripts/zfsboot
+++ usr.sbin/bsdinstall/scripts/zfsboot
@@ -185,11 +185,11 @@
GELI_ATTACH='geli attach -j - -k "%s" "%s"'
GELI_DETACH_F='geli detach -f "%s"'
GELI_PASSWORD_INIT='geli init -b -B "%s" -e %s -J - -K "%s" -l 256 -s 4096 "%s"'
-GPART_ADD='gpart add -t %s "%s"'
-GPART_ADD_INDEX='gpart add -i %s -t %s "%s"'
-GPART_ADD_INDEX_WITH_SIZE='gpart add -i %s -t %s -s %s "%s"'
-GPART_ADD_LABEL='gpart add -l %s -t %s "%s"'
-GPART_ADD_LABEL_WITH_SIZE='gpart add -l %s -t %s -s %s "%s"'
+GPART_ADD_ALIGN='gpart add %s -t %s "%s"'
+GPART_ADD_ALIGN_INDEX='gpart add %s -i %s -t %s "%s"'
+GPART_ADD_ALIGN_INDEX_WITH_SIZE='gpart add %s -i %s -t %s -s %s "%s"'
+GPART_ADD_ALIGN_LABEL='gpart add %s -l %s -t %s "%s"'
+GPART_ADD_ALIGN_LABEL_WITH_SIZE='gpart add %s -l %s -t %s -s %s "%s"'
GPART_BOOTCODE='gpart bootcode -b "%s" "%s"'
GPART_BOOTCODE_PART='gpart bootcode -b "%s" -p "%s" -i %s "%s"'
GPART_CREATE='gpart create -s %s "%s"'
@@ -810,7 +810,12 @@
#
# Lay down the desired type of partition scheme
#
- local setsize mbrindex
+ local setsize mbrindex align_small align_big
+ if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then
+ align_small="-a 4k"
+ align_big="-a 1m"
+ fi
+
case "$ZFSBOOT_PARTITION_SCHEME" in
""|GPT) f_dprintf "$funcname: Creating GPT layout..."
#
@@ -822,8 +827,8 @@
#
# 2. Add small freebsd-boot partition labeled `boot#'
#
- f_eval_catch $funcname gpart "$GPART_ADD_LABEL_WITH_SIZE" \
- gptboot$index freebsd-boot 512k $disk ||
+ f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
+ "$align_small" gptboot$index freebsd-boot 512k $disk ||
return $FAILURE
f_eval_catch $funcname gpart "$GPART_BOOTCODE_PART" \
/boot/pmbr /boot/gptzfsboot 1 $disk ||
@@ -840,8 +845,9 @@
bootpart=p2 swappart=p3 targetpart=p3
[ ${swapsize:-0} -gt 0 ] && targetpart=p4
f_eval_catch $funcname gpart \
- "$GPART_ADD_LABEL_WITH_SIZE" boot$index \
- freebsd-zfs ${bootsize}b $disk ||
+ "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
+ "$align_big" boot$index freebsd-zfs \
+ ${bootsize}b $disk ||
return $FAILURE
# Pedantically nuke any old labels
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
@@ -859,8 +865,9 @@
#
if [ ${swapsize:-0} -gt 0 ]; then
f_eval_catch $funcname gpart \
- "$GPART_ADD_LABEL_WITH_SIZE" swap$index \
- freebsd-swap ${swapsize}b $disk ||
+ "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
+ "$align_big" swap$index freebsd-swap \
+ ${swapsize}b $disk ||
return $FAILURE
# Pedantically nuke any old labels on the swap
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
@@ -870,8 +877,9 @@
#
# 4. Add freebsd-zfs partition labeled `zfs#' for zroot
#
- f_eval_catch $funcname gpart "$GPART_ADD_LABEL" \
- zfs$index freebsd-zfs $disk || return $FAILURE
+ f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_LABEL" \
+ "$align_big" zfs$index freebsd-zfs $disk ||
+ return $FAILURE
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
/dev/$disk$targetpart
;;
@@ -888,7 +896,8 @@
#
# 2. Add freebsd slice with all available space
#
- f_eval_catch $funcname gpart "$GPART_ADD" freebsd $disk ||
+ f_eval_catch $funcname gpart "$GPART_ADD_ALIGN" "$align_small" \
+ freebsd $disk ||
return $FAILURE
f_eval_catch $funcname gpart "$GPART_SET_ACTIVE" 1 $disk ||
return $FAILURE
@@ -912,8 +921,8 @@
#
ZFSBOOT_BOOT_POOL=1
f_eval_catch $funcname gpart \
- "$GPART_ADD_INDEX_WITH_SIZE" \
- 1 freebsd-zfs ${bootsize}b ${disk}s1 ||
+ "$GPART_ADD_ALIGN_INDEX_WITH_SIZE" \
+ "$align_small" 1 freebsd-zfs ${bootsize}b ${disk}s1 ||
return $FAILURE
# Pedantically nuke any old labels
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
@@ -930,8 +939,8 @@
#
if [ ${swapsize:-0} -gt 0 ]; then
f_eval_catch $funcname gpart \
- "$GPART_ADD_INDEX_WITH_SIZE" 2 \
- freebsd-swap ${swapsize}b ${disk}s1 ||
+ "$GPART_ADD_ALIGN_INDEX_WITH_SIZE" \
+ "$align_small" 2 freebsd-swap ${swapsize}b ${disk}s1 ||
return $FAILURE
# Pedantically nuke any old labels on the swap
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
@@ -941,8 +950,8 @@
#
# 5. Add freebsd-zfs partition for zroot
#
- f_eval_catch $funcname gpart "$GPART_ADD_INDEX" \
- $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE
+ f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_INDEX" \
+ "$align_small" $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE
f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
/dev/$disk$targetpart # Pedantic
f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 9:10 AM (3 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30954492
Default Alt Text
D3062.id6882.diff (5 KB)
Attached To
Mode
D3062: Make the zfsboot part of bsdinstall align partitions to 4k/1m when the option is enabled
Attached
Detach File
Event Timeline
Log In to Comment