Home      Discussion      Topics      Dictionary      Almanac
Signup       Login
Boot sector

Boot sector

Overview
A boot sector is a sector
Disk sector
In the context of computer disk storage, a sector is a subdivision of a track on a magnetic disk or optical disc. Each sector stores a fixed amount of data...

 of a hard disk
Hard disk
A hard disk drive is a non-volatile storage device that stores digitally encoded data on rapidly rotating platters with magnetic surfaces. Strictly speaking, "drive" refers to the motorized mechanical aspect that is distinct from its medium, such as a tape drive and its tape, or a floppy disk...

, floppy disk
Floppy disk
A floppy disk is a data storage medium that is composed of a disk of thin, flexible magnetic storage medium encased in a square or rectangular plastic shell. Floppy disks are read and written by a floppy disk drive or FDD, the initials of which should not be confused with "fixed disk drive," which...

, or similar data storage device
Data storage device
thumb|200px|right|A reel-to-reel tape recorder .The magnetic tape is a data storage medium. The recorder is data storage equipment using a portable medium to store the data....

 that contains code for booting
Booting
In computing, booting is a bootstrapping process that starts operating systems when the user turns on a computer system. A boot sequence is the initial set of operations that the computer performs when power is switched on...

 program
Computer program
Computer programs are instructions for a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute the instructions...

s (usually, but not necessarily, operating system
Operating system
An operating system is an interface between hardware and user which is responsible for the management and coordination of activities and the sharing of the resources of the computer that acts as a host for computing applications run on the machine. As a host, one of the purposes of an operating...

s) stored in other parts of the disk.

On a IBM PC compatible
IBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...

 machine the BIOS
BIOS
In IBM PC Compatible computers, the basic input/output system , also known as the System BIOS, is a de facto standard defining a firmware interface. The BIOS is boot firmware, designed to be the first code run by a PC when powered on...

 selects a boot device, then it copies the first sector from the device (which may be an MBR
Master boot record
A master boot record , or partition sector, is the 512-byte boot sector that is the first sector of a partitioned data storage device such as a hard disk. A master boot record (MBR), or partition sector, is the 512-byte boot sector that is the first sector ("LBA Sector 0") of a partitioned data...

, VBR
Volume Boot Record
A Volume Boot Record is a type of boot sector, stored in a disc volume on a hard disk, floppy disk, or similar data storage device, that contains code for booting programs stored in other parts of the volume...

 or any executable code), to address location 0x7C00.

Several major kinds of boot sectors could be encountered on IBM PC compatible
IBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...

 hard disk
Hard disk
A hard disk drive is a non-volatile storage device that stores digitally encoded data on rapidly rotating platters with magnetic surfaces. Strictly speaking, "drive" refers to the motorized mechanical aspect that is distinct from its medium, such as a tape drive and its tape, or a floppy disk...

s, floppy disk
Floppy disk
A floppy disk is a data storage medium that is composed of a disk of thin, flexible magnetic storage medium encased in a square or rectangular plastic shell. Floppy disks are read and written by a floppy disk drive or FDD, the initials of which should not be confused with "fixed disk drive," which...

s and similar storage devices:
  • A master boot record
    Master boot record
    A master boot record , or partition sector, is the 512-byte boot sector that is the first sector of a partitioned data storage device such as a hard disk. A master boot record (MBR), or partition sector, is the 512-byte boot sector that is the first sector ("LBA Sector 0") of a partitioned data...

     (MBR) is the first sector of a data storage device that has been partitioned.
Discussion
Ask a question about 'Boot sector'
Start a new discussion about 'Boot sector'
Answer questions from other users
Full Discussion Forum
 
Encyclopedia
A boot sector is a sector
Disk sector
In the context of computer disk storage, a sector is a subdivision of a track on a magnetic disk or optical disc. Each sector stores a fixed amount of data...

 of a hard disk
Hard disk
A hard disk drive is a non-volatile storage device that stores digitally encoded data on rapidly rotating platters with magnetic surfaces. Strictly speaking, "drive" refers to the motorized mechanical aspect that is distinct from its medium, such as a tape drive and its tape, or a floppy disk...

, floppy disk
Floppy disk
A floppy disk is a data storage medium that is composed of a disk of thin, flexible magnetic storage medium encased in a square or rectangular plastic shell. Floppy disks are read and written by a floppy disk drive or FDD, the initials of which should not be confused with "fixed disk drive," which...

, or similar data storage device
Data storage device
thumb|200px|right|A reel-to-reel tape recorder .The magnetic tape is a data storage medium. The recorder is data storage equipment using a portable medium to store the data....

 that contains code for booting
Booting
In computing, booting is a bootstrapping process that starts operating systems when the user turns on a computer system. A boot sequence is the initial set of operations that the computer performs when power is switched on...

 program
Computer program
Computer programs are instructions for a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute the instructions...

s (usually, but not necessarily, operating system
Operating system
An operating system is an interface between hardware and user which is responsible for the management and coordination of activities and the sharing of the resources of the computer that acts as a host for computing applications run on the machine. As a host, one of the purposes of an operating...

s) stored in other parts of the disk.

On a IBM PC compatible
IBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...

 machine the BIOS
BIOS
In IBM PC Compatible computers, the basic input/output system , also known as the System BIOS, is a de facto standard defining a firmware interface. The BIOS is boot firmware, designed to be the first code run by a PC when powered on...

 selects a boot device, then it copies the first sector from the device (which may be an MBR
Master boot record
A master boot record , or partition sector, is the 512-byte boot sector that is the first sector of a partitioned data storage device such as a hard disk. A master boot record (MBR), or partition sector, is the 512-byte boot sector that is the first sector ("LBA Sector 0") of a partitioned data...

, VBR
Volume Boot Record
A Volume Boot Record is a type of boot sector, stored in a disc volume on a hard disk, floppy disk, or similar data storage device, that contains code for booting programs stored in other parts of the volume...

 or any executable code), to address location 0x7C00.

Kinds of boot sectors


Several major kinds of boot sectors could be encountered on IBM PC compatible
IBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...

 hard disk
Hard disk
A hard disk drive is a non-volatile storage device that stores digitally encoded data on rapidly rotating platters with magnetic surfaces. Strictly speaking, "drive" refers to the motorized mechanical aspect that is distinct from its medium, such as a tape drive and its tape, or a floppy disk...

s, floppy disk
Floppy disk
A floppy disk is a data storage medium that is composed of a disk of thin, flexible magnetic storage medium encased in a square or rectangular plastic shell. Floppy disks are read and written by a floppy disk drive or FDD, the initials of which should not be confused with "fixed disk drive," which...

s and similar storage devices:
  • A master boot record
    Master boot record
    A master boot record , or partition sector, is the 512-byte boot sector that is the first sector of a partitioned data storage device such as a hard disk. A master boot record (MBR), or partition sector, is the 512-byte boot sector that is the first sector ("LBA Sector 0") of a partitioned data...

     (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
    Volume Boot Record
    A Volume Boot Record is a type of boot sector, stored in a disc volume on a hard disk, floppy disk, or similar data storage device, that contains code for booting programs stored in other parts of the volume...

     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 and invoke an operating system (or other standalone program) installed on that device or within that partition.


To be a valid boot sector, the two-byte hex word 0xAA55, called the boot sector signature, must exist at the end of the sector; otherwise, either the BIOS or MBR code will report an error message and halt any OS bootstrapping
Bootstrapping (computing)
In computing, bootstrapping is a technique by which a simple computer program activates a more complicated system of programs...

 process.
  • CD-ROMs usually have their own structure of boot sectors, for IBM PC compatible
    IBM PC compatible
    IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...

     systems this is subject to El Torito specifications
    El Torito (CD-ROM standard)
    The El Torito Bootable CD Specification is an extension to the ISO 9660 CD-ROM specification. It is designed to allow a computer to boot from a CD-ROM...

    .

  • Non IBM PC compatible systems may have different boot sector formats on their disk devices.

Operation


On IBM PC compatible
IBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...

 machines, the BIOS
BIOS
In IBM PC Compatible computers, the basic input/output system , also known as the System BIOS, is a de facto standard defining a firmware interface. The BIOS is boot firmware, designed to be the first code run by a PC when powered on...

 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
USB flash drive
A USB flash drive consists of flash memory data storage device integrated with a USB 1.1 or 2.0 interface. USB flash drives are typically removable and rewritable, much smaller than a floppy disk, and most weigh less than 1 ounce...

, 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 0xAA55 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
Booting
In computing, booting is a bootstrapping process that starts operating systems when the user turns on a computer system. A boot sequence is the initial set of operations that the computer performs when power is switched on...

 (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 virus
Computer virus
A computer virus is a computer program that can copy itself and infect a computer. The term "virus" is also commonly but erroneously used to refer to other types of malware, adware, and spyware programs that do not have the reproductive ability...

es. To combat this behavior, the BIOS often includes an option to prevent writing to the boot sectors of attached hard drives.