From e99df742a191ebebedcf1fd0dbf24f06ca236e62 Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Mon, 20 Nov 2023 17:40:28 +0530 Subject: [PATCH] use a +1MiB of extra space for each "dd"-ed partition --- create-image.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/create-image.sh b/create-image.sh index 8e9600d..0186ca8 100755 --- a/create-image.sh +++ b/create-image.sh @@ -23,8 +23,9 @@ function create_new_image { LOOPBACK_01=$(losetup -f -P --show "${IMAGE_NAME}") LOOPBACK_02=$(losetup -f -P --show "${NEW_IMAGE_NAME}") - UEFI_SECTORS="$(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p1" | awk '{print $4}')" - BOOT_SECTORS="$(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p2" | awk '{print $4}')" + # 1 MiB = 2048 * (1 block/sector (512 bytes)) + UEFI_SECTORS="$(( $(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p1" | awk '{print $4}') + 2048 ))" + BOOT_SECTORS="$(( $(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p2" | awk '{print $4}') + 2048 ))" cat << EOF | fdisk "${LOOPBACK_02}" g