BSD Disklabel

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

OffsetSizeTypeFieldNotes
entry4u32 LE/BESize
position4u32 LE/BE–
entry + 44u32 LE/BEOffset
entry + 82u16 LE/BE–
position + 816bytesType Name
entry + 102u16 LE/BE–
entry + 121u8–
position + 2416bytesPack Name
position + 404u32 LE/BESector Size
position + 648bytesUid
position + 1142u16 LE/BEOpen Bsd
position + 1324u32 LE/BE–
position + 1382u16 LE/BECount

Constants

Bsd Module

NameValueTypeNotes
Magic0x82564557uint
HeaderSize148int
PartitionSize16int

Implementation limits

ClassNameValueNotes
Bsd ModuleMaxPartitions64
Bsd ModuleSearchBytes3 * 512
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.