Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

BSD disklabel format

The BSD disklabel format is a partitioning schema mainly used by BSD operating systems.

Overview

A BSD disklabel consists of one or more partition entries, labeled alphabetically from “a” to “h” (or “p” in some BSD variants).

Note that BSD disklabel originally contained 8 entries for describing partitions and some BSD variants have since increased this to 16 partitions.

Certain labels have a predefined meaning, such as:

  • “a” is the “root” partition
  • “b” is the “swap” partition
  • “c” is the volume used by disklabel
  • “d” is the entire physical disk

Note that information about partition “d” is not stored in the corresponding BSD disklabel partition entry and typically filled with 0-byte values.

Characteristics

CharacteristicsDescription
Byte orderlittle-endian
Date and time valuesN/A
Character stringsASCII

The number of bytes per sector is 512.

BSD disklabel

The BSD disklabel is stored at offset 512. It can be preceded by a MBR with a single partition of type 0xa5 (FreeBSD).

The BSD disklabel is of variable size and consists of:

OffsetSizeValueDescription
04"WEV\x82"Signature
42Drive type
62Controller specific drive sub type
816Drive type name, which contains an ASCII string
2416Unknown (Pack identifier?), which contains an ASCII string
404Bytes per sector
444(Data) Sectors per track
484Tracks per cylinder
524(Data) Cylinders per unit
564(Data) Sectors per cylinder
604(Data) Sectors per unit
642Spare sectors per track
662Spare sectors per cylinder
684Alternate cylinders per unit
722Unknown (Rotational speed?)
742Unknown (Hardware sector interleave?)
762Unknown (Sector 0 skew per track?)
782Unknown (Sector 0 skew per cylinder?)
804Unknown (Head switch time in microseconds?)
844Unknown (Track-to-track seek time in microseconds?)
884Flags
925 x 4Unknown (Drive-type specific information?)
1125 x 4Unknown (Reserved)
1324"WEV\x82"Signature
1362Checksum, which contains a XOR of the BSD disklabel
1382Number of partition entries, should not exceed 16 (MAXPARTITIONS)
1404Boot area size in bytes
1444Maximum superblock size in bytes
148number of partitions x 16Array of partition entries

Note that the number of partition entries contains the total number of entries in the array, not the number of partitions in use.

The checksum is calculated as following:

  • set the checksum value to 0
  • XOR every 16-bit value in the disklabel

Drive types

ValueIdentifierDescription
1DTYPE_SMDSMD, XSMD
2DTYPE_MSCPMSCP
3DTYPE_DECDEC (rk, rl)
4DTYPE_SCSISCSI
5DTYPE_ESDIESDI
6DTYPE_ST506ST506
7DTYPE_HPIBCS/80 on HP-IB
8DTYPE_HPFLHP Fiber-link
10DTYPE_FLOPPYFloppy drive

Flags

ValueIdentifierDescription
0x00000001D_REMOVABLERemovable media
0x00000002D_ECCMedia supports error-correction codes (ECC)
0x00000004D_BADSECTMedia suppors bad sectro forwarding
0x00000008D_RAMDISKEmulated media using RAM
0x00000010D_CHAINMedia can do back-to-back transfers

Partition entry

The partition entry is 16 bytes in size and consists of:

OffsetSizeValueDescription
04Number of sectors
44Start sector
84File system (basic) fragment size
121File system type
131File system fragments per block
142Unknown (File system specific value)

Note that an emtpy partition entry consists of 0-byte values.

File system types

ValueIdentifierDescription
0FS_UNUSEDUnused
1FS_SWAPSwap
2FS_V66th edition
3FS_V77th edition
4FS_SYSVSystem V
5FS_V71K7th edition with 1 KiB blocks
6FS_V88th edition with 4 KiB blocks
7FS_BSDFFSBSD 4.2 fast file system (FFS)
8FS_MSDOSMS-DOS file system
9FS_BSDLFSBSD 4.4 log-structured file system
10FS_OTHEROther (unspecified) file system
11FS_HPFSOS/2 high-performance file system (HPFS)
12FS_ISO9660ISO 9660 (CD-ROM) file system
13FS_BOOTBoot code
14Unknown (Vinum)

References