Skip to content

Commit f4c8e63

Browse files
committed
wip: Run partprobe after Ignition partition changes
1 parent 455645c commit f4c8e63

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Triggered re-reading of partition table to fix adding partitions to the boot disk [TODO](TODO)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From e5c4e6bd9f3bad3b27e338e4da2f3b0b53ab1599 Mon Sep 17 00:00:00 2001
2+
From: Kai Lueke <[email protected]>
3+
Date: Fri, 29 Sep 2023 18:06:09 +0200
4+
Subject: [PATCH] sgdisk: Run partprobe after partition changes
5+
6+
The sgdisk tool does not update the kernel partition table in contrast
7+
to other similar tools. Often udev can detect the changes but not always
8+
as experienced when adding a new partition on Flatcar's boot disk.
9+
Instead of implicitly relying on some other component to re-read the
10+
kernel partition table, trigger the re-read with partprobe.
11+
---
12+
dracut/30ignition/module-setup.sh | 1 +
13+
internal/distro/distro.go | 2 ++
14+
internal/sgdisk/sgdisk.go | 5 +++++
15+
3 files changed, 8 insertions(+)
16+
17+
diff --git a/dracut/30ignition/module-setup.sh b/dracut/30ignition/module-setup.sh
18+
index ad7e80fd..3cdcb631 100755
19+
--- a/dracut/30ignition/module-setup.sh
20+
+++ b/dracut/30ignition/module-setup.sh
21+
@@ -33,6 +33,7 @@ install() {
22+
mkfs.xfs \
23+
mkswap \
24+
sgdisk \
25+
+ partprobe \
26+
useradd \
27+
userdel \
28+
usermod \
29+
diff --git a/internal/distro/distro.go b/internal/distro/distro.go
30+
index 61ca87ae..c1c13b62 100644
31+
--- a/internal/distro/distro.go
32+
+++ b/internal/distro/distro.go
33+
@@ -37,6 +37,7 @@ var (
34+
mdadmCmd = "mdadm"
35+
mountCmd = "mount"
36+
sgdiskCmd = "sgdisk"
37+
+ partprobeCmd = "partprobe"
38+
modprobeCmd = "modprobe"
39+
udevadmCmd = "udevadm"
40+
usermodCmd = "usermod"
41+
@@ -90,6 +91,7 @@ func GroupdelCmd() string { return groupdelCmd }
42+
func MdadmCmd() string { return mdadmCmd }
43+
func MountCmd() string { return mountCmd }
44+
func SgdiskCmd() string { return sgdiskCmd }
45+
+func PartprobeCmd() string { return partprobeCmd }
46+
func ModprobeCmd() string { return modprobeCmd }
47+
func UdevadmCmd() string { return udevadmCmd }
48+
func UsermodCmd() string { return usermodCmd }
49+
diff --git a/internal/sgdisk/sgdisk.go b/internal/sgdisk/sgdisk.go
50+
index 29915809..e70a3881 100644
51+
--- a/internal/sgdisk/sgdisk.go
52+
+++ b/internal/sgdisk/sgdisk.go
53+
@@ -121,6 +121,11 @@ func (op *Operation) Commit() error {
54+
if _, err := op.logger.LogCmd(cmd, "deleting %d partitions and creating %d partitions on %q", len(op.deletions), len(op.parts), op.dev); err != nil {
55+
return fmt.Errorf("create partitions failed: %v", err)
56+
}
57+
+ // In contrast to similar tools, sgdisk does not trigger the update of the kernel partition table
58+
+ cmd = exec.Command(distro.PartprobeCmd(), op.dev)
59+
+ if _, err := op.logger.LogCmd(cmd, "re-reading of %d deleted partitions and %d created partitions on %q", len(op.deletions), len(op.parts), op.dev); err != nil {
60+
+ return fmt.Errorf("re-reading partitions failed: %v", err)
61+
+ }
62+
63+
return nil
64+
}
65+
--
66+
2.41.0
67+

sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-9999.ebuild

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ PATCHES=(
6363
"${FILESDIR}/0019-docs-Add-re-added-platforms-to-docs-to-pass-tests.patch"
6464
"${FILESDIR}/0020-usr-share-oem-oem.patch"
6565
"${FILESDIR}/0021-internal-exec-stages-mount-Mount-oem.patch"
66+
"${FILESDIR}/0022-sgdisk-Run-partprobe-after-partition-changes.patch"
6667
)
6768

6869
src_compile() {

0 commit comments

Comments
 (0)