From: Quirin Gylstorff <Quirin.Gylstorff@siemens.com>
To: isar-users@googlegroups.com
Subject: [PATCH] expand-on-first-boot: search until no device mapper is used
Date: Wed, 17 Apr 2024 08:55:18 +0200 [thread overview]
Message-ID: <20240417065534.1678488-1-Quirin.Gylstorff@siemens.com> (raw)
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Device mapper block devices can be stacked e.g.
in case a hard disk is encrypted and uses lvm:
sda
+-sda1 259:3 0 2G 0 part
+-sda1_crypt 253:0 0 2G 0 crypt
+-debian--vg-root 253:1 0 1G 0 lvm
So we should traverse the `slaves` until we reach the endpoint.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
.../expand-on-first-boot/files/expand-last-partition.sh | 3 +++
1 file changed, 3 insertions(+)
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 84f1219f..0cb2ee21 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
@@ -12,6 +12,9 @@ set -e
ROOT_DEV="$(findmnt / -o source -n)"
ROOT_DEV_NAME=${ROOT_DEV##*/}
ROOT_DEV_SLAVE=$(find /sys/block/"${ROOT_DEV_NAME}"/slaves -mindepth 1 -print -quit 2>/dev/null || true)
+while [ -d "${ROOT_DEV_SLAVE}/slaves" ]; do
+ ROOT_DEV_SLAVE=$(find "${ROOT_DEV_SLAVE}"/slaves -mindepth 1 -print -quit 2>/dev/null || true)
+done
if [ -n "${ROOT_DEV_SLAVE}" ]; then
ROOT_DEV=/dev/${ROOT_DEV_SLAVE##*/}
fi
--
2.43.0
next reply other threads:[~2024-04-17 6:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 6:55 Quirin Gylstorff [this message]
2024-04-26 6:07 ` Uladzimir Bely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240417065534.1678488-1-Quirin.Gylstorff@siemens.com \
--to=quirin.gylstorff@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox