]> gitweb.fluxo.info Git - hydra.git/commitdiff
Provision: alignment fixes
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 5 Jun 2020 21:22:10 +0000 (18:22 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 5 Jun 2020 21:22:10 +0000 (18:22 -0300)
share/hydractl/provision

index 621b3de5509af63f00602d303393f8a15dcb9790..5766c5274a20cdc74c7fef187282cab07b2ed6d0 100755 (executable)
@@ -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