Misplaced Pages

Boot sector

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

A boot sector is the sector of a persistent data storage device (e.g., hard disk , floppy disk , optical disc , etc.) which contains machine code to be loaded into random-access memory (RAM) and then executed by a computer system 's built-in firmware (e.g., the BIOS ).

#3996

127-490: Usually, the first sector of the hard disk is the boot sector, regardless of sector size (512 or 4096 bytes) and partitioning flavor ( MBR or GPT ). The purpose of defining one particular sector as the boot sector is inter-operability between firmware and various operating systems. The purpose of chain loading first a firmware (e.g., the BIOS), then some code contained in the boot sector, and then, for example, an operating system,

254-589: A Forth interpreter, with much of the firmware being written in Forth. It was standardized by the IEEE as IEEE standard 1275-1994; firmware that implements that standard was used in PowerPC -based Macs and some other PowerPC-based machines, as well as Sun's own SPARC -based computers. The Advanced RISC Computing specification defined another firmware standard, which was implemented on some MIPS -based and Alpha -based machines and

381-650: 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 bytes located in

508-518: A 1 KB sector could be used with no problem. Like the MBR, a volume boot record normally expects to be loaded at address 0x0000 : 0x7C00 . 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

635-403: A 64-bit integer, in little-endian notation, which are used to locate the byte offset of this partition. In this case, 00 7E corresponds to the hexadecimal value 0x7E00 ( 32,256 ). 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

762-446: A VBR. If the device is a hard disk, that will be an MBR. It is the code in the MBR which generally understands disk partitioning, and in turn, is responsible for loading and running the VBR of whichever primary partition is set to boot (the active partition). The VBR then loads a second-stage bootloader from another location on the disk. Furthermore, whatever is stored in the first sector of

889-501: A Windows 2000/XP registry, is: If a disk's signature stored in the MBR was A8 E1 B9 D2 (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: 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

1016-613: A boot device and execute it. Firmware compatible with the BIOS on the IBM Personal Computer is used in IBM PC compatible computers. The UEFI was developed by Intel, originally for Itanium -based machines, and later also used as an alternative to the BIOS in x86 -based machines, including Apple Macs using Intel processors . Unix workstations originally had vendor-specific ROM-based firmware. Sun Microsystems later developed OpenBoot , later known as Open Firmware, which incorporated

1143-538: A cassette tape drive mounted on the front panel; this sets up a boot loader in RAM which is then executed. However, since this makes few assumptions about the system it can equally well be used to load diagnostic (Maintenance Test Routine) tapes which display an intelligible code on the front panel even in cases of gross CPU failure. In the IBM System/360 and its successors, including the current z/Architecture machines,

1270-465: A computer's central processing unit (CPU) has no software in its main memory , so some process must load software into memory before it can be executed. This may be done by hardware or firmware in the CPU, or by a separate processor in the computer system. Restarting a computer also is called rebooting , which can be "hard", e.g. after electrical power to the CPU is switched from off to on, or "soft", where

1397-559: A configuration of interconnecting cables. Bootstrapping did not apply to ENIAC, whose hardware configuration was ready for solving problems as soon as power was applied. The EDSAC system, the second stored-program computer to be built, used stepping switches to transfer a fixed program into memory when its start button was pressed. The program stored on this device, which David Wheeler completed in late 1948, loaded further instructions from punched tape and then executed them. The first programmable computers for commercial sale, such as

SECTION 10

#1732859437004

1524-458: A crash when the BIOS passes execution to the boot sector assuming that it contains valid executable code. Nevertheless, some media for other platforms erroneously contain the signature, anyway, rendering this check not 100% reliable in practice. The signature is checked for by most system BIOSes since (at least) the IBM PC/AT (but not by the original IBM PC and some other machines). Even more so, it

1651-400: A disk with a GPT, Intel's Extensible Firmware Interface 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 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,

1778-826: 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 (2  × 512 bytes) . 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,

1905-519: A floppy diskette, USB device, hard disk or any other bootable storage device, is not required to immediately load any bootstrap code for an OS, if ever. The BIOS merely passes control to whatever exists there, as long as the sector meets the very simple qualification of having the boot record signature of 0x55, 0xAA in its last two bytes. This is why it is easy to replace the usual bootstrap code found in an MBR with more complex loaders, even large multi-functional boot managers (programs stored elsewhere on

2032-716: A frequent occurrence with relatively low-cost, "part-time-duty" hardware, such as the Teletype Model 33 ASR. (Friden Flexowriters were far more reliable, but also comparatively costly.) The earliest microcomputers, such as the Altair 8800 (released first in 1975) and an even earlier, similar machine (based on the Intel 8008 CPU) had no bootstrapping hardware as such. When powered-up, the CPU would see memory that would contain random data. The front panels of these machines carried toggle switches for entering addresses and data, one switch per bit of

2159-702: A magnetic tape in a tape drive , or a magnetic drum unit, depending on the position of the Load Selector switch. The left 18-bit half-word was then executed as an instruction, which usually read additional words into memory. The loaded boot program was then executed, which, in turn, loaded a larger program from that medium into memory without further help from the human operator. The IBM 704 , IBM 7090 , and IBM 7094 had similar mechanisms, but with different load buttons for different devices. The term "boot" has been used in this sense since at least 1958. Other IBM computers of that era had similar features. For example,

2286-456: A new file system with DOS 3.0. Support for an extended partition , 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 some third-party implementations) throughout

2413-423: 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

2540-560: 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

2667-564: A printed circuit card, the M792, that plugged into the Unibus and held a 32 by 16 array of semiconductor diodes. With all 512 diodes in place, the memory contained all "one" bits; the card was programmed by cutting off each diode whose bit was to be "zero". DEC also sold versions of the card, the BM792-Yx series, pre-programmed for many standard input devices by simply omitting the unneeded diodes. Following

SECTION 20

#1732859437004

2794-512: A researcher at CSELT , included an (external) ROM. Gruppi Speciali was, starting from 1975, a fully single-button machine booting into the operating system from a ROM memory composed from semiconductors, not from ferrite cores. Although the ROM device was not natively embedded in the computer of Gruppi Speciali, due to the design of the machine, it also allowed the single-button ROM booting in machines not designed for that (therefore, this "bootstrap device"

2921-421: A short initial program into a computer. These methods reach from simple, physical input to removable media that can hold more complex programs. Early computers in the 1940s and 1950s were one-of-a-kind engineering efforts that could take weeks to program and program loading was one of many problems that had to be solved. An early computer, ENIAC , had no program stored in memory, but was set up for each problem by

3048-535: 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 . Popular MBR code programs were created for booting PC DOS and MS-DOS , and similar boot code remains in wide use. These boot sectors expect the FDISK partition table scheme to be in use and scans

3175-452: A special program to load the actual operating system or standalone utility into main storage, and for this specific purpose "IPL Text" is placed on the disk by the stand-alone DASDI (Direct Access Storage Device Initialization) program or an equivalent program running under an operating system, e.g., ICKDSF, but IPL-able tapes and card decks are usually distributed with this "IPL Text" already present. IBM introduced some evolutionary changes in

3302-427: A state of hibernation does. Minimally, some embedded systems do not require a noticeable boot sequence to begin functioning and when turned on may simply run operational programs that are stored in ROM. All computing systems are state machines , and a reboot may be the only method to return to a designated zero-state from an unintended, locked state. In addition to loading an operating system or stand-alone utility,

3429-493: A transition was made to using LBA, or logical block addressing . 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 ) bytes, and a broad range of important components including chipsets , boot sectors , operating systems , database engines , partitioning tools, backup and file system utilities and other software had this value hard-coded. Since

3556-572: 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 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

3683-606: Is also checked by most MBR boot loaders before passing control to the boot sector. Some BIOSes (like the IBM PC/AT) perform the check only for fixed disk/removable drives, while for floppies and superfloppies, it is enough to start with a byte greater or equal to 06h and the first nine words not to contain the same value, before the boot sector is accepted as valid, thereby avoiding the explicit test for 0x55 , 0xAA on floppies. Since old boot sectors (e.g., very old CP/M-86 and DOS media) sometimes do not feature this signature despite

3810-408: 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

3937-650: Is by convention indicated by a two-byte hexadecimal sequence 0x55 0xAA (called the boot sector signature) at the end of the boot sector (offsets 0x1FE and 0x1FF ). This signature indicates the presence of at least a dummy boot loader which is safe to be executed, even if it may not be able actually to load an operating system. It does not indicate a particular (or even the presence of) file system or operating system, although some old versions of DOS 3 relied on it in their process to detect FAT -formatted media (newer versions do not). Boot code for other platforms or CPUs should not use this signature, since this may lead to

Boot sector - Misplaced Pages Continue

4064-461: Is called a first-stage boot loader, and the program it loads is called a second-stage boot loader. On many embedded CPUs, the CPU built-in boot ROM , sometimes called the zero-stage boot loader, can find and load first-stage boot loaders. Examples of first-stage (hardware initialization stage) boot loaders include BIOS , UEFI , coreboot , Libreboot and Das U-Boot . On the IBM PC, the boot loader in

4191-546: 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. The MBR originated in the PC XT . IBM PC-compatible computers are little-endian , which means the processor stores numeric values spanning two or more bytes in memory least significant byte first. The format of

4318-484: Is given a command to transfer data to memory starting at address 00100; when that transfer finishes, the CPU jumps to address 00101. IBM's competitors also offered single button program load. A noteworthy variation of this is found on the Burroughs B1700 where there is neither a bootstrap ROM nor a hardwired IPL operation. Instead, after the system is reset it reads and executes microinstructions sequentially from

4445-417: Is impossible to natively boot an operating system other than the standard one. This is the opposite extreme of the scenario using switches mentioned above; it is highly inflexible but relatively error-proof and foolproof as long as all hardware is working normally. A common solution in such situations is to design a boot loader that works as a program belonging to the standard OS that hijacks the system and loads

4572-400: 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 0x7C00 in every IBM XT- and AT-class machine, so

4699-539: Is maximal flexibility. On an IBM PC compatible machine, the BIOS selects a boot device, then copies the first sector from the device (which may be a MBR , VBR or any executable code), into physical memory at memory address 0x7C00. On other systems, the process may be quite different. The UEFI (not legacy boot via CSM) does not rely on boot sectors, UEFI system loads the boot loader ( EFI application file in USB disk or in

4826-405: 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 , the partition table may be moved to some other physical location on

4953-461: 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. In addition to the bootstrap code and a partition table, master boot records may contain a disk signature . This

5080-426: 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 −1 and specify the size as up to 2 −1, thereby defining

5207-543: Is the MEMZ Master boot record A master boot record ( MBR ) is a type of boot sector in the first block 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 . The MBR holds the information on how the disc's sectors (aka "blocks") are divided into partitions, each partition notionally containing

Boot sector - Misplaced Pages Continue

5334-450: 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 0x0000 : 0x0600 (for MS-DOS/PC DOS, OS/2 and Windows MBR code) or 0x0060 : 0x0000 (most DR-DOS MBRs). (Even though both of these segmented addresses resolve to the same physical memory address in real mode, for Apple Darwin to boot,

5461-522: 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 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

5588-402: Is usually a disk drive, hence the special significance of the 02h read-type command, but exactly the same procedure is also used to IPL from other input-type devices, such as tape drives, or even card readers, in a device-independent manner, allowing, for example, the installation of an operating system on a brand-new computer from an OS initial distribution magnetic tape. For disk controllers,

5715-427: The 02h command also causes the selected device to seek to cylinder 0000h , head 0000h , simulating a Seek cylinder and head command, 07h , and to search for record 01h , simulating a Search ID Equal command, 31h ; seeks and searches are not simulated by tape and card controllers, as for these device classes a Read IPL command is simply a sequential read command. The disk, tape or card deck must contain

5842-524: The BIOS Boot Specification (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. Booting In computing , booting is the process of starting a computer as initiated via hardware such as a button on the computer or by a software command. After it is switched on,

5969-509: The EFI system partition ) directly. Additionally, the UEFI specification also contains "secure boot", which basically wants the UEFI code to be digitally signed . In case a boot sector receives physical damage, the hard disk will no longer be bootable, unless used with a custom BIOS that defines a non-damaged sector as the boot sector. However, since the very first sector additionally contains data regarding

6096-514: The IBM 1401 system (c. 1958) used a card reader to load a program from a punched card. The 80 characters stored in the punched card were read into memory locations 001 to 080, then the computer would branch to memory location 001 to read its first stored instruction. This instruction was always the same: move the information in these first 80 memory locations to an assembly area where the information in punched cards 2, 3, 4, and so on, could be combined to form

6223-565: The LOAD button. On the high end System/360 models, most System/370 and some later systems, the functions of the switches and the LOAD button are simulated using selectable areas on the screen of a graphics console, often an IBM 2250 -like device or an IBM 3270 -like device. For example, on the System/370 Model 158, the keyboard sequence 0-7-X (zero, seven and X, in that order) results in an IPL from

6350-616: The Master Boot Record (MBR) and the Partition Boot Record (PBR) was coded to require at least 32 KB (later expanded to 64 KB ) of system memory and only use instructions supported by the original 8088 / 8086 processors. Second-stage (OS initialization stage) boot loaders, such as shim, GNU GRUB , rEFInd , BOOTMGR , Syslinux , NTLDR and iBoot , are not themselves operating systems, but are able to load an operating system properly and transfer execution to it;

6477-654: The SGI Visual Workstation x86-based workstations. When a computer is turned off, its software‍—‌including operating systems, application code, and data‍—‌remains stored on non-volatile memory . When the computer is powered on, it typically does not have an operating system or its loader in random-access memory (RAM). The computer first executes a relatively small program stored in read-only memory (ROM, and later EEPROM , NOR flash ) which support execute in place , to initialize CPU and motherboard, to initialize DRAM (especially on x86 systems), to access

SECTION 50

#1732859437004

6604-557: The Spectre GCR cartridge with the Macintosh system ROM in the game slot and turning the Atari on, it could "natively boot" the Macintosh operating system rather than Atari's own TOS . The IBM Personal Computer included ROM-based firmware called the BIOS ; one of the functions of that firmware was to perform a power-on self test when the machine was powered up, and then to read software from

6731-476: The UNIVAC I and the IBM 701 included features to make their operation simpler. They typically included instructions that performed a complete input or output operation. The same hardware logic could be used to load the contents of a punch card (the most typical ones) or other input media, such as a magnetic drum or magnetic tape , that contained a bootstrap program by pressing a single button. This booting concept

6858-417: The front panel . Since the early minicomputers used magnetic-core memory , which did not lose its information when power was off, these bootstrap loaders would remain in place unless they were erased. Erasure sometimes happened accidentally when a program bug caused a loop that overwrote all of memory. Other minicomputers with such simple form of booting include Hewlett-Packard's HP 2100 series (mid-1960s),

6985-552: The Altair 8800) in a commercial computer. According to Apple's ad announcing it "No More Switches, No More Lights ... the firmware in PROMS enables you to enter, display and debug programs (all in hex) from the keyboard." Due to the expense of read-only memory at the time, the Apple II booted its disk operating systems using a series of very small incremental steps, each passing control onward to

7112-448: The Atari's floppy drive was read for additional components during the boot process. There was a timeout delay that provided time to manually insert a floppy as the system searched for the extra components. This could be avoided by inserting a blank disk. The Atari ST hardware was also designed so the cartridge slot could provide native program execution for gaming purposes as a holdover from Atari's legacy making electronic games; by inserting

7239-505: The GPT. On IBM PC-compatible computers, the bootstrapping firmware (contained within the ROM BIOS ) loads and executes the master boot record. The PC/XT (type 5160) used an Intel 8088 microprocessor . In order to remain compatible, all x86 BIOS architecture systems start with the microprocessor in an operating mode referred to as real mode . The BIOS reads the MBR from the storage device into physical memory , and then it directs

7366-523: The IBM PC and compatibles, the boot code must fit in the Master Boot Record (MBR) and the Partition Boot Record (PBR), which in turn are limited to a single sector; on the IBM System/360 , the size is limited by the IPL medium, e.g., card size, track size. On systems with those constraints, the first program loaded into RAM may not be sufficiently large to load the operating system and, instead, must load another, larger program. The first program loaded into RAM

7493-581: The IPL process, changing some details for System/370 Extended Architecture (S/370-XA) and later, and adding a new type of IPL for z/Architecture. Minicomputers , starting with the Digital Equipment Corporation (DEC) PDP-5 and PDP-8 (1965) simplified design by using the CPU to assist input and output operations. This saved cost but made booting more complicated than pressing a single button. Minicomputers typically had some way to toggle in short programs by manipulating an array of switches on

7620-474: The Intel x86 series are designed to execute this software after reset without outside help). This software contains rudimentary functionality to search for devices eligible to participate in booting, and load a small program from a special section (most commonly the boot sector ) of the most promising device, typically starting at a fixed entry point such as the start of the sector. Boot loaders may face peculiar constraints, especially in size; for instance, on

7747-541: The MBR boot sector code expects to be loaded at physical address 0x0000 : 0x7C00 , all the memory from physical address 0x0000 : 0x0501 (address 0x0000 : 0x0500 is the last one used by a Phoenix BIOS) to 0x0000 : 0x7FFF , later relaxed to 0x0000 : 0xFFFF (and sometimes up to 0x9000 : 0xFFFF )‍—‌the end of the first 640 KB ‍—‌is available in real mode. The INT 12h BIOS interrupt call may help in determining how much memory can be allocated safely (by default, it simply reads

SECTION 60

#1732859437004

7874-414: 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

8001-406: The MBR copy. The primary validation for most BIOSes is the signature at offset 0x01FE , 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

8128-458: The MBR must be relocated to 0x0000 : 0x0600 instead of 0x0060 : 0x0000 , since the code depends on the DS:SI pointer to the partition entry provided by the MBR, but it erroneously refers to it via 0x0000 :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

8255-413: The MBR on media reflects this convention. Thus, the MBR signature will appear in a disk editor 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 at address 0x7C00 to 0x7FFF . The last instruction executed in the BIOS code will be a "jump" to that address in order to direct execution to the beginning of

8382-464: The MBR partitioning scheme (without 32-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 (GPT). The official approach does little more than ensuring data integrity by employing

8509-413: The MBR started to treat a set bit 7 as active flag and showed an error message for values 0x01 .. 0x7F 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 0x80 as valid, however, MS-DOS did not make use of this extension by itself. Storing the actual physical drive number in

8636-444: The MBR, which enforce CHS access for FAT16B and FAT32 partition types 0x06 / 0x0B , whereas LBA is used for 0x0E / 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

8763-550: 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 floppies , superfloppies or other storage devices configured to behave as such, nor are they necessarily present on drives used in non-PC platforms. Support for partitioned media, and thereby

8890-505: The VAX-11/730 had an 8085-based console processor. These console processors could boot the main processor from various storage devices. Some other superminicomputers, such as the VAX-11/750, implement console functions, including the first stage of booting, in CPU microcode. Typically, a microprocessor will, after a reset or power-on condition, perform a start-up process that usually takes

9017-617: The alternative OS. This technique was used by Apple for its A/UX Unix implementation and copied by various freeware operating systems and BeOS Personal Edition 5 . Some machines, like the Atari ST microcomputer , were "instant-on", with the operating system executing from a ROM . Retrieval of the OS from secondary or tertiary store was thus eliminated as one of the characteristic operations for bootstrapping. To allow system customizations, accessories, and other support software to be loaded automatically,

9144-467: The base memory size in KB from segment :offset location 0x0040 : 0x0013 , 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

9271-499: 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 processors, or on x86 machines with non-BIOS firmware such as Open Firmware or Extensible Firmware Interface (EFI) firmware, this design

9398-412: The boot process can also load a storage dump program for diagnosing problems in an operating system. Boot is short for bootstrap or bootstrap load and derives from the phrase to pull oneself up by one's bootstraps . The usage calls attention to the requirement that, if most software is loaded onto a computer by other software already running on the computer, some mechanism must exist to load

9525-480: The boot process is known as Initial Program Load (IPL). IBM coined this term for the 7030 (Stretch) , revived it for the design of the System/360, and continues to use it in those environments today. In the System/360 processors, an IPL is initiated by the computer operator by selecting the three hexadecimal digit device address (CUU; C=I/O Channel address, UU=Control unit and Device address ) followed by pressing

9652-649: The computer memory word and address bus. Simple additions to the hardware permitted one memory location at a time to be loaded from those switches to store bootstrap code. Meanwhile, the CPU was kept from attempting to execute memory content. Once correctly loaded, the CPU was enabled to execute the bootstrapping code. This process, similar to that used for several earlier minicomputers, was tedious and had to be error-free. The introduction of integrated circuit read-only memory (ROM), with its many variants, including mask-programmed ROMs , programmable ROMs (PROM), erasable programmable ROMs (EPROM), and flash memory , reduced

9779-402: The computer to automatically load instructions into memory from a device specified by the front panel's data switches, and then jump to loaded code. In a minicomputer with a paper tape reader, the first program to run in the boot process, the boot loader, would read into core memory either the second-stage boot loader (often called a Binary Loader ) that could read paper tape with checksum or

9906-594: The device address which was keyed into the input area. The Amdahl 470V/6 and related CPUs supported four hexadecimal digits on those CPUs which had the optional second channel unit installed, for a total of 32 channels. Later, IBM would also support more than 16 channels. The IPL function in the System/360 and its successors prior to IBM Z , and its compatibles such as Amdahl's, reads 24 bytes from an operator-specified device into main storage starting at real address zero. The second and third groups of eight bytes are treated as Channel Command Words (CCWs) to continue loading

10033-440: The device which can run without an operating system), allowing users a number of choices in what occurs next. With this kind of freedom, abuse often occurs in the form of boot sector viruses. Since code in the boot sector is executed automatically, boot sectors have historically been a common attack vector for computer viruses . To combat this behavior, the system BIOS often includes an option to prevent software from writing to

10160-706: The device; e.g., Ontrack Disk Manager 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. 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 6.60 and DR-DOS 7.07), eight ( AST and NEC MS-DOS 3.x as well as Storage Dimensions SpeedStor ), or even sixteen entries (with Ontrack Disk Manager ). An artifact of hard disk technology from

10287-407: The disk partitioning in an inconsistent state. As an example, the malware NotPetya attempts to gain administrative privileges on an operating system, and then would attempt to overwrite the boot sector of a computer. The CIA has also developed malware that attempts to modify the boot sector in order to load additional drivers to be used by other malware. Another Malware that overwrites boot sector

10414-571: 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 keys, primarily for storing the persistent mappings between disk partitions and drive letters. It may also be used in Windows NT BOOT.INI 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

10541-399: 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 ) of the remainder of

10668-403: The end of 2009, disk drives employing 4096-byte sectors ( 4Kn or 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 ). Since block addresses and sizes are stored in the partition table of an MBR using 32 bits,

10795-576: The era of the PC XT , the partition table subdivides a storage medium using units of cylinders , heads , and sectors ( 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 drives , 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,

10922-518: The eras of DOS and OS/2 up to 1996. 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. 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

11049-422: The fact that they can be booted successfully, the check can be disabled in some environments. If the BIOS or MBR code does not detect a valid boot sector and therefore cannot pass execution to the boot sector code, it will try the next boot device in the row. If they all fail it will typically display an error message and invoke INT 18h. This will either start up optional resident software in ROM ( ROM BASIC ), reboot

11176-620: The first sector of the drive. It may contain one or more of: IBM PC DOS 2.0 introduced the FDISK 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 records (EBRs), BSD disklabels , or Logical Disk Manager metadata partitions. The MBR

11303-554: The first byte of physical sector 20,498,940 . Starting with Windows Vista , the disk signature is also stored in the Boot Configuration Data (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

11430-404: The first physical sector of the media into RAM at absolute address 0x7C00 , 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

11557-420: 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

11684-399: The first sector of any attached hard drives; it could thereby protect the master boot record containing the partition table from being overwritten accidentally, but not the volume boot records in the bootable partitions. Depending on the BIOS, attempts to write to the protected sector may be blocked with or without user interaction. Most BIOSes, however, will display a popup message giving

11811-429: The form of "begin execution of the code that is found starting at a specific address" or "look for a multibyte code at a specific address and jump to the indicated location to begin execution". A system built using that microprocessor will have the permanent ROM occupying these special locations so that the system always begins operating without operator assistance. For example, Intel x86 processors always start by running

11938-469: 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 external drives , there are limitations as well. A sector size of 4096 results in an eight-fold increase in

12065-466: The initial software onto the computer. Early computers used a variety of ad-hoc methods to get a small program into memory to solve this problem. The invention of read-only memory (ROM) of various types solved this paradox by allowing computers to be shipped with a start up program that could not be erased. Growth in the capacity of ROM has allowed ever more elaborate start up procedures to be implemented. There are many different methods available to load

12192-502: The instructions beginning at F000:FFF0, while for the MOS 6502 processor, initialization begins by reading a two-byte vector address at $ FFFD (MS byte) and $ FFFC (LS byte) and jumping to that location to run the bootstrap code. Apple Computer 's first computer, the Apple 1 introduced in 1976, featured PROM chips that eliminated the need for a front panel for the boot process (as was the case with

12319-415: The instructions by the CPU. Smaller computers often use less flexible but more automatic boot loader mechanisms to ensure that the computer starts quickly and with a predetermined software configuration. In many desktop computers, for example, the bootstrapping process begins with the CPU executing software contained in ROM (for example, the BIOS of an IBM PC ) at a predefined address (some CPUs, including

12446-414: 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 managers , which operate in a variety of ways. Some MBR code loads additional code for a boot manager from the first track of

12573-550: 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 . This did not change when FAT16 was introduced as

12700-406: 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 ( 2 199 023 255 040 bytes or 4 294 967 295 (2 −1) sectors × 512 (2 ) bytes per sector). Alleviating this capacity limitation was one of the prime motivations for the development of the GPT. Since partitioning information

12827-423: The microprocessor to the start of the boot code. The BIOS will switch the processor to real mode, then begin to execute the MBR program, and so the beginning of the MBR is expected to contain real-mode machine 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

12954-441: The next phase of the gradually more complex boot process. (See Apple DOS: Boot loader ). Because so little of the disk operating system relied on ROM, the hardware was also extremely flexible and supported a wide range of customized disk copy protection mechanisms. (See Software Cracking: History .) Some operating systems, most notably pre-1995 Macintosh systems from Apple , are so closely interwoven with their hardware that it

13081-555: The nonvolatile device (usually block-addressed device, e.g. NAND flash, SSD) or devices from which the operating system programs and data can be loaded into RAM; in addition, this program may initialize display devices (such as GPUs ), text input devices (such as the keyboard ) and pointer input devices (such as the mouse ). The small program that starts this sequence is known as a bootstrap loader , bootstrap or boot loader . Often, multiple-stage boot loaders are used, during which several programs of increasing complexity load one after

13208-400: 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 (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

13335-454: The older approach, the earlier PDP-1 has a hardware loader, such that an operator need only push the "load" switch to instruct the paper tape reader to load a program directly into core memory. The PDP-7 , PDP-9 , and PDP-15 successors to the PDP-4 have an added Read-In button to read a program in from paper tape and jump to it. The Data General Supernova used front panel switches to cause

13462-425: The operating system from an outside storage medium. Pseudocode for the boot loader might be as simple as the following eight instructions: A related example is based on a loader for a Nicolet Instrument Corporation minicomputer of the 1970s, using the paper tape reader-punch unit on a Teletype Model 33 ASR teleprinter . The bytes of its second-stage loader are read from paper tape in reverse order. The length of

13589-496: The operating system subsequently initializes itself and may load extra device drivers . The second-stage boot loader does not need drivers for its own operation, but may instead use generic storage access methods provided by system firmware such as the BIOS, UEFI or Open Firmware , though typically with restricted hardware functionality and lower performance. Many boot loaders (like GNU GRUB, rEFInd, Windows's BOOTMGR, Syslinux, and Windows NT/2000/XP's NTLDR) can be configured to give

13716-460: The operator). Other systems may send hardware commands directly to peripheral devices or I/O controllers that cause an extremely simple input operation (such as "read sector zero of the system device into memory starting at location 1000") to be carried out, effectively loading a small number of boot loader instructions into memory; a completion signal from the I/O device may then be used to start execution of

13843-511: The original Data General Nova (1969), and DEC's PDP-4 (1962) and PDP-11 (1970). As the I/O operations needed to cause a read operation on a minicomputer I/O device were typically different for different device controllers, different bootstrap programs were needed for different devices. DEC later added, in 1971, an optional diode matrix read-only memory for the PDP-11 that stored a bootstrap program of up to 32 words (64 bytes). It consisted of

13970-453: The other in a process of chain loading . Some earlier computer systems, upon receiving a boot signal from a human operator or a peripheral device, may load a very small number of fixed instructions into memory at a specific location, initialize at least one CPU, and then point the CPU to the instructions and start their execution. These instructions typically start an input operation from some peripheral device (which may be switch-selectable by

14097-404: 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 00 F8 93 71 02 following the disk signature (under, e.g., the key value \DosDevices\D: ), it would begin at byte offset 0x00027193F800 ( 10,495,457,280 ), which is also

14224-442: The partition table does not normally cause backward compatibility problems, since the value will differ from 0x80 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

14351-406: The partitioning of the hard disk, the hard disk will become entirely unusable except when used in conjunction with custom software. A disk can be partitioned into multiple partitions and, on conventional systems, it is expected to be. There are two definitions on how to store the information regarding the partitioning: The presence of an IBM PC compatible boot loader for x86-CPUs in the boot sector

14478-764: The physical size and cost of ROM. This allowed firmware boot programs to be included as part of the computer. The Data General Nova 1200 (1970) and Nova 800 (1971) had a program load switch that, in combination with options that provided two ROM chips, loaded a program into main memory from those ROM chips and jumped to it. Digital Equipment Corporation introduced the integrated-circuit-ROM-based BM873 (1974), M9301 (1977), M9312 (1978), REV11-A and REV11-C, MRV11-C, and MRV11-D ROM memories, all usable as bootstrap ROMs. The PDP-11/34 (1976), PDP-11/60 (1977), PDP-11/24 (1979), and most later models include boot ROM modules. An Italian telephone switching computer, called "Gruppi Speciali", patented in 1975 by Alberto Ciaramella ,

14605-446: The power is not cut. On some systems, a soft boot may optionally clear RAM to zero. Both hard and soft booting can be initiated by hardware such as a button press or by a software command. Booting is complete when the operative runtime system , typically the operating system and some applications, is attained. The process of returning a computer from a state of sleep (suspension) does not involve booting; however, restoring it from

14732-451: The row. Traditionally, values other than 0x00 (not active) and 0x80 (active) were invalid and the bootstrap program would display an error message upon encountering them. However, the Plug and Play BIOS Specification and BIOS Boot Specification (BBS) allowed other devices to become bootable as well since 1994. Consequently, with the introduction of MS-DOS 7.10 (Windows 95B) and higher,

14859-426: The second stage loader is such that the final byte overwrites location 7. After the instruction in location 6 executes, location 7 starts the second stage loader executing. The second stage loader then waits for the much longer tape containing the operating system to be placed in the tape reader. The difference between the boot loader and second stage loader is the addition of checking code to trap paper tape read errors,

14986-680: The size of a partition that can be defined using MBR, allowing partitions up to 16 TiB (2  × 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 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

15113-425: The startup program (the first CCW is always simulated by the CPU and consists of a Read IPL command, 02h , with command chaining and suppress incorrect length indication being enforced). When the I/O channel commands are complete, the first group of eight bytes is then loaded into the processor's Program Status Word (PSW) and the startup program begins execution at the location designated by that PSW. The IPL device

15240-449: The stored program. Once this information was moved to the assembly area, the machine would branch to an instruction in location 080 (read a card) and the next card would be read and its information processed. Another example was the IBM 650 (1953), a decimal machine, which had a group of ten 10-position switches on its operator panel which were addressable as a memory word (address 8000) and could be executed as an instruction. Thus setting

15367-468: The switches to 7004000400 and pressing the appropriate button would read the first card in the card reader into memory (op code 70), starting at address 400 and then jump to 400 to begin executing the program on that card. The IBM 7040 and 7044 have a similar mechanism, in which the Load button causes the instruction set up in the entry keys on the front panel is executed, and the channel that instruction sets up

15494-440: The system via INT 19h after user confirmation or cause the system to halt the bootstrapping process until the next power-up. Systems not following the above described design are: On IBM PC compatible machines, the BIOS is ignorant of the distinction between VBRs and MBRs, and of partitioning. The firmware simply loads and runs the first sector of the storage device. If the device is a floppy or USB flash drive , that will be

15621-420: The user a chance to override the setting. The BIOS option is disabled by default because the message may not be displayed correctly in graphics mode and blocking access to the MBR may cause problems with operating system setup programs or disk access, encryption or partitioning tools like FDISK , which may not have been written to be aware of that possibility, causing them to abort ungracefully and possibly leaving

15748-462: The user multiple booting choices. These choices can include different operating systems (for dual or multi-booting from different partitions or drives), different versions of the same operating system (in case a new version has unexpected problems), different operating system loading options (e.g., booting into a rescue or safe mode ), and some standalone programs that can function without an operating system, such as memory testers (e.g., memtest86+ ),

15875-558: Was architecture-independent), e.g. the PDP-11. Storing the state of the machine after the switch-off was also in place, which was another critical feature in the telephone switching contest. Some minicomputers and superminicomputers include a separate console processor that bootstraps the main processor. The PDP-11/44 had an Intel 8085 as a console processor; the VAX-11/780 , the first member of Digital's VAX line of 32-bit superminicomputers, had an LSI-11 -based console processor, and

16002-458: Was called a variety of names for IBM computers of the 1950s and early 1960s, but IBM used the term "Initial Program Load" with the IBM 7030 Stretch and later used it for their mainframe lines, starting with the System/360 in 1964. The IBM 701 computer (1952–1956) had a "Load" button that initiated reading of the first 36-bit word into main memory from a punched card in a card reader ,

16129-435: 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. 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

#3996