We want to be more versatile in our approach of resizing the last
partition. Therefore we switch from resize2fs to systemd-growfs.
This allows for ext4, btrfs, xfs, and dm-crypt partitions to be resized.
Since systemd-growfs landed in v236, this obsoletes expand-on-first-boot
on stretch (v232).
.../expand-on-first-boot/
expand-on-first-boot_1.1.bb | 5 +++--
.../files/expand-last-partition.sh | 10 ++++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-support/expand-on-first-boot/
expand-on-first-boot_1.1.bb b/meta/recipes-support/expand-on-first-boot/
expand-on-first-boot_1.1.bb
index 1703a64..09ff234 100644
--- a/meta/recipes-support/expand-on-first-boot/
expand-on-first-boot_1.1.bb
+++ b/meta/recipes-support/expand-on-first-boot/
expand-on-first-boot_1.1.bb
@@ -1,15 +1,16 @@
# Resize last partition to full medium size on fist boot
#
# This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
+# Copyright (c) Siemens AG, 2018-2022
#
# SPDX-License-Identifier: MIT
inherit dpkg-raw
DESCRIPTION = "This service grows the last partition to the full medium during first boot"
+MAINTAINER = "isar-users <
isar-...@googlegroups.com>"
-DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk, util-linux"
+DEBIAN_DEPENDS = "systemd (>=236), sed, grep, coreutils, mount, e2fsprogs, fdisk, util-linux"
SRC_URI = " \
file://expand-on-first-boot.service \
diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
index bb371e9..37e94ca 100755
--- a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
+++ b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
@@ -3,7 +3,7 @@
# Resize last partition to full medium size
#
# This software is a part of ISAR.
-# Copyright (c) Siemens AG, 2018
+# Copyright (c) Siemens AG, 2018-2022
#
# SPDX-License-Identifier: MIT
@@ -45,4 +45,10 @@ partx -u "${LAST_PART}"
# when using systemd mount units.
export EXT2FS_NO_MTAB_OK=1
-resize2fs "${LAST_PART}"
+MOUNT_POINT=$(findmnt "${LAST_PART}" -o target -n)
+if [ -z "$MOUNT_POINT" ]; then
+ echo "Cannot find mount point for ${LAST_PART}"
+ exit 1
+fi
+mount "${MOUNT_POINT}" || true
+/lib/systemd/systemd-growfs "${MOUNT_POINT}"
--
2.36.1