From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7175355899708440576 X-Received: by 2002:a1f:3151:0:b0:3bc:e8ec:a362 with SMTP id x78-20020a1f3151000000b003bce8eca362mr26462290vkx.26.1670915822821; Mon, 12 Dec 2022 23:17:02 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a67:d392:0:b0:3b1:14a5:dc82 with SMTP id b18-20020a67d392000000b003b114a5dc82ls4501696vsj.5.-pod-prod-gmail; Mon, 12 Dec 2022 23:17:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5B4Q5Iv/CPplVA+PYIs+NwGbSImHJX3dYJQsKwZo8WiecCcWjn1/qghvWdFsoAwIUE+QHL X-Received: by 2002:a67:eec4:0:b0:3aa:1665:5eae with SMTP id o4-20020a67eec4000000b003aa16655eaemr9522833vsp.14.1670915822057; Mon, 12 Dec 2022 23:17:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670915822; cv=none; d=google.com; s=arc-20160816; b=C1mFkcr4puv3VD5PaLlCjVGkqHrAVnnyuXj8qfTGxQ5AHiRpcdKbOKcMLFueSBRnBL bmvwlWtAPJThaUEQcxLTis2ez2uKqMb8HvDMSlk90i387nl2DcEVUHFpPoTGx4dEU51h w5xrbcM/RdUNEScuP/MlUZMumulPxHh8+vxYUy4ozIDqj3wf2U5r2jSTXh+4SFLsDdP9 9CWNOEtX4P6W9BqmOd9vv6V5pxAoR1ys+KyPKhGq/HsMXOcHjeGX2rff6CF4S0+3f8HC Aqce1IY2kIKvG7gZ2j+VIMX1FmtTUNFDyY0vIHxYRVDn/AYR0QDASOjwFg6PvNPHkEWu 5n3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe:cc:to :reply-to:message-id:subject:date:from; bh=n3NU4o5HmyZ3YxsC5UwzrsVHC0OO37u8RufGMBRE87Q=; b=g+BbITFISTH5pvKSRRgQRuNgPioRgnURN/f0Y+A6A4UlZDjm+jO59cqlCwQuGi0q7x Rm4MqshrYakjXD74QafpDbKXZ90ZFnDfKK9hw4PnGW0u3hClhsjAc02eh0Xf7xSJNzO4 48z9GXv8Eh7rp2H1ty3q6s9U1p4vdEbZxJp9SA0kafGMhGLTrwuiUhpw9o2ADIVHiACF hUL3yYZcHcgPfrvwOx3ic4z5MyjiBX+An6I+Aj9bLXtYFVzxtfDgSqWCyeN4SKnaA+Ln ahUZv7nyY0quWDZtK6bg7tkjbSoFNSYT6c+DYFtjJwwWJ6FoQaBRwuKGQB8Tx6hE6X2Q yg9g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of bounces+mlvmnk2i9krfha0tj2x-dq2@bounces.elasticemail.net designates 216.169.99.117 as permitted sender) smtp.mailfrom=bounces+mlVMNk2I9KRFHa0TJ2x-dQ2@bounces.elasticemail.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pn117.mxout.mta2.net (pn117.mxout.mta2.net. [216.169.99.117]) by gmr-mx.google.com with ESMTPS id t8-20020a67ad08000000b003b06d9dca0bsi769951vsl.1.2022.12.12.23.17.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2022 23:17:01 -0800 (PST) Received-SPF: pass (google.com: domain of bounces+mlvmnk2i9krfha0tj2x-dq2@bounces.elasticemail.net designates 216.169.99.117 as permitted sender) client-ip=216.169.99.117; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of bounces+mlvmnk2i9krfha0tj2x-dq2@bounces.elasticemail.net designates 216.169.99.117 as permitted sender) smtp.mailfrom=bounces+mlVMNk2I9KRFHa0TJ2x-dQ2@bounces.elasticemail.net; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com From: roberto.foglietta@gmail.com Date: Tue, 13 Dec 2022 07:17:00 +0000 Subject: [PATCH v3] In expand last partition script btrfs support added Message-Id: <4uin7kd4pqus.mlVMNk2I9KRFHa0TJ2x-dQ2@16F0H.trk.elasticemail.com> Reply-To: roberto.foglietta@gmail.com To: isar-users@googlegroups.com Cc: roberto.foglietta@gmail.com List-Unsubscribe: =?us-ascii?q?=3Cmailto=3Aunsubscribe+mlVMNk2I9KRFHa0TJ2x-dQ2=40bounces=2Eelasticem?= =?us-ascii?q?ail=2Enet=3Fsubject=3Dunsubscribe=3E=2C?= =?us-ascii?q?_=3Chttp=3A=2F=2F16F0H=2Etrk=2Eelasticemail=2Ecom=2Ftracking=2Funsubscribe=3Fmsgid?= =?us-ascii?q?=3DmlVMNk2I9KRFHa0TJ2x-dQ2&c=3D1588198146759178339=3E?= X-Msg-EID: mlVMNk2I9KRFHa0TJ2x-dQ2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-TUID: xSeAxvGEJVDN From: "Roberto A. Foglietta" Improvement, expand-on-first-boot: support for btrfs added v2: the mount point for btrfs filesystem to resizes is under /dev/shm by default but a variable defined in the running enviroment can change the temporary directory path. The /dev/shm has been choosen because in some system /tmp can be on a RO root filesystem and /tmp not yet mounted with tmpfs. This requires the system has /dev/shm configured into the kernel. v3: the previous version was using a bashism but the shebang is /bin/sh this means that the script will fail in customised system in which /bin/sh do not link to bash or bash in even not available. Signed-off-by: Roberto A. Foglietta --- .../expand-on-first-boot_1.2.bb | 2 +- .../files/expand-last-partition.sh | 38 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb index 0996000..fe7b72b 100644 --- a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb +++ b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.2.bb @@ -10,7 +10,7 @@ inherit dpkg-raw DESCRIPTION = "This service grows the last partition to the full medium during first boot" MAINTAINER = "isar-users " -DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), util-linux" +DEBIAN_DEPENDS = "systemd, sed, grep, coreutils, mount, e2fsprogs, fdisk (>=2.29.2-3) | util-linux (<2.29.2-3), 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 4d55645..038124e 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 @@ -59,29 +59,19 @@ sfdisk -d "${BOOT_DEV}" 2>/dev/null | \ # Inform the kernel about the partitioning change partx -u "${LAST_PART}" -# this is for debian stretch or systemd < 236 -if [ ! -x /lib/systemd/systemd-growfs ]; then - # Do not fail resize2fs if no mtab entry is found, e.g., - # when using systemd mount units. - export EXT2FS_NO_MTAB_OK=1 +# 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}" - exit 0 -fi - -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 +if [ -n "$BOOT_DEV_TMPDIR" ]; then + tmp=$BOOT_DEV_TMPDIR 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 - exit 1 -fi - -mount "${LAST_PART}" "${MOUNT_POINT}" -/lib/systemd/systemd-growfs "${MOUNT_POINT}" -umount "${MOUNT_POINT}" -rmdir "${MOUNT_POINT}" +case $(lsblk -fno FSTYPE "${LAST_PART}") in + ext4) resize2fs "${LAST_PART}" + ;; + btrfs) mkdir -p $tmp/btrfs + mount "${LAST_PART}" $tmp/btrfs + btrfs filesystem resize max $tmp/btrfs + umount $tmp/btrfs && rmdir $tmp/btrfs + ;; +esac -- 2.34.1 https://16F0H.trk.elasticemail.com/tracking/unsubscribe?d=unZHvcPZ03nwvR7FeZPfZjAJ9sdzS7mbgsfYadSUExg-vUTSxmdtkBjHq8md3O-B_itXi6uT6_fRNl2jAEemwDdvhBVp0Z8opmxBveITbTFb0