Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: kernel partition sync when overwriting GPT #115

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

smira
Copy link
Member

@smira smira commented Nov 13, 2024

Add a second method to handle the case when the partition table is fully overwritten.

See siderolabs/talos#9701

Add a second method to handle the case when the partition table is fully
overwritten.

See siderolabs/talos#9701

Signed-off-by: Andrey Smirnov <[email protected]>
@smira smira force-pushed the fix/gpt-overwrite branch from 40683ff to 5bff648 Compare November 13, 2024 11:35

// syncKernelComplete synchronizes the kernel partition table with the current table by overwriting the whole table.
//
// It is incompatible with mounted partitions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't there a syscall to just tell the kernel to re-read the partition table? Also we must probably check this is not running on a disk which has a mounted partition and return an error if so

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is that if something calls gpt.New vs. gpt.Read then we know that whatever existing partitions are going to be removed.

The call would fail if the mounted partitions are there, but it's not the job of this library to handle that (it should be handled in the layer up).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by that syscall I meant BLKRRPART to be clear

@smira
Copy link
Member Author

smira commented Nov 13, 2024

/m

@talos-bot talos-bot merged commit 5bff648 into siderolabs:v2 Nov 13, 2024
14 checks passed
smira added a commit to smira/talos that referenced this pull request Nov 13, 2024
smira added a commit to smira/talos that referenced this pull request Dec 12, 2024
Fixes siderolabs#9701

See siderolabs/go-blockdevice#115

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit 8a7476c)
smira added a commit to smira/talos that referenced this pull request Dec 12, 2024
Fixes siderolabs#9701

See siderolabs/go-blockdevice#115

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit 8a7476c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants