From: "Moessbauer, Felix" <felix.moessbauer@siemens.com>
To: "joe_macdonald@mentor.com" <joe_macdonald@mentor.com>,
"Schild, Henning" <henning.schild@siemens.com>
Cc: "isar-users@googlegroups.com" <isar-users@googlegroups.com>,
"MacDonald, Joe" <joe.macdonald@siemens.com>
Subject: Re: [PATCH v2] expand-on-first-boot: support resizing a btrfs root
Date: Tue, 13 Dec 2022 02:10:14 +0000 [thread overview]
Message-ID: <254669d7940812f4d81f0bf87cf2276aa1185c95.camel@siemens.com> (raw)
In-Reply-To: <20221212162419.2760544e@md1za8fc.ad001.siemens.net>
On Mon, 2022-12-12 at 16:24 +0100, Henning Schild wrote:
> Am Fri, 22 Oct 2021 15:50:47 -0400
> schrieb Joe MacDonald <joe_macdonald@mentor.com>:
>
> > 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` instead 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 | 22
> > ++++++++++++++----- 1 file changed, 17 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..6975d9c 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,20 @@ 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})
>
> Calling "lsblk" suffers from the same udev race we have seen with
> systemd-growfs ... only very subtle where we get like "" ... no
> filesystem.
>
> It seems to help to mount here and findmnt the mntpoint, we need the
> mounting for btrfs anyhow.
One problem remains: Where to mount.
If we mount on /mnt this will not work on an RO rootfs out of the box.
We currently have this issue in CIP core.
We could mount below /tmp which should be writable, but I don't know
which side effects this as the tmpfs itself will be mounted / created
by systemd.
Felix
>
> Also lsblk can return multiple filesystems, like luks or lvm layers
> underneath. Where findmnt only returns the top.
>
> Joe, i had to rewrite your patch considerably. So i think i will
> change
> the authorship to myself. I would really like to give you the credits
> but am afraid to give you blame ... this whole expand story seems
> never
> ending ...
> So the patch will mention you, but likely not as author.
>
> Henning
>
> > +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 /
> > + ;;
> > + * )
> > + echo "Unrecognized filesystem type ${ROOTFS_TYPE} - no
> > resize
> > performed"
> > + exit 1
> > + ;;
> > +esac
>
next prev parent reply other threads:[~2022-12-13 2:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 18:01 [PATCH] " 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 [this message]
2022-12-13 6:02 ` Roberto A. Foglietta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=254669d7940812f4d81f0bf87cf2276aa1185c95.camel@siemens.com \
--to=felix.moessbauer@siemens.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=joe.macdonald@siemens.com \
--cc=joe_macdonald@mentor.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox