From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7163605801230139392 X-Received: by 2002:a2e:be09:0:b0:277:4c69:b74e with SMTP id z9-20020a2ebe09000000b002774c69b74emr6509573ljq.127.1667906960549; Tue, 08 Nov 2022 03:29:20 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:ac2:58f3:0:b0:49a:b814:856d with SMTP id v19-20020ac258f3000000b0049ab814856dls1977285lfo.1.-pod-prod-gmail; Tue, 08 Nov 2022 03:29:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf58lX5b62AF1khXX5g/NbtAl6Yo2Uk/IeLc0+i7o9LrtfP4xkO79A+vbDZeO28bNLG+st7x X-Received: by 2002:a05:6512:932:b0:4b3:a51d:66 with SMTP id f18-20020a056512093200b004b3a51d0066mr4084007lft.635.1667906959369; Tue, 08 Nov 2022 03:29:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1667906959; cv=pass; d=google.com; s=arc-20160816; b=qW/6KKEN05WEqUM+4xYIy1pG/uX8nchKAOP5VEbjygCKsYeP/Gvfn+0IWb7Bfb8h0b SxhWQwaRnXDWxrR4UhACrnx+1WB8RljCx7rZZIcshRUBnHxBcMq23gvMYKIO2Zz4vk3u yhCpQQpQJyW4TwVLC3o+fN6ZG4bE9Ir1bsNkIHTdSz9axazljiIA7fFo/PjKkhPL+qz9 07g/3Jfy6hku+z7pnLzoYlUU58972RiXBs8zgV9m1yT9Xd+kouoSiHozi5twYB+WoceU HNgO4NPrwhXD+l6FRYoTokc0o25KmFB0XHBqBx1EDc/YCDKQKGNVkM+EecsmtEHSlS2i b5ZA== 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=fFpZHS8ZnzzpErtslr7PzsqC2x8AshHGLCJccxU/qeQ=; b=XGWMj8qlHRqfVYpDoGsLByPjh/4XTF+1QdST/Cx5DA6OIBYPAOrFBDRmioIlyGFKIZ qOlfIyDaopflaUMBy5P0Oj1vogM/oefc2fsZ8YzsWw3jxzNAABm10jOKCrcvif6CB7MR e2Rz8mRxBuS18odGaY1O9ApnpDNN8hWE03KpHWcPEh+71Vgb4B/e92UQavqnO1pWt5lO +0qSXnIOk1hdY4XoA9eGbUTLc/G4pQdTUYEQRYU2jAXdlwlvTWuTMotBmQQGfej6t2PQ cs1PCFyHNsGJ1D9y30df9f9px6tFutDMbB4wBl2uDoRKmVjuXHkaE79OePP90g3v1igp e7Mg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=Ecqjgt2k; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of tobias.schaffner@siemens.com designates 40.107.8.43 as permitted sender) smtp.mailfrom=tobias.schaffner@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80043.outbound.protection.outlook.com. [40.107.8.43]) by gmr-mx.google.com with ESMTPS id q20-20020a2eb4b4000000b002772ff50da3si299026ljm.7.2022.11.08.03.29.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Nov 2022 03:29:18 -0800 (PST) Received-SPF: pass (google.com: domain of tobias.schaffner@siemens.com designates 40.107.8.43 as permitted sender) client-ip=40.107.8.43; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=Ecqjgt2k; arc=pass (i=1 spf=pass spfdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of tobias.schaffner@siemens.com designates 40.107.8.43 as permitted sender) smtp.mailfrom=tobias.schaffner@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=nbONtkpSpSS9GN8kzCU0hGH+hVNvFiGr2XHsUo/BVVauqRzuiPOi4n5m31X/OBGSSJH/6SU0MSbDaRaJ2yX7TRGi33TWdKt0GMrmtNUG+mxuUnxgpkf8KSRGhXjS3+lc0etozwgBH/Vco45qj3x6w/hUBVGteu/4KaXpNIgAQ/oo+uDBQ3MACaa3oNQ45YwVMzhJhCDdYJOBU05sNLUdSzVvL9jn0cATnQTseiRUQLmWSKyiSQuqiYk4SWgqYHxxjljpMneV0q6DDlMZc02J27GLKWzosNfj3OjrJaIMLd1pIazAztlbrJiOzmMnKbye4qqOufDkOmVgaDz6y5sKtg== 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=fFpZHS8ZnzzpErtslr7PzsqC2x8AshHGLCJccxU/qeQ=; b=OQdJ1q5nN7sfIJhaKxFmiH/s6xffI/an/9ub9GS0/dAYCAvNopKJuKkQ2Fi/aCc0jgqO5vU4n5S1pucj7k9y9tGr6gVSa+Wr7bxCFGa2RvzzfTUem+HCXCFjR5HzMVwylrsbR4LdSB29AsSaFHsAbqt7YWzb9vu397eHRC/k1PswHEMbOkf/4EceOowVBtVuJuuSGO4OyDwPb6c2WSMZV3Y9gaeJ41LuaJpBroSLkUa9FjHtdl2p7DqcMpSNTv/dja10CPHed3r06SlrxpPrwO9ARKFsJEqFxR7y29p78EbooaYB0mmpn+BbFo6r0jrabp+VVzSXpPCQ89Bn8nSVcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 194.138.21.75) 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=fFpZHS8ZnzzpErtslr7PzsqC2x8AshHGLCJccxU/qeQ=; b=Ecqjgt2kn9ZPvFAwVLSLjbJ5Pfp6GRl6JDLJHnxUWHjCEH+4mjMvHcLuX1zvjcOb8fYk7BDnSlh9DZRSKdWjEhEuS8khiAKY76P6LPt0InNj9kN4ZZvxHVZvx3OVLN73dUY/2EwaYnaBy2kUSAqMYkKuLPeCQv2nW84TJUfQqaPdml9WsBWOP6xbYMNiAH2V1ZLWa7pUw92wqC0bBBiuZ0QALSLQ9w5KA3ESWXtjNCiP7LJYJJxfkO+lTPUUnsMf0Y4eHFzhqDE34qc6Ynqr8uvQ7mYFP6HwQ227eFguoB5Utx1dwMQ5YkjkgL1zviovGUyO1gQBsBJmZX36Y8O1lA== Received: from ZR0P278CA0110.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:20::7) by AS2PR10MB6733.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:55d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Tue, 8 Nov 2022 11:29:17 +0000 Received: from VE1EUR01FT073.eop-EUR01.prod.protection.outlook.com (2603:10a6:910:20:cafe::96) by ZR0P278CA0110.outlook.office365.com (2603:10a6:910:20::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27 via Frontend Transport; Tue, 8 Nov 2022 11:29:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 194.138.21.75) 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.75 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.75; helo=hybrid.siemens.com; pr=C Received: from hybrid.siemens.com (194.138.21.75) by VE1EUR01FT073.mail.protection.outlook.com (10.152.3.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20 via Frontend Transport; Tue, 8 Nov 2022 11:29:16 +0000 Received: from DEMCHDC8WAA.ad011.siemens.net (139.25.226.104) by DEMCHDC8VRA.ad011.siemens.net (194.138.21.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.15; Tue, 8 Nov 2022 12:29:11 +0100 Received: from L15-Gen2.ad001.siemens.net (139.25.69.126) 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.15; Tue, 8 Nov 2022 12:29:09 +0100 From: "T. Schaffner" To: CC: , Tobias Schaffner Subject: [PATCH 2/2] Always try resizing the fs in expand on first boot Date: Tue, 8 Nov 2022 12:28:37 +0100 Message-ID: <20221108112837.435213-3-tobias.schaffner@siemens.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221108112837.435213-1-tobias.schaffner@siemens.com> References: <20221108112837.435213-1-tobias.schaffner@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Return-Path: tobias.schaffner@siemens.com X-Originating-IP: [139.25.69.126] 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: VE1EUR01FT073:EE_|AS2PR10MB6733:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c450ce4-a15a-4156-bf15-08dac17c7855 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JiatQUZWxG4zuZ5skkYxFadY8JYXJpL2bTn2hhJb7xESt1ZcR4QGVcq1oLDYZzXCfXzW9k4qIdPyqkjgFIS9ka6oI58Pv0u7iGhVRCP0W1Za1ttyb808gyRijhNOthAEI9rUkgzbBo3+QF7P15xd2RuCBZSxthkdT9LRx0aaHAklJAkjVdBRsoVjS0HWLjshGambZbUyezHUsIvKY94Ta0KThnkOI3uiU0lh8UIYRaSq3FUy7m3kNkmXwhHPZGNdn0XK7HjbCOnQbR9BjF81EmIxntcKVhS8we4y/CllUiEsjnuEjnIMW3HQr143z/hw//lp132cFfH7AmokY7DlItdxiu3FSMA4/+VTwd4Awa/fkw4voO7jN2LBdfEUU6f5ch35rD7zBdpiraGOWsI2YpOnQc00Y36qDRqwT+rO8fFMgqSCdfpjsgUcrgBzJp9iY6pBk9QUSWFwoBUvPzMUhjiEaZy0COt5veEQlnHhYyQa7hQs1xioSTFAzLGPBsI4kvIBxbKwCij+MqDx6Oz6TovUC3so638b1vJMuN6hmf/CVw/Z+PM+lHVoE20qOqDjJ22I9jHvdPHfAjf4fqpt07PuE8dz3PLbCcFW6DcVU3qLuzD04g7KCBoNI7Pyc4mu3Aqy6w5NR3WEZmAHdKBkyzvfizD0pDCom3uQBxUZoHar9UJsncAOMCJGXQMHdCEtAgj9z2rpYBY8bcSb3xjtUqQhEai93vLhXCGtTT024vDy9TNMutb/h+QWKrX6LD1fasdHLvRNDZnqAFyou2pboX5kcclx/CtQZa8kjbkvFEU= X-Forefront-Antispam-Report: CIP:194.138.21.75;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:hybrid.siemens.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(346002)(396003)(136003)(376002)(451199015)(46966006)(40470700004)(36840700001)(36860700001)(36756003)(86362001)(82740400003)(81166007)(356005)(5660300002)(82960400001)(40460700003)(8936002)(6916009)(4326008)(316002)(54906003)(70206006)(8676002)(70586007)(2616005)(82310400005)(336012)(47076005)(186003)(16526019)(956004)(1076003)(2906002)(41300700001)(83380400001)(40480700001)(478600001)(26005)(107886003)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2022 11:29:16.4712 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c450ce4-a15a-4156-bf15-08dac17c7855 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.75];Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR01FT073.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR10MB6733 X-TUID: nWFIw0AsKeGy From: Tobias Schaffner If the filesystem resize fails or gets interrupted we have no way to recover from this as the script always exits if the partition was already resized. Check if we have to resize the partition but alway run the chosen fs resize tool. Leave the decision if the filesystem has to be resized to resize2fs / systemd-growfs. If the filesystem was already expanded the resize2fs / systemd-growfs call is a noop. Signed-off-by: Tobias Schaffner --- .../files/expand-last-partition.sh | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 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 0d662cc..b21b958 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 @@ -35,26 +35,23 @@ LAST_PART_START="$(cat /sys/class/block/"${LAST_PART_NAME}"/start)" GPT_BACKUP_SIZE=33 if [ $((LAST_PART_START + LAST_PART_SIZE + GPT_BACKUP_SIZE)) -lt "${DISK_SIZE}" ]; then - echo "Disk is practically already full, doing nothing." >&2 - exit 0 -fi + # Transform the partition table as follows: + # + # - Remove any 'last-lba' header so sfdisk uses the entire available space. + # - If this partition table is MBR and an extended partition container (EBR) + # exists, we assume this needs to be expanded as well; remove its size + # field so sfdisk expands it. + # - For the previously fetched last partition, also remove the size field so + # sfdisk expands it. + sfdisk -d "${BOOT_DEV}" 2>/dev/null | \ + grep -v last-lba | \ + sed 's|^\(.*, \)size=[^,]*, \(type=[f5]\)$|\1\2|' | \ + sed 's|^\('"${LAST_PART}"' .*, \)size=[^,]*, |\1|' | \ + sfdisk --force "${BOOT_DEV}" -# Transform the partition table as follows: -# -# - Remove any 'last-lba' header so sfdisk uses the entire available space. -# - If this partition table is MBR and an extended partition container (EBR) -# exists, we assume this needs to be expanded as well; remove its size -# field so sfdisk expands it. -# - For the previously fetched last partition, also remove the size field so -# sfdisk expands it. -sfdisk -d "${BOOT_DEV}" 2>/dev/null | \ - grep -v last-lba | \ - sed 's|^\(.*, \)size=[^,]*, \(type=[f5]\)$|\1\2|' | \ - sed 's|^\('"${LAST_PART}"' .*, \)size=[^,]*, |\1|' | \ - sfdisk --force "${BOOT_DEV}" - -# Inform the kernel about the partitioning change -partx -u "${LAST_PART}" + # Inform the kernel about the partitioning change + partx -u "${LAST_PART}" +fi # this is for debian stretch or systemd < 236 if [ ! -x /lib/systemd/systemd-growfs ]; then -- 2.34.1