public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] expand-on-first-boot: support resizing a btrfs root
@ 2021-10-22 18:01 Joe MacDonald
  2021-10-22 18:19 ` Jan Kiszka
  0 siblings, 1 reply; 16+ messages in thread
From: Joe MacDonald @ 2021-10-22 18:01 UTC (permalink / raw)
  To: isar-users; +Cc: joe.macdonald

resize2fs fails if the build sets the root filesystem for an image to
btrfs though the partition is expanded properly. Since the rest of the
script works as intended, simply checking the last partition type with
lsblk and adding `btrfs resize` instaed of `resize2fs` in the appropriate
circumstance allows everything to function as expected.

Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
---
 .../files/expand-last-partition.sh              | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

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 7175dfd..23cfd86 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
@@ -36,8 +36,15 @@ sfdisk -d "${BOOT_DEV}" 2>/dev/null | \
 # Inform the kernel about the partitioning change
 partx -u "${LAST_PART}"
 
-# Do not fail resize2fs if no mtab entry is found, e.g.,
-# when using systemd mount units.
-export EXT2FS_NO_MTAB_OK=1
-
-resize2fs "${LAST_PART}"
+# Determine the filesystem type and perform the appropriate resize function
+ROOTFS_TYPE=$(lsblk -fno FSTYPE ${ROOT_DEV})
+case ${ROOTFS_TYPE} in
+   ext* )
+      # Do not fail resize2fs if no mtab entry is found, e.g.,
+      # when using systemd mount units.
+      export EXT2FS_NO_MTAB_OK=1
+      resize2fs "${LAST_PART}"
+      ;;
+   btrfs ) btrfs filesystem resize max / ;;
+   * ) exit 1 ;;
+esac
-- 
2.30.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-12-13  6:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 18:01 [PATCH] expand-on-first-boot: support resizing a btrfs root Joe MacDonald
2021-10-22 18:19 ` Jan Kiszka
2021-10-22 19:50   ` Joe MacDonald
2021-10-22 19:50   ` [PATCH v2] " Joe MacDonald
2021-10-25  8:10     ` Henning Schild
2021-10-25  8:22       ` Henning Schild
2022-04-22  7:57     ` Henning Schild
2022-04-22  9:06       ` Jan Kiszka
2022-12-09 15:40     ` Henning Schild
2022-12-10  3:28       ` Roberto A. Foglietta
2022-12-10 16:29         ` Henning Schild
2022-12-10 20:37           ` Roberto A. Foglietta
2022-12-12 15:24     ` Henning Schild
2022-12-12 17:48       ` Roberto A. Foglietta
2022-12-13  2:10       ` Moessbauer, Felix
2022-12-13  6:02         ` Roberto A. Foglietta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox