aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydractl/provision22
1 files changed, 21 insertions, 1 deletions
diff --git a/share/hydractl/provision b/share/hydractl/provision
index 621b3de..5766c52 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -207,6 +207,12 @@ else
megabyte="$((1024*1024))"
block="`echo $device | sed -e 's|^/dev/||'`"
optimal_size="`cat /sys/block/$block/queue/optimal_io_size`"
+
+ # See https://access.redhat.com/articles/3911611
+ if [ "$optimal_size" == "0" ]; then
+ optimal_size="1024"
+ fi
+
alignment_offset="`cat /sys/block/$block/alignment_offset`"
block_size="`cat /sys/block/$block/queue/physical_block_size`"
start="$((($optimal_size + $alignment_offset) / $block_size))"
@@ -219,7 +225,21 @@ else
# Regular disk partitioning.
hydra_sudo_run parted -s -- $device mklabel gpt
#hydra_sudo_run parted -s -- $device unit MB mkpart non-fs 2 3
- hydra_sudo_run parted -s -- $device mkpart non-fs ${start}s ${bios_grub_end}s
+
+ # See https://unix.stackexchange.com/questions/190317/gnu-parted-resizepart-in-script#202872
+ # https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1270203
+ # https://techtitbits.com/2018/12/using-parteds-resizepart-non-interactively-on-a-busy-partition/
+ # https://serverfault.com/questions/870594/resize-partition-to-maximum-using-parted-in-non-interactive-mode
+ #hydra_sudo_run parted -s -- $device mkpart non-fs ${start}s ${bios_grub_end}s
+ #hydra_sudo_run parted -s ---pretend-input-tty -- $device mkpart non-fs ${start}s ${bios_grub_end}s Yes
+ hydra_sudo_run parted $device mkpart non-fs ${start}s ${bios_grub_end}s Yes Ignore quit
+ #hydra_sudo_run parted -s ---pretend-input-tty $device <<EOF
+#mkpart non-fs ${start}s ${bios_grub_end}s
+#Yes
+#Ignore
+#quit
+#EOF
+
hydra_sudo_run parted -s -- $device set 1 bios_grub on
if [ "$encrypt" == "y" ]; then