is_pmbr_valid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… is_pmbr_valid(9)

okay so this one lives in the Kernel API Manual bestie, and it's literally called is_pmbr_valid β€” aka "test Protective MBR for validity" πŸŽ€


✨ SYNOPSIS ✨

int is_pmbr_valid (legacy_mbr *mbr , sector_t total_sectors );

🫢 ARGUMENTS 🫢

  • mbr β€” a pointer to a legacy_mbr structure. yeah. one of those. 🌸
  • total_sectors β€” how many sectors the device has. that's the whole vibe, that's the size. ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so what it does: it checks for a valid protective or hybrid master boot record (MBR). and the way the validity of a pMBR works? it depends on all of the following, no shortcuts, no "close enough" πŸ™ˆ

  1. the MSDOS signature is sitting in the last two bytes of the MBR πŸ”₯
  2. one partition of type 0xEE is found πŸ‘‘

and then, bonus round: a hybrid MBR will also have up to three additional primary partitions, and those point to the same space that's marked out by up to three GPT partitions. iykyk πŸ’…

it returns 0 upon an invalid MBR, or GPT_MBR_PROTECTIVE or GPT_MBR_HYBRID depending on the device layout. that's the whole mood. ⭐


🌈 SEE ALSO 🌈

kernel file ./block/partitions/efi.c, plus efi_crc32(9), last_lba(9), read_lba(9), alloc_read_gpt_entries(9), alloc_read_gpt_header(9), is_gpt_valid(9), is_pte_valid(9), compare_gpts(9), find_valid_gpt(9), utf16_le_to_7bit(9), and efi_partition(9) β€” go read them, bestie, they're all right there πŸ’–


ngl this page is filed under ./block/partitions and dated October 2026 β€” screenshot it, cite it, whatever, slay 🧚 πŸ’œ
πŸ“¦ where this page comes from