Documentation
¶
Overview ¶
Package partition writes GPT and MBR disk partition tables.
A partition table is not a filesystem and does not implement image.Filesystem: it carves a whole-disk device.Device into aligned regions and hands each back as a device.Section, which the caller formats with any engine (ext, fat, …). This is the container layer that turns bare filesystem images into a bootable disk (e.g. GPT + ESP FAT32 + ext4 root). Use FormatGPT for a modern GUID partition table or FormatMBR for a classic table of up to four primaries.
For GPT, GUIDs come from the injected image.UUIDSource, so a disk is reproducible by wiring; per-partition GUIDs are derived deterministically from the disk GUID to stay unique without extra entropy.
Index ¶
Constants ¶
const ( MBRTypeEmpty = 0x00 MBRTypeFAT32LBA = 0x0C MBRTypeLinux = 0x83 MBRTypeLinuxSwap = 0x82 MBRTypeEFI = 0xEF )
MBR partition type bytes.
Variables ¶
var ( TypeEFI = Type{0x28, 0x73, 0x2A, 0xC1, 0x1F, 0xF8, 0xD2, 0x11, 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B} TypeLinuxData = Type{0xAF, 0x3D, 0xC6, 0x0F, 0x83, 0x84, 0x72, 0x47, 0x8E, 0x79, 0x3D, 0x69, 0xD8, 0x47, 0x7D, 0xE4} TypeLinuxRoot = Type{0xE3, 0xBC, 0x68, 0x4F, 0xCD, 0xE8, 0xB1, 0x4D, 0x96, 0xE7, 0xFB, 0xCA, 0xF9, 0x84, 0xB7, 0x09} )
Common partition type GUIDs, in on-disk byte order.
Functions ¶
This section is empty.
Types ¶
type MBRSpec ¶
MBRSpec describes one MBR primary partition. Size is in bytes, rounded up to the alignment; a Size of 0 fills the remaining space (last spec only).
type Partition ¶
Partition is a created partition: its byte range on the disk and the Section the caller formats.