World Library  
Flag as Inappropriate
Email this Article

Boot sector

Article Id: WHEBN0000216381
Reproduction Date:

Title: Boot sector  
Author: World Heritage Encyclopedia
Language: English
Subject: Computer virus, Master boot record, Elk Cloner, Booting, BIOS
Collection: Bios, Booting, Computer File Systems
Publisher: World Heritage Encyclopedia

Boot sector

A boot sector or boot block is a region of a hard disk, floppy disk, optical disc, or other data storage device that contains machine code to be loaded into random-access memory (RAM) by a computer system's built-in firmware. The purpose of a boot sector is to allow the boot process of a computer to load a program (usually, but not necessarily, an operating system) stored on the same storage device. The location and size of the boot sector (perhaps corresponding to a logical disk sector) is specified by the design of the computing platform.

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.


  • Kinds of boot sectors 1
  • Operation 2
  • Boot sector viruses 3
  • See also 4
  • Notes 5
  • References 6
  • External links 7

Kinds of boot sectors

Several major kinds of boot sectors could be encountered on the IBM PC compatible hard disks, floppy disks and similar storage devices:

  • A Master Boot Record (MBR) is the first sector of a data storage device that has been partitioned. The MBR sector may contain code to locate the active partition and invoke its Volume Boot Record.
  • A Volume Boot Record (VBR) is the first sector of a data storage device that has not been partitioned, or the first sector of an individual partition on a data storage device that has been partitioned. It may contain code to load an operating system (or other standalone program) installed on that device or within that partition.

The presence of an IBM PC compatible boot loader for x86-CPUs in the boot sector 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 to actually 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 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 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 (f.e. very old CP/M-86 and DOS media) sometimes do not feature this signature despite 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 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:

  • Other (non IBM-compatible) systems may have different boot sector formats on their disk devices.


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.[2] If the device is a floppy or USB flash drive, that will be 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 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's 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 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.

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 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.[3] 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 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 the disk partitioning in an inconsistent state.[nb 1]

See also


  1. ^ One FDISK utility written to be aware of BIOS boot sector protection features is DR-DOS' FDISK R2.31 (and higher), which will detect this scenario and display additional interactive messages to guide the user through it. In contrast to other FDISK utilities, DR-DOS FDISK is not only a partitioning tool, but can also format freshly created partitions as FAT12, FAT16 or FAT32. This reduces the risk to accidentally format wrong volumes.


  1. ^ Commodore 128 Programmer's Reference Guide. Bantam Book. 1986. pp. 446–447.  
  2. ^ Roderick W. Smith, Consultant and author (2010-04-14). "Migrate to GRUB 2". Retrieved 2013-03-05. 
  3. ^ "Intel Desktop Boards BIOS Settings Dictionary" (PDF).  

External links

  • Mary Landesman. "Boot sector viruses". 
  • Microsoft. "How to Protect Boot Sector from Viruses in Windows". KnowledgeBase. 
  • Denny Lin (15 June 1994). "Inexpensive boot sector virus detection and prevention techniques". Retrieved 13 August 2015. 
  • Kaspersky Lab. "Boot sector viruses". Virus Encyclopedia / Malware Descriptions / Classic Viruses. 
  • Arman Catacutan. "Glossary of Virus Terms". Boot Viruses. 
  • Greg O'Keefe. "Sample to build a boot program on x86 real mode". 
  • Susam Pal. "Writing boot sector code using GNU tools". 
  • Pierre Ancelot. "Bootsector assembly code with detailed explanation". 
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.