In BSD-derived computer operating systems (including NetBSD, OpenBSD, FreeBSD and DragonFly BSD) and in related operating systems such as SunOS, a disklabel is a record stored on a data storage device such as a hard disk that contains information about the location of the partitions on the disk. Disklabels were introduced in the 4.3BSD-Tahoe release.[1] Disklabels are usually edited using the utility. In later versions of FreeBSD, this was renamed as .[2]
In historic Bell Labs and BSD Unix releases, disk partitioning was fixed, compiled into each device driver at the time the kernel was compiled. The fixed partitions overlapped, allowing the disk to be used with different layouts by careful selection of a non-overlapping subset of the partitions. This was not originally viewed as a problem because there were only a small number of disk drives supported by each driver, and Unix only ran on one vendor's hardware.[3]
The introduction of standardized disk interfaces — SMD, ESDI and SCSI — and a substantial market in third-party controllers and drives resulted in significant inconvenience, since a Unix system's operators would have to recompile the kernel in order to add an appropriate partition layout for every different disk they attached to a system. This also presented a problem for commercially licensed Unix vendors, as support engineers would have to recompile the kernel before installing upgrades on a customer's machine. For the 4.3-Tahoe release, which supported a non-Digital Equipment Corporation platform, the CCI Power 6/32, Berkeley implemented a new partitioning scheme based on an on-disk data structure and the disklabel(8) command. (Such on-disk partition maps were already well-known on other operating systems, and only the specific format, not the fact of partition labels generally, was invented by Berkeley.)[3]
Traditionally, the disklabel was embedded in the first-stage bootstrap loader, in the first sector or track of the disk, where the computer's firmware expected a boot loader to be. Having the label embedded in the boot loader meant that the loader did not itself need to contain code to locate and read the label from the disk.[3] However, this system only works when the computer firmware simply loads and executes the boot loader without attempting to determine whether it is valid. In the world of IBM PC compatibles, disks are usually partitioned using the PC BIOS's master boot record (MBR) Partition Table scheme instead, and the BSD partitioning scheme is nested within a single, primary, MBR partition (just as the "extended" partitioning scheme is nested within a single primary partition with extended boot records).[4] Sometimes (particularly in FreeBSD), the primary MBR partitions are referred to as slices and the subdivisions of a primary MBR partition (for the nested BSD partitioning scheme) that are described by its disklabel are called partitions. The BSD disklabel is contained within the volume boot record of its primary MBR partition.
The MBR partition IDs for primary partitions that are subdivided using BSD disklabels are (386BSD and FreeBSD), (OpenBSD), (NetBSD), and (DragonFly BSD).[5]
This format has a similar goal as the extended partitions and logical partition system used by MS-DOS, Windows and Linux.
The same PC hard drive can have both BSD disklabel partitions and the MS-DOS type logical partitions in separate primary partitions. FreeBSD and other BSD operating systems can access both the BSD disklabel subdivided partition and the MS-DOS type Extended/Logical partitions.
BSD disklabels traditionally contain 8 entries for describing partitions. These are, by convention, labeled alphabetically, 'a' through to 'h'. Some BSD variants have since increased this to 16 partitions, labeled 'a' through to 'p'.
Also by convention, partitions 'a', 'b', and 'c' have fixed meanings: