The BSD disklabel splits a slice or disk into up to 8 or 16 partitions and is used by FreeBSD, NetBSD, OpenBSD and DragonFly, usually nested inside an MBR slice. Still in use on BSD systems, though GPT is now preferred.
Overview
The BSD disklabel is located in the second sector of a slice. It contains a magic number (0x82564557 at both ends), disk geometry, a checksum, and a table of 8 or 16 partitions with size, offset, fragment size and file system type. Partition c conventionally spans the whole slice. It may be placed inside an MBR slice (DOS partition) or used directly.
History
- Originated in 4.2BSD (1983).
- FreeBSD switched to GPT by default in later releases.
Structures
Offsets are in bytes from the start of the structure named in each heading. Field names are descriptive and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.
Try Parse
| Offset | Size | Type | Field | Notes |
|---|---|---|---|---|
| entry | 4 | u32 LE/BE | Size | |
| position | 4 | u32 LE/BE | – | |
| entry + 4 | 4 | u32 LE/BE | Offset | |
| entry + 8 | 2 | u16 LE/BE | – | |
| position + 8 | 16 | bytes | Type Name | |
| entry + 10 | 2 | u16 LE/BE | – | |
| entry + 12 | 1 | u8 | – | |
| position + 24 | 16 | bytes | Pack Name | |
| position + 40 | 4 | u32 LE/BE | Sector Size | |
| position + 64 | 8 | bytes | Uid | |
| position + 114 | 2 | u16 LE/BE | Open Bsd | |
| position + 132 | 4 | u32 LE/BE | – | |
| position + 138 | 2 | u16 LE/BE | Count |
Constants
Bsd Module
| Name | Value | Type | Notes |
|---|---|---|---|
| Magic | 0x82564557 | uint | |
| HeaderSize | 148 | int | |
| PartitionSize | 16 | int |
Implementation limits
| Class | Name | Value | Notes |
|---|---|---|---|
| Bsd Module | MaxPartitions | 64 | |
| Bsd Module | SearchBytes | 3 * 512 |