From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7176574728906211328 X-Received: by 2002:a5d:45d2:0:b0:242:49e3:c510 with SMTP id b18-20020a5d45d2000000b0024249e3c510mr16455093wrs.17.1671142575053; Thu, 15 Dec 2022 14:16:15 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6000:230:b0:242:2700:8318 with SMTP id l16-20020a056000023000b0024227008318ls763025wrz.0.-pod-prod-gmail; Thu, 15 Dec 2022 14:16:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf7GDO/dFQYIm797cy2PbR2S28+tB6raOY1V9udbxCGphpoDcDXTeehEnBjC7U+5W2Jk+KjD X-Received: by 2002:a05:6000:81a:b0:242:69f4:cb75 with SMTP id bt26-20020a056000081a00b0024269f4cb75mr19807673wrb.54.1671142574175; Thu, 15 Dec 2022 14:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671142574; cv=none; d=google.com; s=arc-20160816; b=hIufuy7ysASj3SiC8pB9+93OzQljO4Inl+sCpidSXwAHebl4mXGEBx2S4UFnM2aI7D I+EKVbOHW50tHiToO8raqlVoRAXUyp87+3/9z+gymGfyvs/T6Ov+CjzQYK+LS65/4BnT VWBrk+9PplhM+xbfzZPOW6/HIJWIXMP9FkZkkdcAcMG6ls5eHuD/5f1ZASU97Bc8Q/HM AZOhYUberY8W/VrAp1bmCDnoW0smDuRG/x4oBkYAc8GRZmnORfLhem77w0g1Szfw4O9q RMdaJ6Bf3JGw/hYUJpduDww075v0UEkKnW9FBNsjXAThR4aAXonH6anr+pc4/I9pfm4e RuAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=AFKtBPc6ffjJLrWu1Urkzhv+pH8F9Mq9kw8C7xeW1uo=; b=VWkHQQsuLykFz0XvVK8GvSpESbvP0kLdZExMxqF9eRbuQlTs2yA0o0UazblWluwuBG n7d6huCVt45hxDbGAiSSl2cmIMzWbokSJSN5sK1KdmoFBO8FxiiMzfwiAuE/3ycYnaei cTIUHR21xUVUNcD+yomSOyG7qhaSDP97Tu09zKiEmHUEGLih+IGNrHSnucIKKFuqUTul 8i4TQDc04lYK1RgEwN4rYSvajscglTwCPRl9mtOkEiSf/oTQ5c9L79e5KrE2fAJqGC8p fcPI3ycy/VOTPBCnGkAfNBtAo2qn+EkhIwM9wd/9bPwq7BS3Va0pxAnsvqaqwN2XkV3I dQ9w== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b="L/aY4DOn"; spf=pass (google.com: domain of fm-52304-202212152216134f3d5605de19b49380-3ece98@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-52304-202212152216134f3d5605de19b49380-3eCe98@rts-flowmailer.siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net. [185.136.64.228]) by gmr-mx.google.com with ESMTPS id cy4-20020a056000400400b0025664a2d85bsi27933wrb.1.2022.12.15.14.16.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Dec 2022 14:16:14 -0800 (PST) Received-SPF: pass (google.com: domain of fm-52304-202212152216134f3d5605de19b49380-3ece98@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) client-ip=185.136.64.228; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b="L/aY4DOn"; spf=pass (google.com: domain of fm-52304-202212152216134f3d5605de19b49380-3ece98@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-52304-202212152216134f3d5605de19b49380-3eCe98@rts-flowmailer.siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 202212152216134f3d5605de19b49380 for ; Thu, 15 Dec 2022 23:16:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=henning.schild@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=AFKtBPc6ffjJLrWu1Urkzhv+pH8F9Mq9kw8C7xeW1uo=; b=L/aY4DOnU3xp2aaJCpClXZZT1Va19yInpzQl9Nz+d8TewOyjLXPR9NohI4FrN5/dUDZ9Z0 eQh9A7eLCQPAhMJxKyG99WCI/avwre2G4rWqPnqWhGWaWuZbAaq13IaXQgFA0cS2W9rb9dXv aqJmPlc/hnlZAKD64sC6hoQ7ITALI=; From: henning.schild@siemens.com To: isar-users@googlegroups.com Cc: Henning Schild , Joe MacDonald Subject: [PATCH v6 2/6] expand-on-first-boot: support resizing a btrfs Date: Thu, 15 Dec 2022 23:16:02 +0100 Message-Id: <20221215221606.5623-3-henning.schild@siemens.com> In-Reply-To: <20221215221606.5623-1-henning.schild@siemens.com> References: <20221215221606.5623-1-henning.schild@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-52304:519-21489:flowmailer X-TUID: NUp4XP7H+QUh From: Henning Schild This adds support for resizing btrfs filesystems if they are in that last partition. It also prepares for potentially other filesystems to come in the future by introducing a switch-case. The mounting logic is taken from the systemd-growfs patches we had to revert again. Some filesystems need to online for resizing, but in order to find the filesystem of a partition (without udev) mounting it and letting the kernel detect seems a good idea. Suggested-by: Joe MacDonald Signed-off-by: Henning Schild --- ...oot_1.3.bb => expand-on-first-boot_1.4.bb} | 0 .../files/expand-last-partition.sh | 31 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) rename meta/recipes-support/expand-on-first-boot/{expand-on-first-boot_1.3.bb => expand-on-first-boot_1.4.bb} (100%) diff --git a/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.3.bb b/meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.4.bb similarity index 100% rename from meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.3.bb rename to meta/recipes-support/expand-on-first-boot/expand-on-first-boot_1.4.bb 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 93eddda2a3b7..7d658864924b 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 @@ -62,8 +62,31 @@ if grep -q x-systemd.growfs /etc/fstab; then exit 0 fi -# Do not fail resize2fs if no mtab entry is found, e.g., -# when using systemd mount units. -export EXT2FS_NO_MTAB_OK=1 +# some filesystems need to be mounted i.e. btrfs, but mounting also helps +# detect the filesystem type without having to wait for udev +# mount $LAST_PART out of tree, so we won't conflict with other mounts +MOUNT_POINT=$(mktemp -d -p "" "$(basename "$0").XXXXXXXXXX") +mount "${LAST_PART}" "${MOUNT_POINT}" -resize2fs "${LAST_PART}" +ret=0 +# Determine the filesystem type and perform the appropriate resize function +FS_TYPE=$(findmnt -fno FSTYPE "${MOUNT_POINT}" ) +case ${FS_TYPE} in +ext*) + # 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}" + ;; +btrfs) + btrfs filesystem resize max "${MOUNT_POINT}" + ;; +*) + echo "Unrecognized filesystem type ${FS_TYPE} - no resize performed" + ret=1 + ;; +esac + +umount "${MOUNT_POINT}" +rmdir "${MOUNT_POINT}" +exit $ret -- 2.37.4