public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Joe MacDonald <Joe_MacDonald@mentor.com>
To: Henning Schild <henning.schild@siemens.com>
Cc: Tobias Schmidl <tobiasschmidl@siemens.com>,
	<isar-users@googlegroups.com>,
	Joe MacDonald <joe.macdonald@siemens.com>
Subject: Re: [PATCH v5 1/1] expand-on-first-boot: Switch from resize2fs to systemd-growfs
Date: Wed, 6 Jul 2022 13:58:45 -0400	[thread overview]
Message-ID: <20220706175845.GA8527@mentor.com> (raw)
In-Reply-To: <20220701093328.6afb1538@md1za8fc.ad001.siemens.net>

[-- Attachment #1: Type: text/plain, Size: 5422 bytes --]

[Re: [PATCH v5 1/1] expand-on-first-boot: Switch from resize2fs to systemd-growfs] On 22.07.01 (Fri 09:33) Henning Schild wrote:

> Am Thu, 30 Jun 2022 12:41:25 -0400
> schrieb Joe MacDonald <Joe_MacDonald@mentor.com>:
> 
> > Only one minor observation that I should have made sooner (so if
> > there are other changes that might warrant a v6, great, but otherwise
> > I don't think it's necessary).
> > 
> > [[PATCH v5 1/1] expand-on-first-boot: Switch from resize2fs to
> > systemd-growfs] On 22.06.30 (Thu 15:55) Tobias Schmidl wrote:
> > 
> > > 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).
> > > 
> > > Signed-off-by: Tobias Schmidl <tobiasschmidl@siemens.com>
> > > ---
> > >  ...oot_1.1.bb => expand-on-first-boot_1.2.bb} |  5 +++--
> > >  .../files/expand-last-partition.sh            | 19
> > > +++++++++++++++++-- 2 files changed, 20 insertions(+), 4
> > > deletions(-) rename
> > > meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.1.bb
> > > => expand-on-first-boot_1.2.bb} (78%)
> > > 
> > > 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.2.bb
> > > similarity index 78% rename from
> > > meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> > > rename to
> > > meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
> > > index 1703a64..48d30d3 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.2.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-users@googlegroups.com>" 
> > > -DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs,
> > > fdisk, util-linux" +DEBIAN_DEPENDS = "systemd (>=236), sed, grep,
> > > coreutils, mount, 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 c0edde7..31f1ae3 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,19 @@ partx -u "${LAST_PART}"
> > >  # when using systemd mount units.
> > >  export EXT2FS_NO_MTAB_OK=1
> > >  
> > > -resize2fs "${LAST_PART}"
> > > +if grep -q x-systemd.growfs /etc/fstab; then
> > > +	echo "Found x-systemd.growfs option in /etc/fstab, won't
> > > call it explicitly." >&2
> > > +	exit 0
> > > +fi
> > > +
> > > +# mount $LAST_PART out of tree, so we won't conflict with other
> > > mounts +MOUNT_POINT=$(mktemp -d -p /mnt "$(basename
> > > "$0").XXXXXXXXXX") +if [ ! -d "${MOUNT_POINT}" ]; then
> > > +	echo "Cannot create temporary mount point ${MOUNT_POINT}."
> > > >&2  
> > 
> > This error message may be a bit more helpful if it stated the impact
> > of this problem.  Something like this, instead:
> > 
> > 	echo "Cannot create temporary mount point ${MOUNT_POINT},
> > ${LAST_PART} will not be resized." >&2
> 
> The script failing always has that result. In fact you end up in a
> weird state where the partition has been grown and the filesystem has
> not. Not sure this is needed.

That's a good point.  Actually, ideally we would roll back to the previous
(probably consistent) state, but that's going to be a difficult thing to
do safely, for sure!

> Joe did you get a chance to try that all on your btrfs use-case? I know
> Tobias tested that but getting a confirm that it works in other layers
> would be cool. But we do not need such a confirm to continue, we assume
> it will work in layers.

I did not yet, but I keep intending to, it's just a matter of finding time
to.  Having watched the progression of the work, I would be very surprised
if it does not, but I'll follow up here as soon as I get a chance to
verify this one way or the other.

-J.

> 
> Henning
> 
> > -J.
> > 
> > > +	exit 1
> > > +fi
> > > +
> > > +mount "${LAST_PART}" "${MOUNT_POINT}"
> > > +/lib/systemd/systemd-growfs "${MOUNT_POINT}"
> > > +umount "${MOUNT_POINT}"
> > > +rmdir "${MOUNT_POINT}"
> > > -- 
> > > 2.36.1
> > >   
> > 
> 

-- 
-Joe MacDonald.
Linux Architect | Siemens Digital Industries Software
:wq

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-07-06 17:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 13:55 [PATCH v5 0/1] " Tobias Schmidl
2022-06-30 13:55 ` [PATCH v5 1/1] " Tobias Schmidl
2022-06-30 15:03   ` Henning Schild
2022-06-30 16:41   ` Joe MacDonald
2022-07-01  7:33     ` Henning Schild
2022-07-06 17:58       ` Joe MacDonald [this message]
2022-06-30 15:05 ` [PATCH v5 0/1] " Henning Schild
2022-06-30 16:36   ` Joe MacDonald
2022-07-01  7:43     ` Henning Schild
2022-07-20 12:38 ` Schmidl, Tobias
2022-09-28 10:07   ` Anton Mikanovich

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=20220706175845.GA8527@mentor.com \
    --to=joe_macdonald@mentor.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=joe.macdonald@siemens.com \
    --cc=tobiasschmidl@siemens.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