From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7176574728906211328 X-Received: by 2002:a17:906:2297:b0:7c0:eafd:9ad5 with SMTP id p23-20020a170906229700b007c0eafd9ad5mr752197eja.532.1671785746108; Fri, 23 Dec 2022 00:55:46 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6402:2708:b0:46d:d0c2:969c with SMTP id y8-20020a056402270800b0046dd0c2969cls2694247edd.1.-pod-prod-gmail; Fri, 23 Dec 2022 00:55:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXvM1mIleY9TW8pxuJfexuuSWY7b9SzqbfFvKR1hXjdnajnfFlYwZSOhr8JOQEK3U56rYj6h X-Received: by 2002:aa7:dd13:0:b0:45c:937d:25c8 with SMTP id i19-20020aa7dd13000000b0045c937d25c8mr7541983edv.1.1671785745137; Fri, 23 Dec 2022 00:55:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671785745; cv=pass; d=google.com; s=arc-20160816; b=L0XQ4TnI3NgGF8ySDCEQ6cHPD6m0UrHwyibyUu4XhXswFjHH37FpvyLKKwZ6owl8hO RnN6uH/RjnszIJgegWqgLkMPHz4xYDkK+NsnK6XyV6U/HPNEAmpQ/Bffr3ngpwAZfxbz +Dq4zvtI7Ehtln6ipXhVizZVKe9FaUntHQqekMIdGjg/T2pF3qIrayiQfMBWvUCorYXF oNKchzl+jzHR4ChFLCsxRHln3yc3qW3g6LzjtzE2xxOIz6WYKiUNF6KJLp2x5oZwYaRs mMOoV808QI1xaQwxB9q7GPSbBoKo60sWsA3yCEwuwtt6oTokvWbAhFhtI7C10oeeHTCw dXjQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=/G+ZvzMuohpEkO1uyv5aPw9NsDQlHaSs8BCaJBI7R24=; b=Rr9E8L7HgeWmzq5Cs4x5rko1ZfuXyjnFH7KVRwWl9+j7L4lBmyo69UsKpfIz+Snfa0 IvknEIVmZBJJGnOlTVlbgBZLeeWD84OXvwBQL3Bxsu7Ibxl830RmccAc0itm+fCj/xT7 Phrwe61qtubkCURn+in1dmB104DesPswBQhn2SwbQv/kqRrZTTIiSXjtAltUkf7L//SQ Ikos7PgHpm5UQtW9CBQI8/z0AlzYphUz8gaskpcQjtmXsPpIAO1JY1kPPJ+Ev14aWxlw tw66jCaC29XwbcAJm08i9MbxAp3WLIi0S/uAj6pcUaS+EMCGXdMKYaf2wuzfmUXn+nER PuqA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=ihmokyR7; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of henning.schild@siemens.com designates 40.107.6.74 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2074.outbound.protection.outlook.com. [40.107.6.74]) by gmr-mx.google.com with ESMTPS id l23-20020aa7c3d7000000b0047014e8771fsi150807edr.3.2022.12.23.00.55.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Dec 2022 00:55:45 -0800 (PST) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 40.107.6.74 as permitted sender) client-ip=40.107.6.74; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=ihmokyR7; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of henning.schild@siemens.com designates 40.107.6.74 as permitted sender) smtp.mailfrom=henning.schild@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bHe40w1Iy8y9Ou46jWIOUyayvehT+n1MJBsw8Bi9wMEmEdH1IhBOwRQKEGdvk/7RZuxkFM/ZBrWSjA2AlGrQu/L/Q2CheCw2X3CNm0XBHCUJmRLw7tkFHtTCMC8kLYSAuNQfzFMQJzuLExEbUC+UXegU8c+ODfTrRJv6ONVEAGqpZQYHTyniIwSsBWPF9Epjdzfe2vFid6U71jY3364bLAoyoRphi3/FTBOF4+iOhz9vyTlrUDvNuYHRIqgCxtYzAoUCDiVnLAWF7EBLjIMBa5kvCXWt9pg3PRU9B8lVbRnzVzeiERmo4CVnfDQsvmGEgyVBQ1mvx7vf/2ihSRFnlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/G+ZvzMuohpEkO1uyv5aPw9NsDQlHaSs8BCaJBI7R24=; b=ZUMVSJJwOtBScx8B1xrpunUs4iONmG2eeQdemCSRS4lalIzPnPfGcl248O0SrFnCy9OVwuRSrW/70oZ0NfDareCXTS9tIsZK+bmanYbbdv0P+OZ8yGUCjiee735zeYbnl/mf1l+TdDSo/fMiwN2wGdynfzxWBvUuB1AC5aoELiq6rMRlS5nl6YNuTLFzmYc0jjjCi468FDkyvQ2aCOXkevUYHkuo1C225FxxCWRR3eX5g6sjNO+HrgouN/FxiEux7KmK9Gp/ufRhR3tgXfmU0ufY4rfnqdsP/MKMGx2oeWKmh8LyXn6Ltr0STmUuMIsF9Key5rk+h4MQRoi9QzjpXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.74) smtp.rcpttodomain=googlegroups.com smtp.mailfrom=siemens.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/G+ZvzMuohpEkO1uyv5aPw9NsDQlHaSs8BCaJBI7R24=; b=ihmokyR7Br0gaA1mLY0yTe7ukQ4b1Awzk18C+NSWszE3vK9bEAV+jsJud3EBQSBXFinfZxSUMqBxQvh086uHbruxxTLqkJEcy1l9k8j6ZDg1efD5Z5dn/A8RXKryRHov6zdY27afLcumOFJgRXABENt/3snPdcNr3UJ5D/AftQRXvtIj5PwwnOlOphar4keqdLDimhipmQjjsNynYXGD6c+1n4LeDA9WOJJWt7KgolUE4pg6VYNVtUaMavapMX7mibGACZXE7g1s5ekj/SgMcvgb4gOWR0RJY8bIgYhraahZXZjh94KVUimw96AU++Bpq1+Zuvu+vz81VojKH722bg== Received: from DB6PR07CA0068.eurprd07.prod.outlook.com (2603:10a6:6:2a::30) by VI1PR10MB7854.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:1c4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Fri, 23 Dec 2022 08:55:43 +0000 Received: from DB5EUR01FT080.eop-EUR01.prod.protection.outlook.com (2603:10a6:6:2a:cafe::20) by DB6PR07CA0068.outlook.office365.com (2603:10a6:6:2a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.12 via Frontend Transport; Fri, 23 Dec 2022 08:55:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.74) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=siemens.com; Received-SPF: Pass (protection.outlook.com: domain of siemens.com designates 194.138.21.74 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.74; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.74) by DB5EUR01FT080.mail.protection.outlook.com (10.152.5.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.13 via Frontend Transport; Fri, 23 Dec 2022 08:55:43 +0000 Received: from DEMCHDC8WAA.ad011.siemens.net (139.25.226.104) by DEMCHDC8VQA.ad011.siemens.net (194.138.21.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.20; Fri, 23 Dec 2022 09:55:42 +0100 Received: from localhost.localdomain (167.87.23.195) by DEMCHDC8WAA.ad011.siemens.net (139.25.226.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.20; Fri, 23 Dec 2022 09:55:42 +0100 From: Henning Schild To: CC: Henning Schild , Joe MacDonald Subject: [PATCH v7 2/6] expand-on-first-boot: support resizing a btrfs Date: Fri, 23 Dec 2022 09:55:25 +0100 Message-ID: <20221223085529.8835-3-henning.schild@siemens.com> X-Mailer: git-send-email 2.38.2 In-Reply-To: <20221223085529.8835-1-henning.schild@siemens.com> References: <20221223085529.8835-1-henning.schild@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Return-Path: henning.schild@siemens.com X-Originating-IP: [167.87.23.195] X-ClientProxiedBy: DEMCHDC8WAA.ad011.siemens.net (139.25.226.104) To DEMCHDC8WAA.ad011.siemens.net (139.25.226.104) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5EUR01FT080:EE_|VI1PR10MB7854:EE_ X-MS-Office365-Filtering-Correlation-Id: e81a1e47-831a-4783-69c8-08dae4c3799a X-LD-Processed: 38ae3bcd-9579-4fd4-adda-b42e1495d55a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fZKgJlYXIJY37lRwf91mfkQmblCRdgnnA1SEJipkfxRRISRwGXmntVMgWUidFCivWMnkEBrWKeZZ+OMjVXANmCgQ9CvUyAV9A03Iec+0KrrsTkyx/1+J2OKvKmqv6NIH3rY6N8DMMbnV0YvEGCA4zO9fy97+gAMH5X8DEsiadz0Z0epIMA47XFh7sb7OYDsLLtsny1yQKN23vwR545q0fr3lK6F5Bx42YhQO0mLI8kILNAkFEAbvqD/jv8BAXKq8LOb3ZNY1kkKXovZUvYjPV4ZHSMOTltlhY33I6cLhYj973+PqOIpnM/ec0DobAZlHiz6UeB9zExZDkR4r63m/QQxZUxCMJOyK5mttsz+hGhbhBQRC+UTusgVHv2XoX3jQO4Q0905pEfRiADCKMKFX1nOOer0Vit+ayC0pZmQ+FZoa2U/dbj5dGksvgGMYTyaxOcj8zrcKJ5G79LhqSH7QOJ+6sDEZExnryXtM/ZYYxyM1SAP0YjH9B45fP2nJjLKfFJzs22477/QgUngjR7gaFeHlV1N9FI9uDeKos/FlWMP83qTNskdUu0+Hvvu0D8VMMElxAwB646Uv8eqAkwnWs4sGmPKKVnxOdLS+AYCm1zueeR0/pCm1Lcek00M4jZkyi9HlLBwBOVDRMMZ6pUBqF3CcZ6FMU0xeuGG7Dsc/9mzUbvQooQxH0MDGrfG/TBJiFETz1aju6JrLjCOL/CLYaz3uiWxWPACrImFd9XgSlNk= X-Forefront-Antispam-Report: CIP:194.138.21.74;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:hybrid.siemens.com;CAT:NONE;SFS:(13230022)(4636009)(136003)(376002)(396003)(39860400002)(346002)(451199015)(40470700004)(46966006)(36840700001)(40480700001)(316002)(6916009)(36756003)(26005)(186003)(40460700003)(7636003)(47076005)(41300700001)(8936002)(82960400001)(356005)(7596003)(86362001)(5660300002)(83380400001)(44832011)(2616005)(1076003)(82740400003)(956004)(336012)(82310400005)(2906002)(36860700001)(16526019)(70206006)(70586007)(8676002)(4326008)(478600001)(54906003)(6666004)(17423001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2022 08:55:43.5511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e81a1e47-831a-4783-69c8-08dae4c3799a X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a;Ip=[194.138.21.74];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT080.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB7854 X-TUID: 1PMHv3wASCmX 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.38.2