Message ID | CAJGKYO4WG90BaENOJOetNmE2-cO-3PVadkBwqesq+SsnmVYJ5w@mail.gmail.com |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | In expand last partition checking the size is useless | expand |
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-
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.
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-
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-
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