From ef85e0be874a627e89ab9ae3e2d33cd2263707e2 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 4 Oct 2018 12:21:51 +0200 Subject: [PATCH] remove PARTITION_ALIGNMENT and fix 4k block size instance disks Since sfdisk doesn't supprot forced chs geometry any more, in situations where underlaying storage has 4k block, this script will create correct partition table for host, but not for guest which expects 512b blocks. This will make machine unbootable, since once kvm starts partition will be at wrong offset and it won't boot. Solution is to re-create partition table at end using losetup which has 512b blocks. Since PARTITION_ALIGNMENT is created using 4k block as base, it will create filesystem at wrong place if you are using default value of 2048. This hard-codes host partition table to 1M (which will work on hosts with both 512b and 4k blocks) and then use 2048 when using 512b blocks. --- common.sh.in | 17 ++++++++++++++--- defaults | 6 ------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/common.sh.in b/common.sh.in index d21ed0c..402fcd5 100644 --- a/common.sh.in +++ b/common.sh.in @@ -101,9 +101,9 @@ format_disk0() { if sfdisk --help | fgrep -q -- '--no-reread'; then ARGS="--no-reread $ARGS" fi - + ARGS="--label dos $ARGS" sfdisk $ARGS --quiet "$1" <