What is Master Boot Record?

Learn via video courses
Topics Covered

Overview

Master Boot Record is the first sector of a hard disk and the place where all the information about the disk and booting can be found. It is the most essential part of the booting process. Along with the bootloader program, MBR also contains details regarding the partitions of the hard disk. The size of MBR is commonly less than or equal to 512 bytes.

What Is a Master Boot Record (MBR)?

What Is a Master Boot Record

As the name suggests, Master Boot Record, commonly known as MBR, is the first (main) sector of a hard disk and determines the location of the operating system (OS) to complete the execution of the booting process. MBR is often called the partition sector or master partition table because of its components. It consists of a table that holds details of the partitions of the hard disk and their locations. MBR also contains a record that helps in booting up the entire Operating System.

When a computer is first turned on, it runs a special program called Basic Input Output System (BIOS) that is stored in the Read-Only Memory (ROM). BIOS contains the code that locates and executes MBR. MBR contains a partition table holding locations of various hard disk partitions which further helps in loading the operating system.

mbr role in the booting process

The MBR plays an essential role in the booting process and in its absence, the computer wouldn't successfully startup.

Functions of the MBR

  • The Master Boot Record will examine the hard disk partition table to verify if it is in excellent working condition and will look for a bootable partition active in the partition table.
  • MBR also aids in the memory storage of the contents of the active partition's initial logical sector.

The Process of Reading MBR

The process of reading mbr

The BIOS program first evaluates the system hardware and then checks available boot devices (devices that contain files which help a system to boot) in line with the boot order stored in CMOS (Complementary Metal Oxide Semiconductor technology that refers to the small amount of memory on the motherboard that stores settings for BIOS).

Following that, BIOS reads the first sector (the MBR sector) to 0000: 7C00H. The BIOS then checks the end of the sector at 0000: 7CFEH-0000 to determine if the final signature is 55AAH.

If it is 55AH, BIOS will transfer control to the MBR in order to boot the Operating System. If not, the BIOS will look for additional bootable devices. If no bootable device is present, we will see the warning "NO RAM BASIC," and OS will not boot.

Parts of the Master Boot Record

Structure of the MBR

The MBR mainly consists of 3 parts:

1. Master Boot Routine

The MBR begins with the master boot routine that contains a variable loader code. Users can boot various operating systems from the MBR. Once the hard disk is booted, MBR passes control to the Operating System that has been registered in the partition table. The size of this component is 446 Bytes.

2. Disk Partition Table (DPT)

The disk partition table is located at the first sector of each hard disk and contains locations of the partitions. The disk partition table is usually 64 bytes long. It contains a maximum of 4 partitions that can be 16 bytes each. If the user requires more partitions, they are free to create an extended partition.

3. Identification Code

Identification code is used to identify an MBR and acts as a closing signature. Its value is AA55 H and may also be written as 55AA H. The identification code is 2 bytes long.

MBR vs GPT

MBR vs GPT

GUID Partition Table (GPT) is a standard table that is used to store details of partition tables. GPT is considered to be the successor of MBR as it maintains all partition-related data and the boot code of the Operating System.

Unlike in MBR, you can create multiple (up to 128) partitions in GPT. Also, a supported hard disk drive size can be as big as 9.44 million TB. This means that GPT disk can provide much more storage than MBR.

Since in a GPT data is stored all across the drive, there is a guarantee that in case a partition is deleted or damaged, data will still be retrievable. GPT also makes use of CRC (Cyclic Redundancy Check - an error detection code that is based on the remainder of polynomial division) to ensure data security. This error check mechanism provides GPT with a higher factor of reliability.

Solid State Drive (SSD) is able to boot Windows far more quickly as compared to Hard disk drive (HDD). To make the best use of this benefit of speed, Unified Extensible Firmware Interface (UEFI) based systems are needed, which makes GPT a better choice.

Even though GPT has an edge over MBR, users might choose MBR depending on the OS that they are working with. MBR is a better choice for users who work on previous versions of Windows or with drives that are less than 2TB large. Also, in case a Windows system is being booted using BIOS, MBR will be preferred.

How to Fix Master Boot Record (MBR) Problems?

Since MBR is so important in the functioning of a system, it becomes necessary to be able to troubleshoot and fix issues that occur with MBR. Commonly, issues with MBR are caused due to either of the 2 reasons:

  • A physical damage to the hardware.
  • Hijacking of MBR by some virus.

Remedies for MBR problems depend upon the installed Operating System.

In Windows, there are primarily 2 options:

  1. Using Automatic System Repair with the help of an external device like CD, DVD, etc: Here, the primary boot medium is changed in the BIOS to the device in consideration. After following a few steps, you will be able to access a system repair that automatically restores the MBR.
  2. Manual repair using command prompt: In this method, the repair process is initiated using commands like bootrec. The commands depend on the OS version and whether or not Windows is activated on the PC.

Features Of MBR

  1. Partitions in MBR can either be Primary(a partition that is needed to store and boot an operating system), Extended(partitions that are used to create logical partitions), or Logical(partitions that are created to extend the limitation of only 4 partitions).
  2. The MBR partition table consists of details of only primary and extended partitions.
  3. Commonly, MBR can have a maximum of 4 partitions with each partition having 16 bytes space and thus a total of 64 bytes for all the partitions. However, certain latest versions can support up to 16 partitions.
  4. Since the maximum size of MBR is 512 bytes, disks that are formatted with MBR require a maximum of 2TB available for use.

Limitations Of MBR

  1. The limit of 4 primary partitions can cause trouble when you need a higher number of primary partitions in the device.
  2. An MBR partition cannot hold a hard drive that has a size bigger than 2TB.
  3. MBR Drives aren't very reliable since they store all the data in a single location. If overwritten or corrupted, it will cause booting issues.

Conclusion

  • Master Boot Record(MBR), is the first sector of a hard disk and determines the location of the operating system (OS) to complete the execution of the booting process.
  • MBR consists of a main boot code, a partition table, and an end signature.
  • The BIOS program evaluates the first sector by checking if it contains the end signature (identification code) of MBR. If it is present, it continues booting. Else, it looks out for another booting device.
  • Troubleshooting for MBR-related issues depends on the OS in consideration. For Windows, you can either choose to follow the Automatic Repair option or use the command prompt manually.
  • Partitions in MBR can either be Primary, Extended, or Logical.
  • The limit for primary partitions, size of hard drive, and the fact that all data is stored in one location cause challenges for MBR.
  • GPT has a higher number of partitions, better storage, and performance compared to MBR. Although, in certain cases, MBR is more preferred.