public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
@ 2022-09-30  8:00 Roberto A. Foglietta
  2022-09-30  8:56 ` Jan Kiszka
  2022-09-30 11:34 ` Fwd: [PATCH 1/1] expand last partition supports btrfs (inline 2nd version) Roberto A. Foglietta
  0 siblings, 2 replies; 9+ messages in thread
From: Roberto A. Foglietta @ 2022-09-30  8:00 UTC (permalink / raw)
  To: isar-users

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

>From 67c4ea67ac96276c5ec0e6b15d035543b99b8e04 Mon Sep 17 00:00:00 2001
From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Date: Thu, 29 Sep 2022 15:36:48 +0000
Subject: [PATCH] expand last partition btrfs support added

improvement, expand-on-first-boot: support for btrfs added

Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
 .../expand-on-first-boot/expand-on-first-boot_1.1.bb       | 2 +-
 .../expand-on-first-boot/files/expand-last-partition.sh    | 7 ++++++-
 2 files changed, 7 insertions(+), 2 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..d41dd83 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
@@ -9,7 +9,7 @@ inherit dpkg-raw

 DESCRIPTION = "This service grows the last partition to the full medium
during first boot"

-DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk,
util-linux"
+DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk,
util-linux, btrfs-progs"

 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 759ff8b..5b73dc4 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
@@ -61,4 +61,9 @@ partx -u "${LAST_PART}"
 # when using systemd mount units.
 export EXT2FS_NO_MTAB_OK=1

-resize2fs "${LAST_PART}"
+if ! resize2fs "${LAST_PART}"; then
+ mkdir -p /tmp/btrfs
+ mount "${LAST_PART}" /tmp/btrfs
+ btrfs filesystem resize max /tmp/btrfs
+ umount /tmp/btrfs
+fi
-- 
2.30.2

[-- Attachment #2: Type: text/html, Size: 3508 bytes --]

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

* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
  2022-09-30  8:00 [PATCH 1/1] expand last partition supports btrfs (inline test) Roberto A. Foglietta
@ 2022-09-30  8:56 ` Jan Kiszka
  2022-09-30 10:23   ` Schmidl, Tobias
  2022-09-30 11:34 ` Fwd: [PATCH 1/1] expand last partition supports btrfs (inline 2nd version) Roberto A. Foglietta
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2022-09-30  8:56 UTC (permalink / raw)
  To: Roberto A. Foglietta, isar-users, Schmidl, Tobias (T CED SES-DE)

On 30.09.22 10:00, Roberto A. Foglietta wrote:
> From 67c4ea67ac96276c5ec0e6b15d035543b99b8e04 Mon Sep 17 00:00:00 2001
> From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com
> <mailto:roberto.foglietta@gmail.com>>
> Date: Thu, 29 Sep 2022 15:36:48 +0000
> Subject: [PATCH] expand last partition btrfs support added
> 
> improvement, expand-on-first-boot: support for btrfs added
> 
> Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com
> <mailto:roberto.foglietta@gmail.com>>
> ---
>  .../expand-on-first-boot/expand-on-first-boot_1.1.bb
> <http://expand-on-first-boot_1.1.bb>       | 2 +-
>  .../expand-on-first-boot/files/expand-last-partition.sh    | 7 ++++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git
> a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> <http://expand-on-first-boot_1.1.bb>
> b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> <http://expand-on-first-boot_1.1.bb>
> index 1703a64..d41dd83 100644
> ---
> a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> <http://expand-on-first-boot_1.1.bb>
> +++
> b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.1.bb
> <http://expand-on-first-boot_1.1.bb>
> @@ -9,7 +9,7 @@ inherit dpkg-raw
>  
>  DESCRIPTION = "This service grows the last partition to the full medium
> during first boot"
>  
> -DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs,
> fdisk, util-linux"
> +DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs,
> fdisk, util-linux, btrfs-progs"
>  
>  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 759ff8b..5b73dc4 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
> @@ -61,4 +61,9 @@ partx -u "${LAST_PART}"
>  # when using systemd mount units.
>  export EXT2FS_NO_MTAB_OK=1
>  
> -resize2fs "${LAST_PART}"
> +if ! resize2fs "${LAST_PART}"; then
> +mkdir -p /tmp/btrfs
> +mount "${LAST_PART}" /tmp/btrfs
> +btrfs filesystem resize max /tmp/btrfs
> +umount /tmp/btrfs
> +fi
> -- 
> 2.30.2
> 

https://groups.google.com/d/msgid/isar-users/20220630135531.717696-2-tobiasschmidl%40siemens.com
is the way forward, but it needs some more fine-tuning. Tobias, what is
the status there?

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


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

* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
  2022-09-30  8:56 ` Jan Kiszka
@ 2022-09-30 10:23   ` Schmidl, Tobias
  2022-09-30 10:39     ` Roberto A. Foglietta
  2022-09-30 10:51     ` Henning Schild
  0 siblings, 2 replies; 9+ messages in thread
From: Schmidl, Tobias @ 2022-09-30 10:23 UTC (permalink / raw)
  To: roberto.foglietta, isar-users, jan.kiszka

Hi Jan, Roberto,

Am Freitag, dem 30.09.2022 um 10:56 +0200 schrieb Jan Kiszka:
> On 30.09.22 10:00, Roberto A. Foglietta wrote:
> 
> 
> https://groups.google.com/d/msgid/isar-users/20220630135531.717696-2-tobiasschmidl%40siemens.com> is the way forward, but it needs some more fine-tuning. Tobias, what is
> the status there?
> 

As I understand it the mentioned patch is dead, since the systemd version
in stretch is too old for systemd-resizefs - or did I miss anything?

Kind regards,

Tobias

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

* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
  2022-09-30 10:23   ` Schmidl, Tobias
@ 2022-09-30 10:39     ` Roberto A. Foglietta
  2022-09-30 10:50       ` Bezdeka, Florian
  2022-09-30 10:51     ` Henning Schild
  1 sibling, 1 reply; 9+ messages in thread
From: Roberto A. Foglietta @ 2022-09-30 10:39 UTC (permalink / raw)
  To: Schmidl, Tobias; +Cc: isar-users, Jan Kiszka

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

Il Ven 30 Set 2022, 12:23 Schmidl, Tobias <tobiasschmidl@siemens.com> ha
scritto:

> Hi Jan, Roberto,
>
> Am Freitag, dem 30.09.2022 um 10:56 +0200 schrieb Jan Kiszka:
> > On 30.09.22 10:00, Roberto A. Foglietta wrote:
> >
> >
> >
> https://groups.google.com/d/msgid/isar-users/20220630135531.717696-2-tobiasschmidl%40siemens.com>
> is the way forward, but it needs some more fine-tuning. Tobias, what is
> > the status there?
> >
>
> As I understand it the mentioned patch is dead, since the systemd version
> in stretch is too old for systemd-resizefs - or did I miss anything?
>

Hi Tobias and Jan,

 as you can see my approach is straight simple: if extending the ext4 fails
because it does not match the filesystem type then try with btrfs tool.
Obviously, the btrfs tool is added as dependencies among others before
defined.

 pro: it supports btrfs, easy to catch

 contro: not a general approach

 I tend to be very pragmatic: the current supports ext4 resize only + a
simple patch it supports btrfs also. This is an improvement and add a
little of complexity. May be tomorrow, it will arrive the support for xfs
or dm-crypto. Step by step functionalities will be added and at a certain
point someone will feel the nessecity to rationalise the code but not
necessarily generalising (architecture change).

 This kind of development is about natural evolution rather than
intelligent design. Ok, sometimes it is necessary to reorganise, rewrite,
generalise, the product of the natural evolution but usually fits enough.
My 2 cents, IMHO.

 Cheers, R.

>

[-- Attachment #2: Type: text/html, Size: 2533 bytes --]

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

* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
  2022-09-30 10:39     ` Roberto A. Foglietta
@ 2022-09-30 10:50       ` Bezdeka, Florian
  2022-09-30 11:09         ` Roberto A. Foglietta
  0 siblings, 1 reply; 9+ messages in thread
From: Bezdeka, Florian @ 2022-09-30 10:50 UTC (permalink / raw)
  To: roberto.foglietta, Schmidl, Tobias; +Cc: isar-users, jan.kiszka

On Fri, 2022-09-30 at 12:39 +0200, Roberto A. Foglietta wrote:
> Il Ven 30 Set 2022, 12:23 Schmidl, Tobias <tobiasschmidl@siemens.com>
> ha scritto:
> > Hi Jan, Roberto,
> > 
> > Am Freitag, dem 30.09.2022 um 10:56 +0200 schrieb Jan Kiszka:
> > > On 30.09.22 10:00, Roberto A. Foglietta wrote:
> > > 
> > > 
> > >  
> > > https://groups.google.com/d/msgid/isar-users/20220630135531.717696
> > > -2-tobiasschmidl%40siemens.com> is the way forward, but it needs
> > > some more fine-tuning. Tobias, what is
> > > the status there?
> > > 
> > 
> > As I understand it the mentioned patch is dead, since the systemd
> > version
> > in stretch is too old for systemd-resizefs - or did I miss
> > anything?

Could we do that with some kind of version check? If systemd is to old
simply fall back to the previous implementation. So we support stretch
"as is" and care better about "modern" systems.

> 
> Hi Tobias and Jan,
> 
>  as you can see my approach is straight simple: if extending the ext4
> fails because it does not match the filesystem type then try with
> btrfs tool. Obviously, the btrfs tool is added as dependencies among
> others before defined.

First: resize2fs does not only support ext4. It supports all of the ext
variants (ext2-ext4) to my understanding.

Second: There might be more reasons why resize2fs could fail. IMHO, it
doesn't make sense to run a btrfs tool on a ext filesystem that failed
to expand.

Third: The mount point (/tmp/btrfs) is never cleaned up in the Robertos
patch.

> 
>  pro: it supports btrfs, easy to catch
> 
>  contro: not a general approach
> 
>  I tend to be very pragmatic: the current supports ext4 resize only +
> a simple patch it supports btrfs also. This is an improvement and add
> a little of complexity. May be tomorrow, it will arrive the support
> for xfs or dm-crypto. Step by step functionalities will be added and
> at a certain point someone will feel the nessecity to rationalise the
> code but not necessarily generalising (architecture change). 
> 
>  This kind of development is about natural evolution rather than
> intelligent design. Ok, sometimes it is necessary to reorganise,
> rewrite, generalise, the product of the natural evolution but usually
> fits enough. My 2 cents, IMHO.
> 
>  Cheers, R.
> 


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

* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
  2022-09-30 10:23   ` Schmidl, Tobias
  2022-09-30 10:39     ` Roberto A. Foglietta
@ 2022-09-30 10:51     ` Henning Schild
  1 sibling, 0 replies; 9+ messages in thread
From: Henning Schild @ 2022-09-30 10:51 UTC (permalink / raw)
  To: Schmidl, Tobias; +Cc: roberto.foglietta, isar-users, jan.kiszka

Am Fri, 30 Sep 2022 10:23:23 +0000
schrieb "Schmidl, Tobias" <tobiasschmidl@siemens.com>:

> Hi Jan, Roberto,
> 
> Am Freitag, dem 30.09.2022 um 10:56 +0200 schrieb Jan Kiszka:
> > On 30.09.22 10:00, Roberto A. Foglietta wrote:
> > 
> > 
> > https://groups.google.com/d/msgid/isar-users/20220630135531.717696-2-tobiasschmidl%40siemens.com>
> >is the way forward, but it needs some more fine-tuning. Tobias, what
> >is
> > the status there?
> >   
> 
> As I understand it the mentioned patch is dead, since the systemd
> version in stretch is too old for systemd-resizefs - or did I miss
> anything?

That patch is dead, we just need a new version that somehow deals with
stretch for the time being. That could also be "oh we can not
systemd-resizefs and fall back to resize2fs" and maybe a bbwarn/bberror
when someone wants to combine stretch+btrfs+resize. To warn them before
resize will fail on the first boot.

Maybe using another patch on top that can be easily reverted when we
finally drop stretch.

Henning

> 
> Kind regards,
> 
> Tobias
> 


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

* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
  2022-09-30 10:50       ` Bezdeka, Florian
@ 2022-09-30 11:09         ` Roberto A. Foglietta
  2022-09-30 11:17           ` Roberto A. Foglietta
  0 siblings, 1 reply; 9+ messages in thread
From: Roberto A. Foglietta @ 2022-09-30 11:09 UTC (permalink / raw)
  To: Bezdeka, Florian; +Cc: Schmidl, Tobias, isar-users, Jan Kiszka

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

Il Ven 30 Set 2022, 12:50 Bezdeka, Florian <florian.bezdeka@siemens.com> ha
scritto:

> On Fri, 2022-09-30 at 12:39 +0200, Roberto A. Foglietta wrote:
>
> >
> >  as you can see my approach is straight simple: if extending the ext4
> > fails because it does not match the filesystem type then try with
> > btrfs tool. Obviously, the btrfs tool is added as dependencies among
> > others before defined.
>
> First: resize2fs does not only support ext4. It supports all of the ext
> variants (ext2-ext4) to my understanding.
>

The man resize2fs said so: ext2/3/4.

Due to the implementation of ext4 and ext2 with the backcompatibility of
some features, the resize supported in ext4 is also supported in ext2
because it is a basic feature. Viceversa, a tool that resize ext2 will fail
to resize ext4 much probably because the journal.

Second: There might be more reasons why resize2fs could fail. IMHO, it
> doesn't make sense to run a btrfs tool on a ext filesystem that failed
> to expand.
>

It is not elegant but it does not hurt to run btrfs on ext4 or resize2fs on
btrfs.

Yes, I am a raw penguin! LOL

Third: The mount point (/tmp/btrfs) is never cleaned up in the Robertos
> patch.
>

I do umount but NOT rmdir because if for some reason umount fails
(expecially in combination with a bug that do not let the error code be
returned, I saw in busybox) I am going to remove the filesystem content.
Moreover, polluting the /tmp is usually not an issue.

Thanks for your feedbacks, R.

[-- Attachment #2: Type: text/html, Size: 2497 bytes --]

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

* Re: [PATCH 1/1] expand last partition supports btrfs (inline test)
  2022-09-30 11:09         ` Roberto A. Foglietta
@ 2022-09-30 11:17           ` Roberto A. Foglietta
  0 siblings, 0 replies; 9+ messages in thread
From: Roberto A. Foglietta @ 2022-09-30 11:17 UTC (permalink / raw)
  To: Bezdeka, Florian; +Cc: Schmidl, Tobias, isar-users, Jan Kiszka

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

Il Ven 30 Set 2022, 13:09 Roberto A. Foglietta <roberto.foglietta@gmail.com>
ha scritto:

>
> Third: The mount point (/tmp/btrfs) is never cleaned up in the Robertos
>> patch.
>>
>
> I do umount but NOT rmdir because if for some reason umount fails
> (expecially in combination with a bug that do not let the error code be
> returned, I saw in busybox) I am going to remove the filesystem content.
> Moreover, polluting the /tmp is usually not an issue.
>

Two toughts ecollided in my head:

1. do not run rm -rf on a dir that can contain a umounted filesystem

2. just in case do rmdir that will fail and do not harm the content

  The result was quite curios: I the doubt I do not do anything but
polluting /tmp!

>

[-- Attachment #2: Type: text/html, Size: 1575 bytes --]

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

* Fwd: [PATCH 1/1] expand last partition supports btrfs (inline 2nd version)
  2022-09-30  8:00 [PATCH 1/1] expand last partition supports btrfs (inline test) Roberto A. Foglietta
  2022-09-30  8:56 ` Jan Kiszka
@ 2022-09-30 11:34 ` Roberto A. Foglietta
  1 sibling, 0 replies; 9+ messages in thread
From: Roberto A. Foglietta @ 2022-09-30 11:34 UTC (permalink / raw)
  To: isar-users

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

Change before the first version: rmdir /tmp/btrfs added to avoid polluting
/tmp here hand edited.

>From 67c4ea67ac96276c5ec0e6b15d035543b99b8e04 Mon Sep 17 00:00:00 2001
From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Date: Thu, 29 Sep 2022 15:36:48 +0000
Subject: [PATCH] expand last partition btrfs support added

improvement, expand-on-first-boot: support for btrfs added

Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
 .../expand-on-first-boot/expand-on-first-boot_1.1.bb       | 2 +-
 .../expand-on-first-boot/files/expand-last-partition.sh    | 7 ++++++-
 2 files changed, 7 insertions(+), 2 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..d41dd83 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
@@ -9,7 +9,7 @@ inherit dpkg-raw

 DESCRIPTION = "This service grows the last partition to the full medium
during first boot"

-DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk,
util-linux"
+DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk,
util-linux, btrfs-progs"

 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 759ff8b..5b73dc4 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
@@ -61,4 +61,9 @@ partx -u "${LAST_PART}"
 # when using systemd mount units.
 export EXT2FS_NO_MTAB_OK=1

-resize2fs "${LAST_PART}"
+if ! resize2fs "${LAST_PART}"; then
+ mkdir -p /tmp/btrfs
+ mount "${LAST_PART}" /tmp/btrfs
+ btrfs filesystem resize max /tmp/btrfs
+ umount /tmp/btrfs && rmdir /tmp/btrfs
+fi
-- 
2.30.2

[-- Attachment #2: Type: text/html, Size: 4060 bytes --]

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

end of thread, other threads:[~2022-09-30 11:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30  8:00 [PATCH 1/1] expand last partition supports btrfs (inline test) Roberto A. Foglietta
2022-09-30  8:56 ` Jan Kiszka
2022-09-30 10:23   ` Schmidl, Tobias
2022-09-30 10:39     ` Roberto A. Foglietta
2022-09-30 10:50       ` Bezdeka, Florian
2022-09-30 11:09         ` Roberto A. Foglietta
2022-09-30 11:17           ` Roberto A. Foglietta
2022-09-30 10:51     ` Henning Schild
2022-09-30 11:34 ` Fwd: [PATCH 1/1] expand last partition supports btrfs (inline 2nd version) 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