* [PATCH] In expand last partition checking the size is useless
@ 2022-12-14 11:49 Roberto A. Foglietta
2022-12-14 12:01 ` Roberto A. Foglietta
0 siblings, 1 reply; 5+ messages in thread
From: Roberto A. Foglietta @ 2022-12-14 11:49 UTC (permalink / raw)
To: isar-users
[-- Attachment #1: Type: text/plain, Size: 308 bytes --]
code maintenance, superfluous operations commented, kept for the future
Tests shown that resize in full a ext4 or btrfs partition/filesystem does not
hurt and does not report a failure, so nothing changes without the size check
Patch sent by elastic mail SMTP went into moderation, attached here
Best, R-
[-- Attachment #2: 0001-In-expand-last-partition-checking-the-size-is-useles.patch --]
[-- Type: text/x-patch, Size: 2473 bytes --]
From c0d56a45db8a38f7121a13eff4e68c10a6cf0db7 Mon Sep 17 00:00:00 2001
From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Date: Wed, 14 Dec 2022 12:37:26 +0100
Subject: [PATCH] In expand last partition checking the size is useless
code maintenance, superflous operations commented, kept for the future
Tests shown that resize in full a ext4 or btrfs partition/filesystem does not
hurt and does not report a failure, so nothing changes without the size check
Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
.../files/expand-last-partition.sh | 34 +++++++++++--------
1 file changed, 19 insertions(+), 15 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 2c52b16..4d36733 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
@@ -27,22 +27,26 @@ if [ "${ROOT_DEV}" = "${BOOT_DEV}" ]; then
exit 0
fi
-# this value is in blocks. Normally a block has 512 bytes.
-BUFFER_SIZE=32768
-BOOT_DEV_NAME=${BOOT_DEV##*/}
-DISK_SIZE="$(cat /sys/class/block/"${BOOT_DEV_NAME}"/size)"
-ALL_PARTS_SIZE=0
-for PARTITION in /sys/class/block/"${BOOT_DEV_NAME}"/"${BOOT_DEV_NAME}"*; do
- PART_SIZE=$(cat "${PARTITION}"/size)
- ALL_PARTS_SIZE=$((ALL_PARTS_SIZE + PART_SIZE))
-done
+# full resizing of ext4 and btrfs does not fail nor hurt but supporting more
+# filesystems in future might change this condition, so commenting this code
+useless_for_now() {
+ # this value is in blocks. Normally a block has 512 bytes.
+ BUFFER_SIZE=32768
+ BOOT_DEV_NAME=${BOOT_DEV##*/}
+ DISK_SIZE="$(cat /sys/class/block/"${BOOT_DEV_NAME}"/size)"
+ ALL_PARTS_SIZE=0
+ for PARTITION in /sys/class/block/"${BOOT_DEV_NAME}"/"${BOOT_DEV_NAME}"*; do
+ PART_SIZE=$(cat "${PARTITION}"/size)
+ ALL_PARTS_SIZE=$((ALL_PARTS_SIZE + PART_SIZE))
+ done
-MINIMAL_SIZE=$((ALL_PARTS_SIZE + BUFFER_SIZE))
-if [ "$DISK_SIZE" -lt "$MINIMAL_SIZE" ]; then
- echo "Disk is practically already full, doing nothing." >&2
- trap - EXIT
- exit 0
-fi
+ MINIMAL_SIZE=$((ALL_PARTS_SIZE + BUFFER_SIZE))
+ if [ "$DISK_SIZE" -lt "$MINIMAL_SIZE" ]; then
+ echo "Disk is practically already full, doing nothing." >&2
+ trap - EXIT
+ exit 0
+ fi
+}
LAST_PART="$(sfdisk -d "${BOOT_DEV}" 2>/dev/null | tail -1 | cut -d ' ' -f 1)"
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] In expand last partition checking the size is useless
2022-12-14 11:49 [PATCH] In expand last partition checking the size is useless Roberto A. Foglietta
@ 2022-12-14 12:01 ` Roberto A. Foglietta
2022-12-14 12:08 ` Anton Mikanovich
0 siblings, 1 reply; 5+ messages in thread
From: Roberto A. Foglietta @ 2022-12-14 12:01 UTC (permalink / raw)
To: isar-users
On Wed, 14 Dec 2022 at 12:49, Roberto A. Foglietta
<roberto.foglietta@gmail.com> wrote:
>
> code maintenance, superfluous operations commented, kept for the future
>
> Tests shown that resize in full a ext4 or btrfs partition/filesystem does not
> hurt and does not report a failure, so nothing changes without the size check
This patch applies on the top of the others sent about the same subject
- In expand last partition checking the size is useless
- If expand last partition fails, unsupervised systems reboot
- In expand last partition script btrfs support added
- In expand last partition wait for udev have finished
> Best, R-
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] In expand last partition checking the size is useless
2022-12-14 12:01 ` Roberto A. Foglietta
@ 2022-12-14 12:08 ` Anton Mikanovich
2022-12-14 12:46 ` Roberto A. Foglietta
0 siblings, 1 reply; 5+ messages in thread
From: Anton Mikanovich @ 2022-12-14 12:08 UTC (permalink / raw)
To: Roberto A. Foglietta, isar-users
14.12.2022 15:01, Roberto A. Foglietta wrote:
> On Wed, 14 Dec 2022 at 12:49, Roberto A. Foglietta
> <roberto.foglietta@gmail.com> wrote:
>> code maintenance, superfluous operations commented, kept for the future
>>
>> Tests shown that resize in full a ext4 or btrfs partition/filesystem does not
>> hurt and does not report a failure, so nothing changes without the size check
> This patch applies on the top of the others sent about the same subject
>
> - In expand last partition checking the size is useless
> - If expand last partition fails, unsupervised systems reboot
> - In expand last partition script btrfs support added
> - In expand last partition wait for udev have finished
>
>> Best, R-
Hello Roberto,
Can you please summarize all the commits in expand service in one patchset?
It is really hard to sort out all those changes, especially if send in
attachments.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] In expand last partition checking the size is useless
2022-12-14 12:08 ` Anton Mikanovich
@ 2022-12-14 12:46 ` Roberto A. Foglietta
2022-12-14 13:52 ` Roberto A. Foglietta
0 siblings, 1 reply; 5+ messages in thread
From: Roberto A. Foglietta @ 2022-12-14 12:46 UTC (permalink / raw)
To: Anton Mikanovich; +Cc: isar-users
On Wed, 14 Dec 2022 at 13:08, Anton Mikanovich <amikan@ilbers.de> wrote:
>
> Hello Roberto,
>
> Can you please summarize all the commits in expand service in one patchset?
> It is really hard to sort out all those changes, especially if send in
> attachments.
>
Hi Anton,
here you are, download these files and overwrite with them the last
next commit and you will have the diff
https://raw.githubusercontent.com/robang74/isar/next/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
https://raw.githubusercontent.com/robang74/isar/next/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
https://raw.githubusercontent.com/robang74/isar/next/meta/recipes-support/expand-on-first-boot/files/expand-on-first-boot.service
or check them directly with these link
https://github.com/ilbers/isar/compare/next...robang74:isar:next
Best regards, R-
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] In expand last partition checking the size is useless
2022-12-14 12:46 ` Roberto A. Foglietta
@ 2022-12-14 13:52 ` Roberto A. Foglietta
0 siblings, 0 replies; 5+ messages in thread
From: Roberto A. Foglietta @ 2022-12-14 13:52 UTC (permalink / raw)
To: Anton Mikanovich; +Cc: isar-users
On Wed, 14 Dec 2022 at 13:46, Roberto A. Foglietta
<roberto.foglietta@gmail.com> wrote:
>
> On Wed, 14 Dec 2022 at 13:08, Anton Mikanovich <amikan@ilbers.de> wrote:
>
> >
> > Hello Roberto,
> >
> > Can you please summarize all the commits in expand service in one patchset?
> > It is really hard to sort out all those changes, especially if send in
> > attachments.
> >
>
> Hi Anton,
>
> here you are, download these files and overwrite with them the last
> next commit and you will have the diff
>
> https://raw.githubusercontent.com/robang74/isar/next/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
>
> https://raw.githubusercontent.com/robang74/isar/next/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb
>
> https://raw.githubusercontent.com/robang74/isar/next/meta/recipes-support/expand-on-first-boot/files/expand-on-first-boot.service
>
> or check them directly with these link
>
> https://github.com/ilbers/isar/compare/next...robang74:isar:next
>
Hi Anton,
you can try the whole patchset against this project based on ISAR, if you like
https://github.com/robang74/isar-nvidia-debian
I suggest these commands
source .profile
build basic-os
wicinst vmdk:image.vmdk 4
in order to test the result with VirtualBox or any other virtual
machine that supports vmdk format.
Best regards, R-
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-14 13:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 11:49 [PATCH] In expand last partition checking the size is useless Roberto A. Foglietta
2022-12-14 12:01 ` Roberto A. Foglietta
2022-12-14 12:08 ` Anton Mikanovich
2022-12-14 12:46 ` Roberto A. Foglietta
2022-12-14 13:52 ` 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