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

Add function write_bootable_protective_mbr_into #132

Merged

Conversation

richardstephens
Copy link
Contributor

We're using gptman to build a bootable disk image, that needs to boot on both BIOS and UEFI systems. We've found that some legacy BIOS systems don't consider a disk to be bootable unless the bootable flag is set on the PMBR.

This change is an API break, if you'd prefer to add a separate function or prevent an API break some other way, let me know!

@cecton
Copy link
Member

cecton commented Jan 5, 2024

Ahhh yeah I know actually I had an HP laptop years ago that had that issue

I don't think we need an API change for that. I would always make that partition use the bootflag. It's not like it's used anyway. So I propose you remove the parameter and always put the bootflag.

The protective MBR is not meant to be used like it is a usable partition table. It's just an information for the OS to tell to use GPT instead. It doesn't even cover partitions that are too big.

@bgilbert do you have an opinion on this?

@richardstephens
Copy link
Contributor Author

Our system uses gptman both at build time (for building the initial boot image) and at runtime (for updating the boot disk and for provisioning the data disks.)

It's not hard to imagine a scenario where that approach would be problematic for us - say a system is configured to boot from a data disk before the OS disk. The BIOS would skip the data disk initially, but then after it'd been provisioned, it would attempt to boot from its MBR, leaving the system unbootable without manual intervention.

src/lib.rs Outdated Show resolved Hide resolved
@cecton
Copy link
Member

cecton commented Jan 13, 2024

To be fair, you don't need to write the protective MBR if you don't want to. The BIOS will skip the disk if it doesn't have a DOS partition table. (I tested on my machine)

In doubt I don't mind that we add this functionality but I want to avoid an API break. Do you mind duplicating the function?

@richardstephens
Copy link
Contributor Author

To be fair, you don't need to write the protective MBR if you don't want to.

We found that some tools do not recognise a disk as GPT if there is no protective MBR present.

Do you mind duplicating the function?

Sure thing!

src/lib.rs Outdated Show resolved Hide resolved
@cecton cecton merged commit 01db819 into rust-disk-partition-management:main Jan 13, 2024
9 checks passed
@cecton cecton changed the title feat: flag to create pmbr marked as bootable Add function write_bootable_protective_mbr_into Jan 15, 2024
@cecton
Copy link
Member

cecton commented Jan 15, 2024

It's released in https://github.com/rust-disk-partition-management/gptman/releases/tag/v1.1.0

I should have rename the PR before merging oops! ^_^

We're currently 2 maintainers on the project but I think it would be great to have more. If by any chance you or anyone you know (who work with this crate) would be interested in maintaining the project please let me know!

@richardstephens richardstephens deleted the pmbr-bootable branch January 15, 2024 08:37
@richardstephens
Copy link
Contributor Author

Sure, I'd be happy to help out.

@cecton
Copy link
Member

cecton commented Jan 16, 2024

It's very low maintenance tbh! Just the CLI gets annoying with the update but I'm still deciding to remove it.

The invitation should be on your way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants