[Re: [PATCH] expand-on-first-boot: support resizing a btrfs root] On 21.10.22 (Fri 20:19) Jan Kiszka wrote: > On 22.10.21 20:01, Joe MacDonald wrote: > > 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 > > typo: instead Oop, fixed. Thanks. > > circumstance allows everything to function as expected. > > > > Signed-off-by: Joe MacDonald > > --- > > .../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 / ;; > > Could we reformat this to use multiple line, like the block above? Yes, good suggestion. v2 also includes an informational message on the fall-through condition rather than silently exiting with a failure. -Joe. > > > + * ) exit 1 ;; > > +esac > > > > Good extension! > > Jan > > -- > Siemens AG, T RDA IOT > Corporate Competence Center Embedded Linux -- -Joe MacDonald. Linux Architect | Mentor® A Siemens Business :wq