Master Boot Record aka MBR was introduced by IBM PC DOS2.0 in March 1983. Post that this technology has never looked back, Some people have grown older while using this technology and they know, how big this change was. Microsoft used this technology as an advantage and made most of its file system on top of it.
Now the time has changed and the hunger of storage has grown beyond the capacity of this Partitioning style due to which a new Partitioning Style GPT was introduced. However, in this article, we are only going to discuss MBR.
Let’s start by seeing how actually MBR looks, So here is the Picture of MBR:
It’s funny to see all this technological change in small flat zeros and ones, of course, which are converted to Hexadecimal. Now the Things change when you start seeing the decoded text of this MBR and then you will start getting the idea about what written inside it If nothing else you are going to Notice terms like: “Invalid partition table” or “Error loading operating system” or “Missing operating system“. If you are using Windows since XP, you must be familiar with these errors but never thought from where they are coming, So now you have the Answer, Its MBR.
Please note that some changes has been done with new versions of operating systems, So if yours doesn’t look like this probably you are running something before windows 10.
Let’s understand more about this by coloring and separating things which make more sense
So Now making these colours more meaningful
Now Let’s decode this One by One:
Master Boot Code
The master boot code performs the following activities:
- Scans the partition table for the active partition.
- Finds the starting sector of the active partition.
- Loads a copy of the boot sector from the active partition into memory.
- Transfers control to the executable code in the boot sector.
If the master boot code cannot complete these functions, the system displays one of the following error messages:
- Invalid partition table
- Error loading operating system
- Missing operating system
Disk Signature:
The disk signature, a unique number at offset 0x01B0, identifies the disk to the operating system.
Windows uses the disk signature as an index to store and retrieve information about the disk in the registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
End of Sector Marker:
At the end of the MBR is a 2-byte structure called a signature word or end of sector marker, which is always set to 0x55AA. A signature word also marks the end of an extended boot record (EBR) and the boot sector.
Partition Table
Partition table
A 64-byte data structure used to identify the type and location of partitions on a hard disk, conforms to a standard layout independent of the operating system.
Each partition table entry is 16 bytes long, with a maximum of four entries.
Each entry starts at a predetermined offset from the beginning of the sector, as follows:
- Partition 1\ 0x01BE(446)
- Partition 2\ 0x01CE(462)
- Partition 3\ 0x01DE(478)
- Partition 4\ 0x01EE(494)
Now let’s understand what each of the 4 Partition Table has:
Boot Indicator
Indicates whether the volume is the active partition. Legal values include:
00: Do not use for booting.
80: Active partition
Starting Sector
Only bits 0-5 are used. The upper two bits, 6 and 7, are used by the Starting Cylinder field.
System ID
Defines the volume type
Partition Type | ID Value |
0x01 | FAT12 primary partition or logical drive (fewer than 32,680 sectors in the volume) |
0x04 | FAT16 partition or logical drive (32,680–65,535 sectors or 16 MB–33 MB) |
0x05 | Extended partition |
0x07 | Installable File System (NTFS partition or logical drive) |
0x0B | FAT32 partition or logical drive |
0x0C | FAT32 partition or logical drive using BIOS INT 13h extensions |
0x42 | Dynamic disk volume |
0xEE | GPT Partition |
Ending Sector
Only bits 0-5 are used. The upper two bits, 6 and 7, are used by the Ending Cylinder field.
Relative Sectors
The offset from the beginning of the disk to the beginning of the volume, counting by sectors.
NOTE: before Windows Vista, the default relative sector was 63. With vista, this default has changed to Sector 2048
Total Sectors
The total number of sectors in the volume.
Complete Partitioning Understanding:
Now Since we an idea about the First sector and What’s inside it. Let’s understand how exactly the Disk is Partitioned after selecting MBR while initializing the Selected Disk.
From the Image above you can now understand that there is total space for 3 Primary Partition and 1 Extended Partition. In the Extended Partition, you can always create new Volumes and might not even notice that these are not your primary partition and you are currently using your Extended Partition Table. However, if you want to know to see the screenshot below:
Notice the Change in few Colours. From 1 to 3 The Dark Blue color shows that they are Primary Partition.
Post that the Dark Green Outline shows that you are now running under Extended Partition.
Somewhat Lighter share of Dark Blue shows you that this is a Logical Volume and Finally the Light Green color shows free space under the Extended Partition.
I guess now you should have a good Understanding of MBR. In the Later Article, I will be discussing MBS and GPT Partitioning Style as well.