A master boot record (MBR) is a special type of
boot sector at the very beginning of
partitioned computer
mass storage device
In computing, mass storage refers to the storage of large amounts of data in a persisting and machine-readable fashion. In general, the term is used as large in relation to contemporaneous hard disk drives, but it has been used large in relati ...
s like
fixed disk
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with magne ...
s or
removable drive
A disk enclosure is a specialized casing designed to hold and power disk drives while providing a mechanism to allow them to communicate to one or more separate computers.
Drive enclosures provide power to the drives therein and convert the dat ...
s intended for use with
IBM PC-compatible
IBM PC compatible computers are similar to the original IBM PC, XT, and AT, all from computer giant IBM, that are able to use the same software and expansion cards. Such computers were referred to as PC clones, IBM clones or IBM PC clones. ...
systems and beyond. The concept of MBRs was publicly introduced in 1983 with
PC DOS 2.0
IBM PC DOS, an acronym for IBM Personal Computer Disk Operating System, is a discontinued disk operating system for IBM PC compatibles. It was manufactured and sold by IBM from the early 1980s into the 2000s. Developed by Microsoft, it was also ...
.
The MBR holds the information on how the disc's sectors are divided into partitions, each partition notionally containing a file system. The MBR also contains executable code to function as a loader for the installed operating system—usually by passing control over to the loader's second stage, or in conjunction with each partition's volume boot record (VBR). This MBR code is usually referred to as a boot loader.
The organization of the partition table in the MBR limits the maximum addressable storage space of a partitioned disk to 2
TiB .
Approaches to slightly raise this limit assuming 32-bit arithmetics or 4096-byte sectors are not officially supported, as they fatally break compatibility with existing boot loaders and most MBR-compliant operating systems and system tools, and can cause serious data corruption when used outside of narrowly controlled system environments. Therefore, the MBR-based partitioning scheme is in the process of being superseded by the
GUID Partition Table
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 i ...
(GPT) scheme in new computers. A GPT can coexist with an MBR in order to provide some limited form of backward compatibility for older systems.
MBRs are not present on non-partitioned media such as
floppies
A floppy disk or floppy diskette (casually referred to as a floppy, or a diskette) is an obsolescent type of disk storage composed of a thin and flexible disk of a magnetic storage medium in a square or nearly square plastic enclosure lined w ...
,
superfloppies or other storage devices configured to behave as such.
Overview
Support for partitioned media, and thereby the master boot record (MBR), was introduced with IBM
PC DOS 2.0 in March 1983 in order to support the 10 MB
hard disk
A hard disk drive (HDD), hard disk, hard drive, or fixed disk is an electro-mechanical data storage device that stores and retrieves digital data using magnetic storage with one or more rigid rapidly rotating platters coated with magnet ...
of the then-new
IBM Personal Computer XT
The IBM Personal Computer XT (model 5160, often shortened to PC/XT) is the second computer in the IBM Personal Computer line, released on March 8, 1983. Except for the addition of a built-in hard drive and extra expansion slots, it is very simila ...
, still using the
FAT12
File Allocation Table (FAT) is a file system developed for personal computers. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. It is often supported for compatibility reasons by ...
file system. The original version of the MBR was written by David Litton of IBM in June 1982. The partition table supported up to four ''primary partitions'', of which
DOS
DOS is shorthand for the MS-DOS and IBM PC DOS family of operating systems.
DOS may also refer to:
Computing
* Data over signalling (DoS), multiplexing data onto a signalling channel
* Denial-of-service attack (DoS), an attack on a communicatio ...
could only use one. This did not change when
FAT16
File Allocation Table (FAT) is a file system developed for personal computers. Originally developed in 1977 for use on floppy disks, it was adapted for use on Hard disk drive, hard disks and other devices. It is often supported for compatibi ...
was introduced as a new file system with DOS 3.0. Support for an ''
extended partition
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 (and only one) partition record entry in the master boot ...
'', a special primary partition type used as a container to hold other partitions, was added with DOS 3.2, and nested ''logical drives'' inside an extended partition came with DOS 3.30. Since MS-DOS, PC DOS, OS/2 and Windows were never enabled to boot off them, the MBR format and boot code remained almost unchanged in functionality, except for in some third-party implementations, throughout the eras of DOS and OS/2 up to 1996.
In 1996, support for
logical block addressing
Logical block addressing (LBA) is a common scheme used for specifying the location of blocks of data stored on computer storage devices, generally secondary storage systems such as hard disk drives. LBA is a particularly simple linear addressi ...
(LBA) was introduced in Windows 95B and DOS 7.10 in order to support disks larger than 8 GB. ''Disk timestamps'' were also introduced.
This also reflected the idea that the MBR is meant to be operating system and file system independent. However, this design rule was partially compromised in more recent Microsoft implementations of the MBR, which enforce
CHS access for
FAT16B
File Allocation Table (FAT) is a file system developed for personal computers. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. It is often supported for compatibility reasons by c ...
and
FAT32
File Allocation Table (FAT) is a file system developed for personal computers. Originally developed in 1977 for use on floppy disks, it was adapted for use on hard disks and other devices. It is often supported for compatibility reasons by c ...
partition types
/
, whereas LBA is used for
/
.
Despite sometimes poor documentation of certain intrinsic details of the MBR format (which occasionally caused compatibility problems), it has been widely adopted as a de facto industry standard, due to the broad popularity of PC-compatible computers and its semi-static nature over decades. This was even to the extent of being supported by computer operating systems for other platforms. Sometimes this was in addition to other pre-existing or
cross-platform
In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software r ...
standards for bootstrapping and partitioning.
MBR partition entries and the MBR boot code used in commercial operating systems, however, are limited to 32 bits.
Therefore, the maximum disk size supported on disks using 512-byte sectors (whether real or emulated) by the MBR partitioning scheme (without 33-bit arithmetic) is limited to 2 TiB.
Consequently, a different partitioning scheme must be used for larger disks, as they have become widely available since 2010. The MBR partitioning scheme is therefore in the process of being superseded by the
GUID Partition Table
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 i ...
(GPT). The official approach does little more than ensuring data integrity by employing a ''protective MBR''. Specifically, it does not provide backward compatibility with operating systems that do not support the GPT scheme as well. Meanwhile, multiple forms of ''hybrid MBRs'' have been designed and implemented by third parties in order to maintain partitions located in the first physical 2 TiB of a disk in both partitioning schemes "in parallel" and/or to allow older operating systems to boot off GPT partitions as well. The present non-standard nature of these solutions causes various compatibility problems in certain scenarios.
The MBR consists of 512 or more
byte
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
s located in the first
sector
Sector may refer to:
Places
* Sector, West Virginia, U.S.
Geometry
* Circular sector, the portion of a disc enclosed by two radii and a circular arc
* Hyperbolic sector, a region enclosed by two radii and a hyperbolic arc
* Spherical sector, a po ...
of the drive.
It may contain one or more of:
* A
partition table
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, ...
describing the partitions of a storage device. In this context the boot sector may also be called a ''partition sector''.
*
Bootstrap code: Instructions to identify the configured bootable partition, then load and execute its
volume boot record (VBR) as a
chain loader
Chain loading is a method used by computer programs to replace the currently executing program with a new program, using a common data area to pass information from the current program to the new program. It occurs in several areas of computing. ...
.
* Optional 32-bit ''disk timestamp''.
* Optional 32-bit ''disk signature''.
Disk partitioning
IBM PC DOS
PC or pc may refer to:
Arts and entertainment
* Player character or playable character, a fictional character controlled by a human player, usually in role-playing games or computer games
* ''Port Charles'', an American daytime TV soap opera
* ...
2.0 introduced the
FDISK
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 FreeBS ...
utility to set up and maintain MBR partitions. When a storage device has been partitioned according to this scheme, its MBR contains a partition table describing the locations, sizes, and other attributes of linear regions referred to as partitions.
The partitions themselves may also contain data to describe more complex partitioning schemes, such as
extended boot record
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 (and only one) partition record entry in the master boot ...
s (EBRs),
BSD disklabel
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 ...
s, or
Logical Disk Manager
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, Wind ...
metadata partitions.
The MBR is not located in a partition; it is located at a first sector of the device (physical offset 0), preceding the first partition. (The boot sector present on a non-partitioned device or within an individual partition is called a
volume boot record instead.) In cases where the computer is running a
DDO BIOS overlay or
boot manager
A bootloader, also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is responsible for booting a computer.
When a computer is turned off, its softwareincluding operating systems, application code, an ...
, the partition table may be moved to some other physical location on the device; e.g.,
Ontrack Disk Manager
Disk Manager is a discontinued software (that was a popular 1980s and 1990s) and documentation package for MS-DOS and PC DOS computers, useful for self-installing personal computer hard disks. It was written by Ontrack, a company that is now part ...
often placed a copy of the original MBR contents in the second sector, then hid itself from any subsequently booted OS or application, so the MBR copy was treated as if it were still residing in the first sector.
Sector layout
By convention, there are exactly four primary partition table entries in the MBR partition table scheme, although some operating systems and system tools extended this to five (Advanced Active Partitions (AAP) with
PTS-DOS
PTS-DOS (aka PTS/DOS) is a disk operating system, a DOS clone, developed in Russia by PhysTechSoft and Paragon Technology Systems.
History and versions
PhysTechSoft was formed in 1991 in Moscow, Russia by graduates and members of MIPT, infor ...
6.60
and
DR-DOS
DR-DOS (written as DR DOS, without a hyphen, in versions up to and including 6.0) is a disk operating system for IBM PC compatibles. Upon its introduction in 1988, it was the first DOS attempting to be compatible with IBM PC DOS and MS-D ...
7.07), eight (
AST and
NEC
is a Japanese multinational corporation, multinational information technology and electronics corporation, headquartered in Minato, Tokyo. The company was known as the Nippon Electric Company, Limited, before rebranding in 1983 as NEC. It prov ...
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
3.x
as well as
Storage Dimensions
Storage may refer to:
Goods Containers
* Dry cask storage, for storing high-level radioactive waste
* Food storage
* Intermodal container, cargo shipping
* Storage tank
Facilities
* Garage (residential), a storage space normally used to store car ...
SpeedStor), or even sixteen entries (with
Ontrack Disk Manager
Disk Manager is a discontinued software (that was a popular 1980s and 1990s) and documentation package for MS-DOS and PC DOS computers, useful for self-installing personal computer hard disks. It was written by Ontrack, a company that is now part ...
).
Partition table entries
An artifact of hard disk technology from the era of the
PC XT
The IBM Personal Computer XT (model 5160, often shortened to PC/XT) is the second computer in the IBM Personal Computer line, released on March 8, 1983. Except for the addition of a built-in hard drive and extra expansion slots, it is very simila ...
, the partition table subdivides a storage medium using units of
cylinders
A cylinder (from ) has traditionally been a three-dimensional solid, one of the most basic of curvilinear geometric shapes. In elementary geometry, it is considered a prism with a circle as its base.
A cylinder may also be defined as an infini ...
,
heads
A head is the part of an organism which usually includes the ears, brain, forehead, cheeks, chin, eyes, nose, and mouth, each of which aid in various sensory functions such as sight, hearing, smell, and taste. Some very simple animals may no ...
, and
sectors
Sector may refer to:
Places
* Sector, West Virginia, U.S.
Geometry
* Circular sector, the portion of a disc enclosed by two radii and a circular arc
* Hyperbolic sector, a region enclosed by two radii and a hyperbolic arc
* Spherical sector, a p ...
(
CHS addressing). These values no longer correspond to their namesakes in modern disk drives, as well as being irrelevant in other devices such as
solid-state drive
A solid-state drive (SSD) is a solid-state storage device that uses integrated circuit assemblies to store data persistently, typically using flash memory, and functioning as secondary storage in the hierarchy of computer storage. It is ...
s, which do not physically have cylinders or heads.
In the CHS scheme, sector indices have (almost) always begun with sector 1 rather than sector 0 by convention, and due to an error in all versions of MS-DOS/PC DOS up to including 7.10, the number of heads is generally limited to 255 instead of 256. When a CHS address is too large to fit into these fields, the
tuple
In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
(1023, 254, 63) is typically used today, although on older systems, and with older disk tools, the cylinder value often wrapped around modulo the CHS barrier near 8 GB, causing ambiguity and risks of data corruption. (If the situation involves a "protective" MBR on a disk with a GPT, Intel's
Extensible Firmware Interface
UEFI (Unified Extensible Firmware Interface) is a set of specifications written by the UEFI Forum. They define the architecture of the platform firmware used for booting and its interface for interaction with the operating system. Examples of f ...
specification requires that the tuple (1023, 255, 63) be used.) The 10-bit cylinder value is recorded within two bytes in order to facilitate making calls to the original/legacy
INT 13h
INT 13h is shorthand for BIOS interrupt call 13 hex, the 20th interrupt vector in an x86-based (IBM PC-descended) computer system. The BIOS typically sets up a real mode interrupt handler at this vector that provides sector-based hard disk an ...
BIOS disk access routines, where 16 bits were divided into sector and cylinder parts, and not on byte boundaries.
Due to the limits of CHS addressing,
a transition was made to using LBA, or
logical block addressing
Logical block addressing (LBA) is a common scheme used for specifying the location of blocks of data stored on computer storage devices, generally secondary storage systems such as hard disk drives. LBA is a particularly simple linear addressi ...
. Both the partition length and partition start address are sector values stored in the partition table entries as 32-bit quantities. The sector size used to be considered fixed at 512 (2
9) bytes, and a broad range of important components including
chipsets
In a computer system, a chipset is a set of electronic components in one or more integrated circuits known as a "Data Flow Management System" that manages the data flow between the processor, memory and peripherals. It is usually found on the mot ...
,
boot sectors,
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s,
database engine
A database engine (or storage engine) is the underlying software component that a database management system (DBMS) uses to create, read, update and delete (CRUD) data from a database. Most database management systems include their own application ...
s,
partitioning tools,
backup
In information technology, a backup, or data backup is a copy of computer data taken and stored elsewhere so that it may be used to restore the original after a data loss event. The verb form, referring to the process of doing so, is "back up", w ...
and
file system
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
utilities and other software had this value hard-coded. Since the end of 2009, disk drives employing 4096-byte sectors (
4Kn
Advanced Format (AF) is any disk sector format used to store data on magnetic disks in hard disk drives (HDDs) that exceeds 512, 520, or 528 bytes per sector, such as the 4096, 4112, 4160, and 4224-byte (4 KB) sectors of an Advanced Format ...
or
Advanced Format
Advanced Format (AF) is any disk sector format used to store data on magnetic disks in hard disk drives (HDDs) that exceeds 512, 520, or 528 bytes per sector, such as the 4096, 4112, 4160, and 4224-byte (4 KB) sectors of an Advanced Format ...
) have been available, although the size of the sector for some of these drives was still reported as 512 bytes to the host system through conversion in the hard-drive firmware and referred to as 512 emulation drives (
512e
Advanced Format (AF) is any disk sector format used to store data on magnetic disks in hard disk drives (HDDs) that exceeds 512, 520, or 528 bytes per sector, such as the 4096, 4112, 4160, and 4224-byte (4 KB) sectors of an Advanced Format ...
).
Since block addresses and sizes are stored in the partition table of an MBR using 32 bits, the maximum size, as well as the highest start address, of a partition using drives that have 512-byte sectors (actual or emulated) cannot exceed 2
TiB−512 bytes ( bytes or (2
32−1) sectors × 512 (2
9) bytes per sector).
Alleviating this capacity limitation was one of the prime motivations for the development of the GPT.
Since partitioning information is stored in the MBR partition table using a beginning block address and a length, it may in theory be possible to define partitions in such a way that the allocated space for a disk with 512-byte sectors gives a total size approaching 4 TiB, if all but one partition are located below the 2 TiB limit and the last one is assigned as starting at or close to block 2
32−1 and specify the size as up to 2
32−1, thereby defining a partition that requires 33 rather than 32 bits for the sector address to be accessed. However, in practice, only certain
LBA-48-enabled operating systems, including Linux, FreeBSD and Windows 7
that use 64-bit sector addresses internally actually support this. Due to code space constraints and the nature of the MBR partition table to only support 32 bits, boot sectors, even if enabled to support LBA-48 rather than
LBA-28, often use 32-bit calculations, unless they are specifically designed to support the full address range of LBA-48 or are intended to run on 64-bit platforms only. Any boot code or operating system using 32-bit sector addresses internally would cause addresses to wrap around accessing this partition and thereby result in serious data corruption over all partitions.
For disks that present a sector size other than 512 bytes, such as
USB
Universal Serial Bus (USB) is an industry standard that establishes specifications for cables, connectors and protocols for connection, communication and power supply (interfacing) between computers, peripherals and other computers. A broad v ...
external drive
A disk enclosure is a specialized casing designed to hold and power disk drives while providing a mechanism to allow them to communicate to one or more separate computers.
Drive enclosures provide power to the drives therein and convert the dat ...
s, there are limitations as well. A sector size of 4096 results in an eight-fold increase in the size of a partition that can be defined using MBR, allowing partitions up to 16 TiB (2
32 × 4096 bytes) in size.
Versions of Windows more recent than Windows XP support the larger sector sizes, as well as Mac OS X, and
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
has supported larger sector sizes since 2.6.31
or 2.6.32,
but issues with boot loaders, partitioning tools and computer BIOS implementations present certain limitations,
since they are often hard-wired to reserve only 512 bytes for sector buffers, causing memory to become overwritten for larger sector sizes. This may cause unpredictable behaviour as well, and therefore should be avoided when compatibility and standard conformity is an issue.
Where a data storage device has been partitioned with the GPT scheme, the master boot record will still contain a partition table, but its only purpose is to indicate the existence of the GPT and to prevent utility programs that understand only the MBR partition table scheme from creating any partitions in what they would otherwise see as free space on the disk, thereby accidentally erasing the GPT.
System bootstrapping
On
IBM PC-compatible
IBM PC compatible computers are similar to the original IBM PC, XT, and AT, all from computer giant IBM, that are able to use the same software and expansion cards. Such computers were referred to as PC clones, IBM clones or IBM PC clones. ...
computers, the
bootstrapping
In general, bootstrapping usually refers to a self-starting process that is supposed to continue or grow without external input.
Etymology
Tall boots may have a tab, loop or handle at the top known as a bootstrap, allowing one to use fingers ...
firmware
In computing, firmware is a specific class of computer software that provides the low-level control for a device's specific hardware. Firmware, such as the BIOS of a personal computer, may contain basic functions of a device, and may provide h ...
(contained within the
ROM
Rom, or ROM may refer to:
Biomechanics and medicine
* Risk of mortality, a medical classification to estimate the likelihood of death for a patient
* Rupture of membranes, a term used during pregnancy to describe a rupture of the amniotic sac
* R ...
BIOS
In computing, BIOS (, ; Basic Input/Output System, also known as the System BIOS, ROM BIOS, BIOS ROM or PC BIOS) is firmware used to provide runtime services for operating systems and programs and to perform hardware initialization during the ...
) loads and executes the master boot record.
The
PC/XT (type 5160) used an
Intel 8088
The Intel 8088 ("''eighty-eighty-eight''", also called iAPX 88) microprocessor is a variant of the Intel 8086. Introduced on June 1, 1979, the 8088 has an eight-bit external data bus instead of the 16-bit bus of the 8086. The 16-bit registers an ...
microprocessor
A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circu ...
. In order to remain compatible, all x86 architecture systems start with the microprocessor in an
operating mode referred to as
real mode
Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory. Real mode is characterized by a 20-bit seg ...
. The BIOS reads the MBR from the storage device into
physical memory
Computer data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processing unit (CPU) of a computer ...
, and then it directs the microprocessor to the start of the boot code. Since the BIOS runs in real mode, the processor is in real mode when the MBR program begins to execute, and so the beginning of the MBR is expected to contain real-mode
machine code
In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a very ...
.
Since the BIOS bootstrap routine loads and runs exactly one sector from the physical disk, having the partition table in the MBR with the boot code simplifies the design of the MBR program. It contains a small program that loads the
Volume Boot Record (VBR) of the targeted partition. Control is then passed to this code, which is responsible for loading the actual operating system. This process is known as
chain loading
Chain loading is a method used by computer programs to replace the currently executing program with a new program, using a common data area to pass information from the current program to the new program. It occurs in several areas of computing. ...
.
Popular MBR code programs were created for booting
PC DOS
PC or pc may refer to:
Arts and entertainment
* Player character or playable character, a fictional character controlled by a human player, usually in role-playing games or computer games
* ''Port Charles'', an American daytime TV soap opera
* ...
and
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few ope ...
, and similar boot code remains in wide use. These boot sectors expect the
FDISK
partition table scheme to be in use and scans the list of partitions in the MBR's embedded partition table to find the only one that is marked with the ''active flag''.
It then loads and runs the
volume boot record (VBR) of the active partition.
There are alternative boot code implementations, some of which are installed by
boot manager
A bootloader, also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is responsible for booting a computer.
When a computer is turned off, its softwareincluding operating systems, application code, an ...
s, which operate in a variety of ways. Some MBR code loads additional code for a boot manager from the first track of the disk, which it assumes to be "free" space that is not allocated to any disk partition, and executes it. A MBR program may interact with the user to determine which partition on which drive should boot, and may transfer control to the MBR of a different drive. Other MBR code contains a list of disk locations (often corresponding to the contents of
files in a
filesystem
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
) of the remainder of the boot manager code to load and to execute. (The first relies on behavior that is not universal across all disk partitioning utilities, most notably those that read and write GPTs. The last requires that the embedded list of disk locations be updated when changes are made that would relocate the remainder of the code.)
On machines that do not use
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was introd ...
processors, or on x86 machines with non-BIOS firmware such as
Open Firmware
Open Firmware is a standard defining the interfaces of a computer firmware system, formerly endorsed by the Institute of Electrical and Electronics Engineers (IEEE). It originated at Sun Microsystems, where it was known as OpenBoot, and has bee ...
or
Extensible Firmware Interface
UEFI (Unified Extensible Firmware Interface) is a set of specifications written by the UEFI Forum. They define the architecture of the platform firmware used for booting and its interface for interaction with the operating system. Examples of f ...
(EFI) firmware, this design is unsuitable, and the MBR is not used as part of the system bootstrap.
EFI firmware is instead capable of directly understanding the GPT partitioning scheme and the
FAT
In nutrition science, nutrition, biology, and chemistry, fat usually means any ester of fatty acids, or a mixture of such chemical compound, compounds, most commonly those that occur in living beings or in food.
The term often refers spec ...
filesystem format, and loads and runs programs held as files in the
EFI System partition.
The MBR will be involved only insofar as it might contain a partition table for compatibility purposes if the GPT partition table scheme has been used.
There is some MBR replacement code that emulates EFI firmware's bootstrap, which makes non-EFI machines capable of booting from disks using the GPT partitioning scheme. It detects a GPT, places the processor in the correct operating mode, and loads the EFI compatible code from disk to complete this task.
Disk identity
![Qtparted-usb-hdd-snapshot](https://upload.wikimedia.org/wikipedia/commons/8/87/Qtparted-usb-hdd-snapshot.png)
In addition to the bootstrap code and a partition table, master boot records may contain a
disk signature. This is a 32-bit value that is intended to identify uniquely the disk medium (as opposed to the disk unit—the two not necessarily being the same for removable hard disks).
The disk signature was introduced by Windows NT version 3.5, but it is now used by several operating systems, including the
Linux kernel
The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
version 2.6 and later. Linux tools can use the NT disk signature to determine which disk the machine booted from.
Windows NT (and later Microsoft operating systems) uses the disk signature as an index to all the partitions on any disk ever connected to the computer under that OS; these signatures are kept in
Windows Registry
The Windows Registry is a hierarchical database that stores low-level settings for the Microsoft Windows operating system and for applications that opt to use the registry. The kernel, device drivers, services, Security Accounts Manager, and use ...
keys, primarily for storing the persistent mappings between disk partitions and drive letters. It may also be used in Windows NT
BOOT.INI
NTLDR (abbreviation of ''NT loader'') is the boot loader for all releases of Windows NT operating system from 1993 with the release of Windows NT 3.1 up until Windows XP and Windows Server 2003. From Windows Vista onwards it was replaced by the BOO ...
files (though most do not), to describe the location of bootable Windows NT (or later) partitions.
One key (among many), where NT disk signatures appear in a Windows 2000/XP registry, is:
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\
If a disk's signature stored in the MBR was (in that order) and its first partition corresponded with logical drive C: under Windows, then the
REG_BINARY
data under the key value
\DosDevices\C:
would be:
A8 E1 B9 D2 00 7E 00 00 00 00 00 00
The first four bytes are said disk signature. (In other keys, these bytes may appear in reverse order from that found in the MBR sector.) These are followed by eight more bytes, forming a 64-bit integer, in
little-endian
In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most si ...
notation, which are used to locate the byte offset of this partition. In this case, corresponds to the hexadecimal value (). Under the assumption that the drive in question reports a sector size of 512 bytes, then dividing this byte offset by 512 results in 63, which is the physical sector number (or LBA) containing the first sector of the partition (unlike the ''sector count'' used in the sectors value of CHS tuples, which counts from one, the absolute or LBA sector value starts
counting from ''zero'').
If this disk had another partition with the values following the disk signature (under, e.g., the key value
\DosDevices\D:
), it would begin at byte offset (), which is also the first byte of physical sector .
Starting with
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
, the disk signature is also stored in the
Boot Configuration Data
The booting process of Windows Vista and later versions differ from the startup process part of previous versions of Windows.
In this article, unless otherwise specified, what is said about Windows Vista also applies to all later NT operatin ...
(BCD) store, and the boot process depends on it.
If the disk signature changes, cannot be found or has a conflict, Windows is unable to boot.
Unless Windows is forced to use the overlapping part of the LBA address of the Advanced Active Partition entry as pseudo-disk signature, Windows' usage is conflictive with the Advanced Active Partition feature of PTS-DOS 7 and DR-DOS 7.07, in particular if their boot code is located outside the first 8 GB of the disk, so that LBA addressing must be used.
Programming considerations
The MBR originated in the
PC XT
The IBM Personal Computer XT (model 5160, often shortened to PC/XT) is the second computer in the IBM Personal Computer line, released on March 8, 1983. Except for the addition of a built-in hard drive and extra expansion slots, it is very simila ...
.
IBM PC-compatible
IBM PC compatible computers are similar to the original IBM PC, XT, and AT, all from computer giant IBM, that are able to use the same software and expansion cards. Such computers were referred to as PC clones, IBM clones or IBM PC clones. ...
computers are
little-endian
In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most si ...
, which means the
processor
Processor may refer to:
Computing Hardware
* Processor (computing)
**Central processing unit (CPU), the hardware within a computer that executes a program
*** Microprocessor, a central processing unit contained on a single integrated circuit (I ...
stores numeric values spanning two or more bytes in memory
least significant byte
In computing, bit numbering is the convention used to identify the bit positions in a binary number.
Bit significance and indexing
In computing, the least significant bit (LSB) is the bit position in a binary integer representing the binary 1 ...
first. The format of the MBR on media reflects this convention. Thus, the MBR signature will appear in a
disk editor
A disk editor is a computer program that allows its user to read, edit, and write raw data (at character or hexadecimal, byte-levels) on disk drives (e.g., hard disks, USB flash disks or removable media such as a floppy disks); as such, they ...
as the sequence
55 AA
.
The bootstrap sequence in the BIOS will load the first valid MBR that it finds into the computer's
physical memory
Computer data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processing unit (CPU) of a computer ...
at
address
An address is a collection of information, presented in a mostly fixed format, used to give the location of a building, apartment, or other structure or a plot of land, generally using political boundaries and street names as references, along w ...
:.
The last instruction executed in the BIOS code will be a "jump" to that address in order to direct execution to the beginning of the MBR copy. The primary validation for most BIOSes is the signature at offset , although a BIOS implementer may choose to include other checks, such as verifying that the MBR contains a valid partition table without entries referring to sectors beyond the reported capacity of the disk.
To the BIOS, removable (e.g. floppy) and fixed disks are essentially the same. For either, the BIOS reads the first physical sector of the media into RAM at absolute address , checks the signature in the last two bytes of the loaded sector, and then, if the correct signature is found, transfers control to the first byte of the sector with a jump (JMP) instruction. The only real distinction that the BIOS makes is that (by default, or if the boot order is not configurable) it attempts to boot from the first removable disk before trying to boot from the first fixed disk. From the perspective of the BIOS, the action of the MBR loading a volume boot record into RAM is exactly the same as the action of a floppy disk volume boot record loading the object code of an operating system loader into RAM. In either case, the program that the BIOS loaded is going about the work of chain loading an operating system.
While the MBR
boot sector code expects to be loaded at physical address :, all the memory from physical address : (address : is the last one used by a Phoenix BIOS)
to :,
later relaxed to :
(and sometimes up to :)the end of the first 640
KBis available in real mode. The
INT 12h
BIOS interrupt call
BIOS interrupt calls are a facility that operating systems and application programs use to invoke the facilities of the Basic Input/Output System firmware on IBM PC compatible computers. Traditionally, BIOS calls are mainly used by DOS programs a ...
may help in determining how much memory can be allocated safely (by default, it simply reads the base memory size in KB from
segment:offset location :, but it may be hooked by other resident pre-boot software like BIOS overlays,
RPL code or viruses to reduce the reported amount of available memory in order to keep other boot stage software like boot sectors from overwriting them).
The last 66 bytes of the 512-byte MBR are reserved for the partition table and other information, so the MBR boot sector program must be small enough to fit within 446 bytes of memory or less.
The MBR code examines the partition table, selects a suitable partition and loads the program that will perform the next stage of the boot process, usually by making use of INT 13h
BIOS calls. The MBR bootstrap code loads and runs (a boot loader- or operating system-dependent)
volume boot record code that is located at the beginning of the "active" partition. The volume boot record will fit within a 512-byte sector, but it is safe for the MBR code to load additional sectors to accommodate boot loaders longer than one sector, provided they do not make any assumptions on what the sector size is. In fact, at least 1 KB of RAM is available at address in every IBM XT- and AT-class machine, so a 1 KB sector could be used with no problem. Like the MBR, a volume boot record normally expects to be loaded at address :. This derives from the fact that the volume boot record design originated on unpartitioned media, where a volume boot record would be directly loaded by the BIOS boot procedure; as mentioned above, the BIOS treats MBRs and volume boot records (VBRs) exactly alike. Since this is the same location where the MBR is loaded, one of the first tasks of an MBR is to
relocate itself somewhere else in memory. The relocation address is determined by the MBR, but it is most often : (for MS-DOS/PC DOS, OS/2 and Windows MBR code) or : (most DR-DOS MBRs). (Even though both of these segmented addresses resolve to the same physical memory address in real mode, for
Apple Darwin
Darwin is an open-source Unix operating system first released by Apple Inc. in 2000. It is composed of code derived from NeXTSTEP, BSD, Mach, and other free software projects' code, as well as code developed by Apple.
Darwin forms the Unix ...
to boot, the MBR must be relocated to : instead of :, since the code depends on the DS:SI pointer to the partition entry provided by the MBR, but it erroneously refers to it via :SI only.
) It is important not to relocate to other addresses in memory because many
VBRs will assume a certain standard memory layout when loading their boot file.
The ''Status'' field in a partition table record is used to indicate an active partition. Standard-conformant MBRs will allow only one partition marked active and use this as part of a sanity-check to determine the existence of a valid partition table. They will display an error message, if more than one partition has been marked active. Some non-standard MBRs will not treat this as an error condition and just use the first marked partition in the row.
Traditionally, values other than (not active) and (active) were invalid and the bootstrap program would display an error message upon encountering them. However, the
Plug and Play BIOS Specification
The term Legacy Plug and Play, also shortened to Legacy PnP, describes a series of specifications and Microsoft Windows features geared towards operating system configuration of devices, and some device IDs are assigned by Unified EFI Forum, UE ...
and
BIOS Boot Specification
An Option ROM for the PC platform (i.e. the IBM PC and derived successor computer systems) is a piece of firmware that resides in ROM on an expansion card (or stored along with the main system BIOS), which gets executed to initialize the device ...
(BBS) allowed other devices to become bootable as well since 1994.
Consequently, with the introduction of MS-DOS 7.10 (Windows 95B) and higher, the MBR started to treat a set bit 7 as active flag and showed an error message for values .. only. It continued to treat the entry as physical drive unit to be used when loading the corresponding partition's VBR later on, thereby now also accepting other boot drives than as valid, however, MS-DOS did not make use of this extension by itself. Storing the actual physical drive number in the partition table does not normally cause backward compatibility problems, since the value will differ from ''only'' on drives other than the first one (which have not been bootable before, anyway). However, even with systems enabled to boot off other drives, the extension may still not work universally, for example, after the BIOS assignment of physical drives has changed when drives are removed, added or swapped. Therefore, per the
BIOS Boot Specification
An Option ROM for the PC platform (i.e. the IBM PC and derived successor computer systems) is a piece of firmware that resides in ROM on an expansion card (or stored along with the main system BIOS), which gets executed to initialize the device ...
(BBS),
it is best practice for a modern MBR accepting bit 7 as active flag to pass on the DL value originally provided by the BIOS instead of using the entry in the partition table.
BIOS to MBR interface
The MBR is loaded at memory location : and with the following
CPU
A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, and ...
registers set up when the prior bootstrap loader (normally the
IPL
The Indian Premier League (IPL), also known as TATA IPL for sponsorship reasons, is a men's T20 franchise cricket league of India. It is annually contested by ten teams based out of seven Indian cities and three Indian states. The leagu ...
in the BIOS) passes execution to it by jumping to : in the CPU's
real mode
Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory. Real mode is characterized by a 20-bit seg ...
.
*
CS:
IP = : (fixed)
: Some Compaq BIOSes erroneously use : instead. While this resolves to the same location in real mode memory, it is non-standard and should be avoided, since MBR code assuming certain register values or not written to be relocatable may not work otherwise.
*
: DL is supported by IBM BIOSes as well as most other BIOSes. The Toshiba T1000 BIOS is known not to support this properly, and some old Wyse 286 BIOSes use DL values greater or equal to 2 for fixed disks (thereby reflecting the logical drive numbers under DOS rather than the physical drive numbers of the BIOS). USB sticks configured as removable drives typically get an assignment of DL = , , etc. However, some rare BIOSes erroneously presented them under DL = , just as if they were configured as superfloppies.
: A standard conformant BIOS assigns numbers greater or equal to exclusively to fixed disk / removable drives, and traditionally only values and were passed on as physical drive units during boot. By convention, only fixed disks / removable drives are partitioned, therefore, the only DL value a MBR could see traditionally was . Many MBRs were coded to ignore the DL value and work with a hard-wired value (normally ), anyway.
: The
Plug and Play BIOS Specification
The term Legacy Plug and Play, also shortened to Legacy PnP, describes a series of specifications and Microsoft Windows features geared towards operating system configuration of devices, and some device IDs are assigned by Unified EFI Forum, UE ...
and
BIOS Boot Specification
An Option ROM for the PC platform (i.e. the IBM PC and derived successor computer systems) is a piece of firmware that resides in ROM on an expansion card (or stored along with the main system BIOS), which gets executed to initialize the device ...
(BBS) allow other devices to become bootable as well since 1994.
The later recommends that MBR and VBR code should use DL rather than internally hardwired defaults.
This will also ensure compatibility with various non-standard assignments (see examples above), as far as the MBR code is concerned.
: Bootable CD-ROMs following the
El Torito
El Torito (Spanish for "the little bull") is an American chain that serves Mexican food. El Torito operates 69 restaurants primarily in California.[Protected Area Run Time Interface Extension Services
The host protected area (HPA) is an area of a hard drive or solid-state drive that is not normally visible to an operating system. It was first introduced in the ATA-4 standard CXV (T13) in 2001.
How it works
The IDE controller has registers ...](_blank)
(PARTIES) and
Trusted Computing Group
The Trusted Computing Group is a group formed in 2003 as the successor to the Trusted Computing Platform Alliance which was previously formed in 1999 to implement Trusted Computing concepts across personal computers. Members include Intel, AMD, I ...
(TCG) BIOS extensions in Trusted mode to access otherwise invisible PARTIES partitions, disk image files located via the
Boot Engineering Extension Record
The host protected area (HPA) is an area of a hard drive or solid-state drive that is not normally visible to an operating system. It was first introduced in the ATA-4 standard CXV (T13) in 2001.
How it works
The IDE controller has registers ...
(BEER) in the last physical sector of a hard disk's
Host Protected Area
The host protected area (HPA) is an area of a hard drive or solid-state drive that is not normally visible to an operating system. It was first introduced in the ATA-4 standard CXV (T13) in 2001.
How it works
The IDE controller has registers ...
(HPA). While designed to emulate floppies or superfloppies, MBR code accepting these non-standard DL values allows to use images of partitioned media at least in the boot stage of operating systems.
*
DH bit 5 = 0: device supported through
INT 13h
INT 13h is shorthand for BIOS interrupt call 13 hex, the 20th interrupt vector in an x86-based (IBM PC-descended) computer system. The BIOS typically sets up a real mode interrupt handler at this vector that provides sector-based hard disk an ...
; else: don't care (should be zero). DH is supported by some IBM BIOSes.
* Some of the other registers may typically also hold certain register values (DS, ES, SS = ; SP = ) with original IBM ROM BIOSes, but this is nothing to rely on, as other BIOSes may use other values. For this reason, MBR code by IBM, Microsoft, Digital Research, etc. never did take any advantage of it. Relying on these register values in boot sectors may also cause problems in chain-boot scenarios.
Systems with
Plug-and-Play
In computing, a plug and play (PnP) device or computer bus is one with a specification that facilitates the recognition of a hardware component in a system without the need for physical device configuration or user intervention in resolving resou ...
BIOS or BBS support will provide a pointer to PnP data in addition to DL:
* DL = boot drive unit (see above)
*
ES:
DI = points to "
$PnP
" installation check structure
: This information allows the boot loader in the MBR (or VBR, if passed on) to actively interact with the BIOS or a resident PnP / BBS BIOS overlay in memory in order to configure the boot order, etc., however, this information is ignored by most standard MBRs and VBRs. Ideally, ES:DI is passed on to the VBR for later use by the loaded operating system, but PnP-enabled operating systems typically also have fallback methods to retrieve the PnP BIOS entry point later on so that most operating systems do not rely on this.
MBR to VBR interface
By convention, a standard conformant MBR passes execution to a successfully loaded VBR, loaded at memory location :, by jumping to : in the CPU's real mode with the following registers maintained or specifically set up:
* CS:IP = : (constant)
* DL = boot drive unit (see above)
: MS-DOS 2.0-7.0 / PC DOS 2.0-6.3 MBRs do not pass on the DL value received on entry, but they rather use the boot status entry in the partition table entry of the selected primary partition as physical boot drive unit. Since this is, by convention, in most MBR partition tables, it won't change things unless the BIOS attempted to boot off a physical device other than the first fixed disk / removable drive in the row. This is also the reason why these operating systems cannot boot off a second hard disk, etc. Some FDISK tools allow to mark partitions on secondary disks as "active" as well. In this situation, knowing that these operating systems cannot boot off other drives anyway, some of them continue to use the traditionally fixed value of as active marker, whereas others use values corresponding with the currently assigned physical drive unit (, ), thereby allowing booting from other drives, at least in theory. In fact, this will work with many MBR codes, which take a set bit 7 of the boot status entry as active flag rather than insisting on , however, MS-DOS/PC DOS MBRs are hard-wired to accept the fixed value of only. Storing the actual physical drive number in the partition table will also cause problems, when the BIOS assignment of physical drives changes, for example when drives are removed, added or swapped. Therefore, for a normal MBR accepting bit 7 as active flag and otherwise just using and passing on to the VBR the DL value originally provided by the BIOS allows for maximum flexibility. MS-DOS 7.1 - 8.0 MBRs have changed to treat bit 7 as active flag and any values .. as invalid, but they still take the physical drive unit from the partition table rather than using the DL value provided by the BIOS. DR-DOS 7.07 extended MBRs treat bit 7 as active flag and use and pass on the BIOS DL value by default (including non-standard values .. used by some BIOSes also for partitioned media), but they also provide a special
NEWLDR
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 MBR ...
configuration block in order to support alternative boot methods in conjunction with LOADER and REAL/32 as well as to change the detail behaviour of the MBR, so that it can also work with drive values retrieved from the partition table (important in conjunction with LOADER and AAPs, see NEWLDR offset
0x000C
), translate Wyse non-standard drive units .. to .., and optionally fix up the drive value (stored at offset
0x019
in the
Extended BIOS Parameter Block
In computing, the BIOS parameter block, often shortened to BPB, is a data structure in the volume boot record (VBR) describing the physical layout of a Computer data storage, data storage Volume (computing), volume. On partitioned devices, such a ...
(EBPB) or at sector offset
0x01FD
) in loaded VBRs before passing execution to them (see NEWLDR offset
0x0014
)—this also allows other boot loaders to use NEWLDR as a chain-loader, configure its in-memory image on the fly and "tunnel" the loading of VBRs, EBRs, or AAPs through NEWLDR.
* The contents of DH and ES:DI should be preserved by the MBR for full Plug-and-Play support (see above), however, many MBRs, including those of MS-DOS 2.0 - 8.0 / PC DOS 2.0 - 6.3 and Windows NT/2000/XP, do not. (This is unsurprising, since those versions of DOS predate the Plug-and-Play BIOS standard, and previous standards and conventions indicated no requirements to preserve any register other than DL.) Some MBRs set DH to 0.
The MBR code passes additional information to the VBR in many implementations:
* DS:SI = points to the 16-byte
MBR partition table
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 MB ...
entry (in the relocated MBR) corresponding with the activated VBR.
PC-MOS
PC-MOS/386 is a multi-user, multitasking computer operating system produced by The Software Link (TSL), announced at COMDEX in November 1986 for February 1987 release. PC-MOS/386, a successor to PC-MOS, can run many MS-DOS programs on the host ...
5.1 depends on this to boot if no partition in the partition table is flagged as bootable. In conjunction with LOADER,
Multiuser DOS
Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers.
An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
and
REAL/32
Multiuser DOS is a real-time multi-user multi-tasking operating system for IBM PC-compatible microcomputers.
An evolution of the older Concurrent CP/M-86, Concurrent DOS and Concurrent DOS 386 operating systems, it was originally developed by ...
boot sectors use this to locate the boot sector of the active partition (or another bootstrap loader like IBMBIO.LDR at a fixed position on disk) if the boot file (LOADER.SYS) could not be found.
PTS-DOS
PTS-DOS (aka PTS/DOS) is a disk operating system, a DOS clone, developed in Russia by PhysTechSoft and Paragon Technology Systems.
History and versions
PhysTechSoft was formed in 1991 in Moscow, Russia by graduates and members of MIPT, infor ...
6.6 and
S/DOS 1.0 use this in conjunction with their
Advanced Active Partition
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 M ...
(AAP) feature. In addition to support for LOADER and AAPs, DR-DOS 7.07 can use this to determine the necessary INT 13h access method when using its dual CHS/LBA VBR code and it will update the boot drive / status flag field in the partition entry according to the effectively used DL value.
Darwin bootloaders (Apple's
boot1h
,
boot1u
, and David Elliott's
boot1fat32
) depend on this pointer as well, but additionally they don't use DS, but assume it to be set to instead.
This will cause problems if this assumption is incorrect. The MBR code of OS/2, MS-DOS 2.0 to 8.0, PC DOS 2.0 to 7.10 and Windows NT/2000/XP provides this same interface as well, although these systems do not use it. The Windows Vista/7 MBRs no longer provide this DS:SI pointer. While some extensions only depend on the 16-byte partition table entry itself, other extensions may require the whole 4 (or 5 entry) partition table to be present as well.
* DS:
BP = optionally points to the 16-byte
MBR partition table
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 MB ...
entry (in the relocated MBR) corresponding with the activated VBR. This is identical to the pointer provided by DS:SI (see above) and is provided by MS-DOS 2.0-8.0, PC DOS 2.0-7.10, Windows NT/2000/XP/Vista/7 MBRs. It is, however, not supported by most third-party MBRs.
Under DR-DOS 7.07 an extended interface may be optionally provided by the extended MBR and in conjunction with LOADER:
*
AX = magic signature indicating the presence of this NEWLDR extension ()
* DL = boot drive unit (see above)
* DS:SI = points to the 16-byte
MBR partition table
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 MB ...
entry used (see above)
* ES:
BX = start of boot sector or NEWLDR sector image (typically )
*
CX = reserved
In conjunction with GPT, an ''
Enhanced Disk Drive Specification
A master boot record (MBR) is a special type of boot sector at the very beginning of disk partitioning, partitioned computer mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems and beyond. Th ...
'' (EDD) 4
Hybrid MBR
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 i ...
proposal recommends another extension to the interface:
*
EAX = ("
!GPT
")
* DL = boot drive unit (see above)
* DS:SI = points to a Hybrid MBR handover structure, consisting of a 16-byte dummy
MBR partition table
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 MB ...
entry (with all bits set except for the boot flag at offset and the
partition type
The partition type (or partition ID) 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 thes ...
at offset ) followed by additional data. This is partially compatible with the older DS:SI extension discussed above, if only the 16-byte partition entry, not the whole partition table is required by these older extensions.
: Since older operating systems (including their VBRs) do not support this extension nor are they able to address sectors beyond the 2 TiB barrier, a GPT-enabled hybrid boot loader should still emulate the 16-byte dummy MBR partition table entry if the boot partition is located within the first 2 TiB.
* ES:DI = points to "
$PnP
" installation check structure (see above)
Editing and replacing contents
Though it is possible to manipulate the
byte
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
s in the MBR sector directly using various
disk editor
A disk editor is a computer program that allows its user to read, edit, and write raw data (at character or hexadecimal, byte-levels) on disk drives (e.g., hard disks, USB flash disks or removable media such as a floppy disks); as such, they ...
s, there are tools to write fixed sets of functioning code to the MBR. Since MS-DOS 5.0, the program
FDISK
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 FreeBS ...
has included the switch
/MBR
, which will rewrite the MBR code.
Under
Windows 2000
Windows 2000 is a major release of the Windows NT operating system developed by Microsoft and oriented towards businesses. It was the direct successor to Windows NT 4.0, and was Software release life cycle#Release to manufacturing (RTM), releas ...
and
Windows XP
Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
, the
Recovery Console
The Recovery Console is a feature of the Windows 2000, Windows XP and Windows Server 2003 operating systems. It provides the means for administrators to perform a limited range of tasks using a command-line interface.
Its primary function is to ...
can be used to write new MBR code to a storage device using its
fixmbr
command. Under
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
and
Windows 7
Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on July 22, 2009, and became generally available on October 22, 2009. It is the successor to Windows Vista, released nearly ...
, the
Recovery Environment
Windows Preinstallation Environment (also known as Windows PE and WinPE) is a lightweight version of Windows used for the deployment of PCs, workstations, and servers, or troubleshooting an operating system while it is offline. It is intended t ...
can be used to write new MBR code using the
BOOTREC /FIXMBR
command.
Some third-party utilities may also be used for directly editing the contents of partition tables (without requiring any knowledge of hexadecimal or disk/sector editors), such as
MBRWizard.
dd
is a POSIX command commonly used to read or write any location on a storage device, MBR included. In
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
, ms-sys may be used to install a Windows MBR. The
GRUB
Grub can refer to Grub (larva), of the beetle superfamily Scarabaeoidea, or as a slang term for food. It can also refer to:
Places
* Grub, Appenzell Ausserrhoden, Switzerland
* Grub, St. Gallen, Switzerland
* Grub (Amerang), a hamlet in Bavaria, ...
and
LILO projects have tools for writing code to the MBR sector, namely
grub-install
and
lilo -mbr
. The GRUB Legacy interactive console can write to the MBR, using the
setup
and
embed
commands, but GRUB2 currently requires
grub-install
to be run from within an operating system.
Various programs are able to create a "
backup
In information technology, a backup, or data backup is a copy of computer data taken and stored elsewhere so that it may be used to restore the original after a data loss event. The verb form, referring to the process of doing so, is "back up", w ...
" of both the primary partition table and the logical partitions in the extended partition.
Linux
sfdisk
(on a
SystemRescueCD
SystemRescue (Previously known as "SystemRescueCD") is a Linux distribution for x86 64 and x86 computers. The primary purpose of SystemRescue is to repair unbootable or otherwise damaged computer systems after a system crash. SystemRescue is ...
) is able to save a backup of the primary and extended partition table. It creates a file that can be read in a text editor, or this file can be used by sfdisk to restore the primary/extended partition table. An example command to back up the partition table is
sfdisk -d /dev/hda > hda.out
and to restore is
sfdisk /dev/hda < hda.out
. It is possible to copy the partition table from one disk to another this way, useful for setting up mirroring, but sfdisk executes the command without prompting/warnings using
sfdisk -d /dev/sda , sfdisk /dev/sdb
.
See also
*
Extended boot record
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 (and only one) partition record entry in the master boot ...
(EBR)
*
Volume boot record (VBR)
*
GUID Partition Table
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 i ...
(GPT)
*
BIOS Boot partition
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 ...
*
EFI System partition
*
Boot engineering extension record
The host protected area (HPA) is an area of a hard drive or solid-state drive that is not normally visible to an operating system. It was first introduced in the ATA-4 standard CXV (T13) in 2001.
How it works
The IDE controller has registers ...
(BEER)
*
Host protected area
The host protected area (HPA) is an area of a hard drive or solid-state drive that is not normally visible to an operating system. It was first introduced in the ATA-4 standard CXV (T13) in 2001.
How it works
The IDE controller has registers ...
(HPA)
*
Device configuration overlay
Device configuration overlay (DCO) is a hidden area on many of today's hard disk drives (HDDs). Usually when information is stored in either the DCO or host protected area (HPA), it is not accessible by the BIOS (or UEFI), OS, or the user. However ...
(DCO)
*
Apple partition map (APM)
*
Amiga rigid disk block
In computing, a rigid disk block (RDB) is the block on a hard disk where the Amiga series of computers store the disk's partition and filesystem information. The IBM's PC equivalent of the Amiga's RDB is the master boot record (MBR).
Unlike it ...
(RDB)
*
Volume Table of Contents In the IBM System/360Including the successors S/370 through z/Architecture storage architecture, the Volume Table of Contents (VTOC), is a data structure that provides a way of locating the data sets that reside on a particular DASD volume. With th ...
(VTOC)
*
BSD disklabel
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 ...
*
Boot loader
A bootloader, also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is responsible for booting a computer.
When a computer is turned off, its softwareincluding operating systems, application code, a ...
*
Disk cloning Disk cloning is the process of creating a 1-to-1 copy of a hard disk drive (HDD) or solid-state drive (SSD), not just its files. Disk cloning may be used for upgrading a disk or replacing an aging disk with a fresh one. In this case, the clone can r ...
*
Recovery disc
The terms Recovery disc (or Disk), Rescue Disk/Disc and Emergency Disk all refer to a capability to boot from an external device, possibly a thumb drive, that includes a self-running operating system: the ability to be a boot disk/Disc that runs i ...
*
GNU Parted
GNU Parted (the name being the conjunction of the two words PARTition and EDitor) is a free partition editor, used for creating and deleting partitions. This is useful for creating space for new operating systems, reorganising hard disk usage, co ...
*
Partition alignment Partition alignment is the proper alignment of partitions to the boundaries available in a data storage device.
Examples include the following:
* 4 KB sector alignment with hard disk drives supporting Advanced Format (AF)
* Track partition al ...
Notes
References
Further reading
*
*
*
*
External links
Article on master boot recordThe MBR and how it fits into the BIOS boot process
{{Firmware and booting
BIOS
Booting
Disk partitions