Content deleted Content added
Adónde Tags: Reverted Mobile edit Mobile web edit |
removed weasel word, clarified Tags: Mobile edit Mobile web edit |
||
(16 intermediate revisions by 12 users not shown) | |||
Line 2:
{{About|an IBM PC-specific type of boot sector on partitioned media|the first sector on non-partitioned media|volume boot record}}
{{Use dmy dates|date=April 2019|cs1-dates=y}}
{{Use list-defined references|date=January 2022}}
A '''master boot record''' ('''MBR''') is a type of [[boot sector]] in the first few blocks of [[disk partitioning|partitioned]] computer [[mass storage device]]s like [[fixed disk]]s or [[removable drive]]s intended for use with [[IBM PC-compatible]] systems and beyond. The concept of MBRs was publicly introduced in 1983 with [[PC DOS 2.0]].
The MBR holds the information on how the disc's sectors (aka “blocks”) 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.<ref name="FOLDOC"/>▼
▲The MBR holds the information on how the disc's sectors (aka
The organization of the partition table in the MBR limits the maximum addressable storage space of a partitioned disk to 2 [[Tebibyte|TiB]] {{nowrap|(2<sup>32</sup> × 512 bytes)}}.<ref name="Microsoft_2013_2581408"/> Approaches to slightly raise this limit utilizing 32-bit arithmetic or 4096-byte sectors are not officially supported, as they fatally break compatibility with existing boot loaders, most MBR-compliant operating systems and associated system tools, and may 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]] (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 [[floppy|floppies]], [[superfloppy|superfloppies]] or other storage devices configured to behave as such,
== {{Anchor|DISK-TIMESTAMPS}}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]] of the then-new [[IBM Personal Computer XT]], still using the [[FAT12]] 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''
In 1996, support for [[logical block addressing]] (LBA) was introduced in Windows 95B and MS-DOS 7.10 (Not to be confused with IBM PC-DOS 7.1) in order to support disks larger than 8 GB. ''Disk timestamps'' were also introduced.<ref name="Sedory_2004_Timestamp"/><!-- TBD: Recheck, if MBR LBA support was really added with 95B/7.1 only, since LBA support in general was added with 95A/7.0 in 1995 already IIRC. --> 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 [[cylinder-head-sector|CHS]] access for [[FAT16B]] and [[FAT32]] partition types [[Partition type#PID 06h|{{mono|0x06}}]]/[[Partition type#PID 0Bh|{{mono|0x0B}}]], whereas LBA is used for [[Partition type#PID 0Eh|{{mono|0x0E}}]]/[[Partition type#PID 0Ch|{{mono|0x0C}}]].
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]] standards for bootstrapping and partitioning.<ref name="Lucas_2003_OpenBSD"/>
Line 175 ⟶ 178:
|-
| style="text-align:center" | {{anchor|MBRAAP_OFS_1AEh}}<code>0x01AE</code> (430)
| style="text-align:center; background:#F2F2F2" | AAP physical drive (<code>0x80</code>
| rowspan="6" style="vertical-align:middle; text-align:center; background:#F2F2F2" | ''AAP record'' (optional) (AAP [[#PTE|partition entry]] #0 with special semantics)
| style="text-align:center" | 1
Line 247 ⟶ 250:
|-
| style="text-align:center" | {{anchor|NEWLDR_OFS_008h}}<code>0x0008</code> (8)
| style="text-align:center; background:#F2F2F2" | LOADER physical drive and boot flag (<code>0x80</code>
| style="text-align:center" | 1
|-
Line 259 ⟶ 262:
|-
| style="text-align:center" | {{anchor|NEWLDR_OFS_00Dh}}<code>0x000D</code> (13)
| style="text-align:center; background:#F2F2F2" | Reserved (default: <code>0x000000</code>)<!-- Already used, but it is
| style="text-align:center" | 3
|-
Line 604 ⟶ 607:
|}
|-
| {{anchor|PTE_OFS_8h}}{{mono|0x08}} || || 4 bytes || [[logical block addressing|LBA]] of first absolute sector in the partition{{Efn|name="note-4"|
|-
| {{anchor|PTE_OFS_Ch}}{{mono|0x0C}} || || 4 bytes || Number of sectors in partition{{Efn|name="note-
|}
Line 624 ⟶ 627:
== System bootstrapping ==
On [[IBM PC-compatible]] computers, the [[bootstrapping]] [[firmware]] (contained within the [[read-only memory|ROM]] [[BIOS]]) loads and executes the master boot record.<ref name="OSDev_2011_MBR"/> The [[PC XT|PC/XT (type 5160)]] used an [[Intel 8088]] [[Computer processor|microprocessor]]. In order to remain compatible, all x86 BIOS architecture systems start with the microprocessor in an [[X86#Operating modes|operating mode]] referred to as [[real mode]]. The BIOS reads the MBR from the storage device into [[physical memory]], and then it directs the microprocessor to the start of the boot code.
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]].
Line 677 ⟶ 680:
* [[CS register|CS]]:[[IP register|IP]] = {{mono|0x0000}}:{{mono|0x7C00}} (fixed)
: Some Compaq BIOSes erroneously use {{mono|0x07C0}}:{{mono|0x0000}} 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 = {{mono|0x80}}, {{mono|0x81}}, etc. However, some rare BIOSes<!-- In ca. 2002-2003. --> erroneously presented them under DL = {{mono|0x01}}, just as if they were configured as superfloppies.
: A standard conformant BIOS assigns numbers greater or equal to {{mono|0x80}} exclusively to fixed disk / removable drives, and traditionally only values {{mono|0x80}} and {{mono|0x00}} 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 {{mono|0x80}}. Many MBRs were coded to ignore the DL value and work with a hard-wired value (normally {{mono|0x80}}), anyway.
Line 695 ⟶ 698:
* CS:IP = {{mono|0x0000}}:{{mono|0x7C00}}{{efn|name="NB_CS-IP"}} (constant)
* DL = boot drive unit (see above)
: MS-DOS 2.
* 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.
The MBR code passes additional information to the VBR in many implementations:
* DS:SI = points to the 16-byte [[MBR partition table]] entry (in the relocated MBR) corresponding with the activated VBR. [[PC-MOS]] 5.1 depends on this to boot if no partition in the partition table is flagged as bootable. In conjunction with LOADER, [[Multiuser DOS]] and [[REAL/32]] 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]] 6.6<!-- TBD: not sure about 6.5x right now. --> and [[S/DOS]] 1.0 use this in conjunction with their [[Advanced Active Partition]] (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. [[Apple Darwin|Darwin]] bootloaders (Apple's <code>boot1h</code>, <code>boot1u</code>, and David Elliott's <code>boot1fat32</code>) depend on this pointer as well, but additionally they don't use DS, but assume it to be set to {{mono|0x0000}} instead.<ref name="Elliott_2009_Darwin"/> This will cause problems if this assumption is incorrect. The MBR code of OS/2<!-- TBD: Recheck! -->, MS-DOS 2.0 to 8.0, PC
* DS:[[BP register|BP]] = optionally points to the 16-byte [[MBR partition table]] 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.
Under DR-DOS 7.07 an extended interface may be optionally provided by the extended MBR and in conjunction with LOADER:
Line 802 ⟶ 805:
<ref name="Microsoft_2013_2581408">{{cite web |title=Windows support for hard disks that are larger than 2 TB |publisher=[[Microsoft]] |date=2013-06-26 |id=2581408 |version=1 |url=http://support.microsoft.com/kb/2581408 |access-date=2013-08-28 |url-status=live |archive-url=https://web.archive.org/web/20170427084734/https://support.microsoft.com/en-us/help/2581408/windows-support-for-hard-disks-that-are-larger-than-2-tb |archive-date=2017-04-27}}</ref>
<ref name="Superuser_2013">{{cite web |title=More than 2 TiB on a MBR disk |date=2013-03-07 |publisher=superuser.com |url=http://superuser.com/questions/562331/mbr-partition-with-more-than-2-tb |access-date=2013-10-22 |url-status=live |archive-url=https://web.archive.org/web/20170824122749/https://superuser.com/questions/562331/mbr-partition-with-more-than-2-tb |archive-date=2017-08-24}}</ref>
<!-- <ref name="FOLDOC">{{cite web |author-first=Denis |author-last=Howe |title=master boot record |website=[[FOLDOC]] |date=2009-05-19 |orig-date=1985 |url=http://foldoc.org/master+boot+record |access-date=2015-05-02 |url-status=dead |archive-url=https://web.archive.org/web/20170824002628/https://foldoc.org/master%20boot%20record |archive-date=24 August 2017 }}</ref>-->
<ref name="osdev">{{cite web |title=Partition Table |publisher=osdev.org |date=2017-03-18 |orig-date=2007-03-06 |url=http://wiki.osdev.org/Partition_Table |access-date=2017-08-24 |url-status=live |archive-url=https://web.archive.org/web/20170824123235/http://wiki.osdev.org/Partition_Table |archive-date=2017-08-24}}</ref>
<ref name="Paul_1997">{{cite web |author-first=Matthias R. |author-last=Paul |title=Caldera OpenDOS 7.01/7.02 Update Alpha 3 IBMBIO.COM - README.TXT and BOOT.TXT - A short description of how OpenDOS is booted |url=http://www.uni-bonn.de/~uzs180/download/ibmbioa3.zip |date=1997-10-02 |orig-date=1997-09-29 |access-date=2009-03-29 |url-status=dead |archive-url=https://web.archive.org/web/20031004074600/http://www-student.informatik.uni-bonn.de/~frinke/ibmbioa3.zip |archive-date=2003-10-04}} [https://web.archive.org/web/20181225154705/http://mirror.macintosharchive.org/max1zzz.co.uk/+Windows%20&%20DOS/DOS/System/Novell/Support/Bins/Op702src.zip<!-- Op702src.zip is an unofficial renamed distribution of the ibmbioa3.zip file -->]</ref>
<ref name="Paul_2017">{{cite web |title=The continuing saga of Windows 3.1 in enhanced mode on OmniBook 300 |author-first=Matthias R. |author-last=Paul |orig-date=2017-08-07 |date=2017-08-14 |work=MoHPC - the Museum of HP Calculators |url=http://hpmuseum.org/forum/thread-8774-post-77196.html#pid77196 |access-date=2018-05-01 |url-status=live |archive-url=https://web.archive.org/web/20180501185933/http://hpmuseum.org/forum/thread-8774-post-77196.html |archive-date=2018-05-01 |quote=[…] SYS […] /O[:nnn] Override IPL reported boot drive unit (n=0..126, 128..254). […] Preparing target disk... Choosing FAT12 CHS Boot Sector (requires IPL to report boot unit). Treating target as diskette or superfloppy medium (boot drive unit 0). Writing new Boot Sector... […]}} (NB. SYS writes [[volume boot record]]s rather than master boot records, but their incoming register interface is similar (with extensions) since they could both be loaded initially by the underlying system.)</ref>
}}
|