A 'boot sector' (sometimes called a 'bootblock') is a
sector of a
hard disk,
floppy disk, or similar
data storage device that contains code for
booting programs (usually, but not necessarily,
operating systems) stored in other parts of the disk.
The term 'boot sector' is used for
IBM-compatible PCs, whereas 'bootblock' is used when referring to certain other types of computers, such as
Sun systems.
Kinds of boot sectors
There are two major kinds of boot sectors:
★ A
Volume Boot Record 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 contains code to load and invoke the operating system (or other standalone program) installed on that device or within that partition. It is required to have two bytes (0xAA55) called boot sector signature at the end of the sector to be a valid boot sector; either BIOS software or MBR code would report an error message and hang up the operating system loading process otherwise.
★ A
Master Boot Record is the first sector of a data storage device that has been partitioned. It might contain code to locate the active partition and to invoke its Volume Boot Record.
Operation
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 disk, 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 (programs stored elsewhere on the device which can run without an operating system), allowing users a number of choices in what occurs next. But with such freedom, there's also the possibility for abuse as addressed in the section on boot viruses.
Boot sectors and computer viruses
Boot sectors are one mechanism by which
computer viruses gain control of a system. 'Boot sector infector' viruses replace the bootstrap code in the boot sectors (of floppy disks, hard disks, or both) with viral code.
External links
★
Boot sector viruses Mary Landesman
★
How to Protect Boot Sector from Viruses in Windows Microsoft
★
Inexpensive boot sector virus detection and prevention techniques Denny Lin
★
Boot sector viruses Kaspersky Lab
★
Glossary of Virus Terms Arman Catacutan
★
Sample to build a boot program on x86 real mode