BSD disklabel

Last updated

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 disklabel utility. In later versions of FreeBSD, this was renamed as bsdlabel. [2]

Contents

History

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]

Where disklabels are stored

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 A5h (386BSD and FreeBSD), A6h (OpenBSD), A9h (NetBSD), and 6Ch (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.

The contents of disklabels

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:

See also

Related Research Articles

<span class="mw-page-title-main">Disk partitioning</span> Creation of separate accessible storage areas on a secondary computer storage device

Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions. Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.

<span class="mw-page-title-main">Drive letter assignment</span> Alphabetical assignment to logical drives on computers (e.g., C:\)

In computer data storage, drive letter assignment is the process of assigning alphabetical identifiers to volumes. Unlike the concept of UNIX mount points, where volumes are named and located arbitrarily in a single hierarchical namespace, drive letter assignment allows multiple highest-level namespaces. Drive letter assignment is thus a process of using letters to name the roots of the "forest" representing the file system; each volume holds an independent "tree".

<span class="mw-page-title-main">Boot sector</span> Sector of a persistent data storage device

A boot sector is the sector of a persistent data storage device which contains machine code to be loaded into random-access memory (RAM) and then executed by a computer system's built-in firmware.

<span class="mw-page-title-main">GNU GRUB</span> Boot loader package

GNU GRUB is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system's partitions.

fdisk Command line utility of DOS and Microsoft Windows operating systems

In computing, the fdisk command-line utility provides disk-partitioning functions, preparatory to defining file systems. fdisk features in the DOS, DR FlexOS, IBM OS/2, and Microsoft Windows operating systems, and in certain ports of FreeBSD, NetBSD, OpenBSD, DragonFly BSD and macOS for compatibility reasons. In versions of the Windows NT operating-system line from Windows 2000 onwards, fdisk is replaced by a more advanced tool called diskpart. Similar utilities exist for Unix-like systems, for example, BSD disklabel.

<span class="mw-page-title-main">Multi-booting</span> Act of installing multiple operating systems on a single computer

Multi-booting is the act of installing multiple operating systems on a single computer, and being able to choose which one to boot. The term dual-booting refers to the common configuration of specifically two operating systems. Multi-booting may require a custom boot loader.

<span class="mw-page-title-main">UEFI</span> Operating system software specification

The Unified Extensible Firmware Interface (UEFI) is a publicly available specification that defines a software interface between an operating system and platform firmware. UEFI replaces the legacy Basic Input/Output System (BIOS) boot firmware originally present in all IBM PC-compatible personal computers, with most UEFI firmware implementations providing support for legacy BIOS services. UEFI can support remote diagnostics and repair of computers, even with no operating system installed.

<span class="mw-page-title-main">GUID Partition Table</span> Computer disk partitioning standard

The GUID Partition Table (GPT) is a standard for the layout of partition tables of a physical computer storage device, such as a hard disk drive or solid-state drive, using universally unique identifiers, which are also known as globally unique identifiers (GUIDs). Forming a part of the Unified Extensible Firmware Interface (UEFI) standard, it is nevertheless also used for some BIOS systems, because of the limitations of master boot record (MBR) partition tables, which use 32 bits for logical block addressing (LBA) of traditional 512-byte disk sectors.

Apple Partition Map (APM) is a partition scheme used to define the low-level organization of data on disks formatted for use with 68k and PowerPC Macintosh computers. It was introduced with the Macintosh II.

The Logical Disk Manager (LDM) is an implementation of a logical volume manager for Microsoft Windows NT, developed by Microsoft and Veritas Software. It was introduced with the Windows 2000 operating system, and is supported in Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows 8, Windows 10 and Windows 11. The MMC-based Disk Management snap-in hosts the Logical Disk Manager. On Windows 8 and Windows Server 2012, Microsoft deprecated LDM in favor of Storage Spaces.

An extended boot record (EBR), or extended partition boot record (EPBR), is a descriptor for a logical partition under the common DOS disk drive partitioning system. In that system, when one partition record entry in the master boot record (MBR) is designated an extended partition, then that partition can be subdivided into a number of logical partitions. The actual structure of that extended partition is described by one or more EBRs, which are located inside the extended partition. The first EBR will always be located on the very first sector of the extended partition.

A volume boot record (VBR) is a type of boot sector introduced by the IBM Personal Computer. It may be found on a partitioned data storage device, such as a hard disk, or an unpartitioned device, such as a floppy disk, and contains machine code for bootstrapping programs stored in other parts of the device. On non-partitioned storage devices, it is the first sector of the device. On partitioned devices, it is the first sector of an individual partition on the device, with the first sector of the entire device being a Master Boot Record (MBR) containing the partition table.

The partition type in a partition's entry in the partition table inside a master boot record (MBR) is a byte value intended to specify the file system the partition contains or to flag special access methods used to access these partitions.

Linux startup process is the multi-stage initialization process performed during booting a Linux installation. It is in many ways similar to the BSD and other Unix-style boot processes, from which it derives.

GEOM is the main storage framework for the FreeBSD operating system. It is available in FreeBSD 5.0 and later releases, and provides a standardized way to access storage layers. GEOM is modular and allows for geom modules to connect to the framework. For example, the geom_mirror module provides RAID1 or mirroring functionality to the system. A number of modules are provided as part of FreeBSD and others have been developed independently and are distributed via (e.g.) GitHub.

gpart is a software utility which scans a storage device, examining the data in order to detect partitions which may exist but are absent from the disk's partition tables. Gpart was written by Michail Brzitwa of Germany. The release on the author's website is now older than the releases some distributions are using. It appears that Michail Brzitwa does not actively maintain the code, instead the various distributions appear to maintain their own versions.

The BIOS boot partition is a partition on a data storage device that GNU GRUB uses on legacy BIOS-based personal computers in order to boot an operating system, when the actual boot device contains a GUID Partition Table (GPT). Such a layout is sometimes referred to as BIOS/GPT boot.

In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an application program to interact with a device by using its device driver via standard input/output system calls. Using standard system calls simplifies many programming tasks, and leads to consistent user-space I/O mechanisms regardless of device features and functions.

<span class="mw-page-title-main">DOS</span> Group of closely related IBM PC-compatible operating systems

DOS is a platform-independent acronym for "disk operating system" that later became a common shorthand for disk-based operating systems on IBM PC compatibles. DOS primarily consists of Microsoft's MS-DOS and a rebranded version under the name IBM PC DOS, both of which were introduced in 1981. Later compatible systems from other manufacturers include DR DOS (1988), ROM-DOS (1989), PTS-DOS (1993), and FreeDOS (1998). MS-DOS dominated the IBM PC compatible market between 1981 and 1995.

A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. The concept of MBRs was publicly introduced in 1983 with PC DOS 2.0.

References

  1. "disklabel(5)". 4.4BSD Programmer's Manual. Archived from the original on 2013-12-24. Retrieved 2008-02-28.
  2. "FreeBSD/i386 5.1-RELEASE Release Notes" . Retrieved 9 May 2017.
  3. 1 2 3 McKusick, Marshall Kirk; Bostic, Keith; Karels, Michael J.; Quarterman, John S. (1996). The Design and Implementation of the 4.4BSD Operating System. Reading, Massachusetts: Addison-Wesley. pp. 199–200. ISBN   0-201-54979-4.
  4. McKusick, Marshall Kirk; Neville-Neil, George V.; Watson, Robert N.M. (2015). The Design and Implementation of the FreeBSD Operating System (2nd ed.). Upper Saddle River, New Jersey: Addison-Wesley. p. 377. ISBN   978-0-321-96897-5.
  5. DragonFly BSD commit 794d80a: Change legacy MBR partition type from 0xA5 to 0x6C

Further reading