TryHackMe Walkthrough: MBR and GPT Analysis (Beginner to Intermediate Guide)
Before Windows Loads: The Hidden Boot Architecture Every Tech Person Should UnderstandBefore Windows 2026-5-2 07:46:31 Author: infosecwriteups.com(查看原文) 阅读量:7 收藏

SAFAL GAUTAM

Before Windows Loads: The Hidden Boot Architecture Every Tech Person Should Understand

Before Windows shows you a login screen, before Linux mounts a single filesystem, before any software you have ever used touches RAM — a completely different system runs first. It has no interface. It makes no sound. And if even two bytes of it are wrong, your computer will not boot at all.

Every time you press the power button, a precise chain of events unfolds in the dark — invisible, silent, and entirely outside the operating system you think of as your computer. This chain involves firmware burned into your motherboard, cryptographic checksums, backup copies of critical structures, and a 92-byte document that maps your entire disk. Understanding this chain does not just satisfy curiosity. It explains why systems fail, how malware hides below the OS, and how forensic analysts recover data that users believe is gone forever.

This guide walks through the complete boot process — from dead hardware to running OS — covering MBR, GPT, and every structure in between. No surface-level overview. The real thing.

Step 1 — Power-On: The CPU Wakes Up With No Instructions

When electrical current reaches your motherboard, the CPU powers on. But it is completely blank at this moment — it has no idea what to do, where the operating system is, or even what kind of disk is connected. It needs a starting point.

That starting point is a chip permanently soldered onto your motherboard called the firmware chip. The CPU’s first action is always to execute whatever code lives at a fixed memory address on that chip. This is either BIOS or UEFI — two generations of the same idea.

BIOS vs UEFI — Why It Matters?

Both are firmware: software permanently stored in hardware, responsible for starting the machine and handing control to your OS. The difference is everything else.

Press enter or click to view image in full size

BIOS (Basic Input/Output System) is the original standard, introduced in the 1970s. It operates in 16-bit mode, cannot recognise disks larger than 2 TB, has no graphical interface, and offers no security features. It is a relic that modern systems have abandoned.

UEFI (Unified Extensible Firmware Interface) is the modern replacement. It supports huge disks, has a graphical interface, and includes Secure Boot — a feature that verifies the bootloader hasn’t been tampered with, protecting against malware that attacks before the OS loads. It also keeps a backup of boot code, so if something gets corrupted, it can recover.

How to check on Windows: Press Windows + R, type msinfo32, press Enter. Look for BIOS Mode — it will say either Legacy (BIOS) or UEFI.

Step 2 — POST: The Hardware Health Check

Once the CPU starts executing firmware instructions, the first thing BIOS/UEFI does is run a POST (Power-On Self Test). This is a quick health check of all hardware:

  • Is RAM working?
  • Is the keyboard connected?
  • Are storage drives detected?
  • Is the GPU responding?

If everything is fine, you get one short beep (on systems with a speaker) and the process continues. If something is wrong, you hear a pattern of beeps — each pattern means a different error. Error messages may also appear on screen (e.g., “Keyboard not found”). Only after POST passes does the firmware move on to finding the operating system.

Step 3 — Locate a Bootable Device

After POST passes, BIOS/UEFI looks for a bootable device — this could be:

  • An SSD or HDD
  • A USB drive
  • A CD/DVD

It checks them in a priority order you can usually configure (called the boot order). To check if a disk is bootable or to find the OS, it must: read the disk and understand its structure. To do that, they use an addressing system to locate data on the disk. At this point, BIOS uses an older, simpler addressing system (tied to MBR) that can only count up to certain number of storage blocks — which caps out at 2 TB. Any space beyond 2 TB is simply invisible to BIOS — it can’t see or use it. Whereas, UEFI uses a much more advanced addressing system (tied to GPT) that can handle astronomically large disks — up to 9 Zettabytes, which is far beyond any disk that exists today. Once it finds a bootable device, it reads the very first sector of that disk, which contains either:

  • MBR (Master Boot Record) — used with BIOS
  • GPT (GUID Partition Table) — used with UEFI

To understand about what we are talking, we need to discuss few important concepts with the scenario: Think of your hard drive as a large warehouse. Raw data — documents, videos, system files — is stored inside it as 1s and 0s, the only language a computer understands. But a warehouse full of randomly dumped boxes is useless. You need structure.

Before we go further, we need to establish the foundational concepts that make all of this work.

Foundational Concepts

Partitions:

To bring order to this chaos, the disk is split into partitions — dedicated sections, each serving a specific purpose:

  • One partition holds operating system files
  • Another holds your personal files
  • Another might be reserved for backups or recovery tools

A partition is a logically defined section of a physical disk, created by grouping a consecutive range of sectors together and treating them as an independent unit.

On Windows, you see these as drive letters — C:, D:, E:, and so on. On Linux or macOS, they appear differently (e.g., /dev/sda1), but the concept is the same: separate zones for separate purposes.

Why Partitions Aren’t Enough?

Dividing the disk into partitions solves the organization problem — but creates a new one. The computer now needs a map that tells it:

  • How many partitions exist
  • Where each one starts and ends
  • What each partition contains
  • Which partition to boot the operating system from

This is where MBR and GPT come in. MBR (Master Boot Record) and GPT (GUID Partition Table) are partitioning schemes — essentially the blueprint of your warehouse, describing every room inside it.

Disk Size = Storage Capacity

When we say BIOS supports disks up to 2 TB and UEFI supports up to 9 Zettabytes, we’re talking about the total storage capacity of your hard drive or SSD — how much data it can hold.

MBR & GPT: The Blueprints of Your Disk

MBR (Master Boot Record) and GPT (GUID Partition Table) are partitioning schemes — essentially the blueprint of your warehouse, describing every room inside it. Both partitioning schemes differ in structure and properties, and choosing between them depends on multiple factors, including the disk size, hardware compatibility, and much more. Both live in the very first sectors of the disk and are read the moment your computer powers on.

What Exactly is Sector?

A sector is the smallest unit of storage on a disk. Every disk — whether a hard drive or SSD — is physically divided into millions of tiny, fixed-size slots called sectors, each holding 512 bytes of data.When your computer reads or writes anything, it always does so in whole sectors — you can never read or write less than one sector at a time.

Press enter or click to view image in full size

All sector numbering starts from 0, and the very first sector (Sector 0) holds a special place in the boot process, as it is where the MBR (Master Boot Record) lives. The real GPT header and partition table start from Sector 1.

Press enter or click to view image in full size

Step 4 — Read the Disk Structure: MBR/GPT

When you press the power button, your computer doesn’t yet know where the OS is. It turns to the MBR or GPT first — reading the partition map to figure out which partition contains the operating system and how to load it. This makes them the first critical step in every startup.

What if MBR?

The MBR occupies exactly 512 bytes — starting at the very first sector of the disk. But when you open a raw disk data in a hex editor, how do you know where it ends?

Looking at the given image, it has three columns:

Press enter or click to view image in full size

There are two ways to find where the MBR ends

1. Count the rows: Each row contains 16 bytes. So:

16 bytes × 32 rows = 512 bytes = the entire MBR

You can literally count 32 rows from the top — that’s your whole MBR.

2. Look for the MBR Signature: The MBR always ends with the magic bytes 55 AA. This is a universal signature marking the end of MBR code. You can spot it clearly in the last row (000001F0) of the hex editor on the right — the final two bytes are 55 AA .

The first-stage bootloader is when first code (bootstrap code) executes when BIOS loads the MBR into memory.

The Structure of MBR

(you may find faults in this image, very useful to visualize the structure of MBR)

A. Bootstrap Code (Bytes 0–445) — Blue
This is the largest section, taking up almost the entire MBR. It is the very first piece of code that executes on your machine. Its only job is to scan the Partition Table and find which partition is marked as bootable (boot indicator: 80 meaning it is the C:\ Drive). Once it finds the bootable partition, it loads the second-stage bootloader from it, which then loads the actual OS kernel.

B. Partition Table (Bytes 446–509) — Purple, Teal, Coral, Pink
This section is the map of all the partitions on the disk. It is only 64 bytes, but carries critical information. Since, MBR disk supports a maximum of 4 partitions, and each partition gets 16 bytes of space in the table making 64 bytes total. Those 16 bytes are divided into 6 fields, for example:

Press enter or click to view image in full size

For your understanding, the partition details of the same disk through the disk management utility of the Windows OS.

Press enter or click to view image in full size

Now, first understand all the core terms:

What is CHS? Hard disks (specifically older ones) are made of circular spinning platters, like CDs stacked on top of each other. Data is stored on these platters in concentric rings. To locate any piece of data physically, you needed three coordinates:

Together, Cylinder+Head+Sector gave you the exact physical location on the disk — like a 3D coordinate system inside the drive.

Press enter or click to view image in full size

The Starting CHS = where the partition physically begins on these platters
The Ending CHS = where it physically ends

Modern disks are too large and too complex for CHS to work accurately. CHS can only address up to ~8 GB of disk space — completely useless for today’s multi-terabyte drives. That’s why LBA replaced it.

What is LBA — Logical Block Addressing?

CHS required knowing the physical geometry of the disk — how many platters, how many rings, etc. Different disks had different geometries, making it complicated. LBA throws away all that physical complexity. It says:

“Forget cylinders and heads. Just number every sector from 0 to the end, in a straight line.”

Every sector gets a simple sequential number called its LBA address:

LBA Offset — What Does “Offset” Mean?

An offset is simply a distance from the beginning.

  • LBA offset 0 = the very start of the disk
  • LBA offset 2048 = 2048 sectors from the start

To convert an LBA to an actual byte position (which is what a hex editor uses):

Byte Position = LBA * sector size

So, if the LBA = 2048, we know that the sector size is 512 bytes, the partition starts at 1,048,576 bytes from the beginning of the disk.

“The sector the partition starts at” just means: which sector number does this partition begin at? In our example, Partition 1 begins at sector 2048.

Little-Endian vs Big-Endian

This is about the order in which bytes are stored in memory or on disk.

The problem is that numbers bigger than one byte need multiple bytes to store. For example, the number 2048 in hex is 0x00000800 — that’s 4 bytes: 00 00 08 00.

But which byte do you write first?

Big-Endian — “Natural” Order: Write the most significant (biggest) byte first — just like how humans write numbers:

Little Endian — Least Significant (smallest) Byte first:

Intel processors — found in virtually all desktop and laptop computers — use little-endian. This means whenever you read a multi-byte value from an MBR or GPT structure, you must reverse the bytes before interpreting the number.

Now, field-by-field breakdown:

Field 1 — Boot Indicator (1 byte)

This is the simplest field. It answers one yes/no question: is this partition bootable? Only one partition across all four can have 80. On windows, this is always your C: drive. All other partitions will show 00.

Field 2 — Starting CHS Address (3 bytes)

These 3 bytes tell the system the physical starting location of the partition on the actual hardware.

Field 3 — Partition Type (1 byte)

Get SAFAL GAUTAM’s stories in your inbox

Join Medium for free to get updates from this writer.

Remember me for faster sign in

This single byte tells you what filesystem the partition uses. Every filesystem has a unique code:

Press enter or click to view image in full size

Field 4 — Ending CHS Address (3 bytes)

Same concept as the Starting CHS Address, but marks the physical end of the partition. Again, this is largely ignored in modern forensics because LBA addressing (below) is far more reliable and easier to work with.

Field 5 — Starting LBA Address (4 bytes)

LBA = Logical Block Addressing — this is the modern, simplified way to locate a partition. Instead of physical cylinder/head/sector coordinates, LBA gives you a simple logical number representing which sector the partition starts at. This is the field forensic analysts care about most, because it lets you jump directly to the partition in a hex editor.

How to use LBA to find the partition:

The bytes are stored in little-endian format — meaning the bytes are written in reverse order (least significant byte first). You must reverse them before doing anything.

Step 1 — Read the raw bytes:

00 08 00 00

Step 2 — Reverse them (little endian -> big endian):

00 00 08 00

Step 3 — Convert hex to decimal:

00 00 08 00 (hex) = 2048 (decimal)

Step 4 — Multiply by sector size (always 512 bytes):

2048 * 512 = 1,048,576

Step 5 — Jump to that offset in the hex editor:

Go to offset 1,048,576 in HxD using Search → Go To → enter the decimal value. You will land exactly at the start of this partition on the disk.

This technique is extremely powerful in forensics. Even if a partition has been deleted or hidden, as long as the LBA entry exists or can be reconstructed, you can jump directly to it and carve out data that hasn’t been overwritten yet.

Field 6 — Number of Sectors (4 bytes)

These last 4 bytes tell you how many sectors the partition contains, which lets you calculate its exact size of partition.

Step 1 — Read the raw bytes:

00 B0 23 03

Step 2 — Reverse them (little-endian):

03 23 B0 00

Step 3 — Convert hex to decimal:

03 23 B0 00 (hex) = 52,670,464 (decimal)

Step 4 — Multiply by sector size:

52,670,464 × 512 = 26,967,277,568 bytes
≈ 25.1 GB

C. MBR Signature

The very last two bytes of the entire 512-byte MBR. These are a hard-wired validity check. The BIOS/UEFI firmware reads these two bytes after loading the MBR and asks: are they 55 AA? Yes → valid MBR, proceed with boot. Anything else → halt and show a boot error. Malware targets these specifically because flipping just these two bytes makes the entire system unbootable instantly.

What if GPT?

GPT is a complete redesign of how disk structure is stored. Instead of cramming everything into a single 512-byte sector, GPT spreads across multiple sectors, maintains backup copies of everything, and uses cryptographic checksums to detect corruption instantly.

Before discussing anything, we need to know about few concepts:

  1. Mixed Endian — Some parts are little-endian, some are big-endian. GPT uses this for GUIDs.
  2. GUID (Globally Unique Identifier) — A 128-bit unique ID assigned to disks and partitions, formatted like C12A7328-F81F-11D2-BA4B-00A0C93EC93B. No two GUIDs are the same — it's like a fingerprint.

3. CRC32 (Cyclic Redundancy Check) — A checksum. The system calculates a number based on the data. If someone tampers with or corrups the data, the CRC32 value changes — acting as a tamper/corruption detector.

Structure of the GPT:

Unlike MBR which lived only in Sector 0, GPT spreads across multiple sectors and has 5 components:

Press enter or click to view image in full size

Component 1 — Protective MBR (Sector 0)

The very first sector of a GPT disk still looks like an MBR — but it’s a fake, dummy MBR. It exists purely to protect GPT disks from old BIOS systems that don’t understand GPT. Old BIOS systems expect to find an MBR in Sector 0. If they don’t, they might think the disk is blank and accidentally overwrite it. The Protective MBR says to the BIOS — “Yes, I’m an MBR, everything is fine, don’t touch anything.”

Component 2 — Primary GPT Header (Sector 1)

The real GPT begins here. The GPT Header is the master blueprint of your disk — it tells the system everything it needs to know about the disk’s layout. It only uses the first 92 bytes of the sector. The remaining bytes are padded with zeros.

Press enter or click to view image in full size

All 14 Fields Explained:

1. Signature (Bytes 0–7) Value: 45 46 49 20 50 41 52 54 This spells "EFI PART" in ASCI — 8 characters, one byte each. It identifies whether this sector is a valid GPT header at all or not. Always present at the very start.

2. Revision (Bytes 8–11) Value: 00 00 01 00 → Version 1.0 indicates which version of the GPT specification this disk uses. Almost always 1.0.

3. Header Size (Bytes 12–15) Value: 5C 00 00 00 are in little-endian → Reverse→ 00 00 00 5C → Decimal 92 Confirms the GPT header is 92 bytes long. Basically it tells how large the GPT header itself is.

4. CRC32 of Header (Bytes 16–19) This is the integrity seal of the GPT header itself. When the header is first written to disk, the computer calculates a CRC32 checksum — a mathematical fingerprint — across all 92 bytes of the header (with this field itself temporarily set to zero during calculation). Every time the computer boots, it recalculates the CRC32 of the header and compares it to this stored value. If they match, the header is intact. If they differ, even by a single bit, the computer knows the header has been corrupted or tampered with. It then looks at the Backup LBA field (field 7) to find the backup header and restores from it. This is GPT’s primary self-healing trigger.

5. Reserved (Bytes 20–23) These are the 4 bytes intentionally left empty — always set to zero. They serve as a reserve space: if a future version of GPT needs to add a small new field to the header, these bytes are available without having to redesign the entire header structure. You will always 00 00 00 00 here on any valid GPT disk. If you see anything other than zeros, something has gone wrong — or the disk was formatted by non-standard software.

6. Current LBA (Bytes 24–31) Value: 01 00 00 00 00 00 00 00 → Decimal 1
This field stores the sector number where this header itself is located. For the primary header, that is always LBA 1.

GPT keeps two identical copies of the header: one at the start of the disk (LBA 1) and one at the very end. Both copies are nearly identical, but they swap current LBA field and backup LBA field.

Press enter or click to view image in full size

7. Backup LBA (Bytes 32–39) → This field is the address of the partner header — the backup copy of the GPT header stored at the very end of the disk. For the primary header, Backup LBA points to the last sector of the disk. For the backup header, Backup LBA points back to LBA 1. Together, Current LBA and Backup LBA form a two-way handshake: each header knows exactly where it is and exactly where its partner lives. This is how the system knows where to find the backup if the primary gets corrupted.

Press enter or click to view image in full size

8. First Usable LBA (Bytes 40–47) The first sector where actual partition data can begin. Sectors from 0 to 33 before this are reserved for GPT’s own structures. The value 22 in hex = 34 in decimal, so LBA 34 is the first usable sector. If any partition started before LBA 34, it would overwrite these critical structures and destroy the disk layout. This field is the safety boundary. Any disk management tool creating a new partition checks this field first and ensures no partition starts before this value. Every partition’s individual Starting LBA must be greater than or equal to this number.

9. Last Usable LBA (Bytes 48–55) The last sector where partition data can end. Sectors after this are reserved for the backup GPT structures at the end of the disk — a full copy of the Partition Entry Array and the backup GPT header. No partitions can extend beyond this point. The usable space on your disk is therefore a defined window: from First Usable LBA to Last Usable LBA. Everything outside this window belongs to GPT’s own infrastructure. This is why you never get the full advertised disk capacity as usable space — a small number of sectors at both ends are consumed by GPT overhead.

10. Disk GUID (Bytes 56–71) A unique 16-byte identifier for this specific disk. No other disk in the world has the same GUID. Formatted as: 1DF1B0D6-43BE-374E-B1E6-3866ECB17389. Used to distinguish this disk from all others connected to the system. It also matters in forensics: if you clone a disk byte-for-byte, the clone inherits the same Disk GUID, which forensic tools detect as suspicious — two disks claiming the same identity. Each partition also has its own separate GUID stored in its partition entry. The Disk GUID here is specifically about the whole drive, not any individual partition.

11. Partition Entry Array LBA (Bytes 72–79) The field points to the sector where the Partition Entry Array begins — the master list of all partitions on the disk. The value is almost always LB2 (Sector 2), the sector immediately after the GPT header. The Partition Entry Array contains up to 128 records, each describing one partition. By storing this address explicitly rather than hardcoding it, GPT allows software to verify the array is where it expects it to be. If this field pointed to an unexpected location, it would immediately signal corruption or tampering.

12. Number of Partition Entries (Bytes 80–83) Value: 80 00 00 00 → Decimal 128 GPT always reserves space for 128 partitions, regardless of how many partitions you actually create. Even if your disk has only 3 partitions, the Partition Entry Array still contains 128 slots — the unused 125 are simply filled with zeros. Why? Because the array must be a fixed, known size before any partitions exist.

13. Size of Each Partition Entry (Bytes 84–87) Value: 80 00 00 00 → Decimal 128 bytes Each partition's entry in the Partition Entry Array takes up exactly 128 bytes. Not the partition's own size — just the size of its record in the table. So the total space the Partition Entry Array is:

128 entries * 128 bytes each = 16, 384 bytes

This is just multiplication — 128 slots, each slot is 128 bytes wide, so the entire table is 16,384 bytes total. And you know that each sector holds 512 bytes. So to find how many sectors 16, 384 bytes needs:

16,384 bytes ÷ 512 bytes per sector
= 32 sectors

The Partition Entry Array needs exactly 32 sectors — not 31, not 33. Perfectly fits with no leftover space. This is why it occupies LBA 2 through LBA 33:

LBA 2  = Sector 1 of the array
LBA 3 = Sector 2 of the array
LBA 4 = Sector 3 of the array
...
LBA 33 = Sector 32 of the array ← array ends here

14. CRC32 of Partition Array (Bytes 88–91) A checksum for the entire Partition Entry Array. If any partition entry is tampered with or corrupted, this checksum will fail and the system is alerted. Every time the system reads the partition table, it recalculates this checksum and compares it to the stored value. If even one byte in any partition entry has changed — due to disk corruption, a failing drive sector, or deliberate tampering — this checksum fails. The system then falls back to the backup GPT at the end of the disk, which has its own copy of the array with its own checksum. If the backup is intact, the primary is repaired automatically.

Component 3 — Partition Entry Array (Sectors 2–33)

This is the actual partition table of GPT — a list of all 128 partition entries, each exactly 128 bytes. It starts at Sector 2 and spans through Sector 33.

Each Partition Entry Has 6 Fields:

Press enter or click to view image in full size

1. Partition Type GUID (Bytes 0–15) Identifies what kind of partition this is — EFI System Partition, Windows data partition, Linux partition, etc. Stored in mixed-endian, so you need to reverse specific byte groups before reading. Once converted, you can look up the GUID online to find the partition type.

Example: C12A7328-F81F-11D2-BA4B-00A0C93EC93B = EFI System Partition

Press enter or click to view image in full size

2. Unique Partition GUID (Bytes 16–31) A unique identifier for this specific partition. No two partitions — even of the same type — share this GUID. Also stored in mixed-endian format.

Press enter or click to view image in full size

3. Starting LBA (Bytes 32–39) The sector number where this partition begins on the disk.

4. Ending LBA (Bytes 40–47) The sector number where this partition ends on the disk. The partition occupies every sector between Starting LBA and Ending LBA.

5. Attributes (Bytes 48–55): An 8-byte field where individual bits acts as flags — each bit being 0 or 1 switches a property on or off. Flags that describe special properties of the partition:

  • Is it required by the system (cannot be deleted)?
  • Is it bootable?
  • Is it hidden from the OS?

Press enter or click to view image in full size

For example, the EFI System Partition typically has Bit 0 = 1 (required, cannot be deleted) and Bit 2 = 1 (bootable).

6. Partition Name (Bytes 56–127) The human-readable name of the partition (e.g., “EFI System Partition”, “Basic Data Partition”). Encoded in UTF-16 format, taking up the remaining 72 bytes of the entry.

Press enter or click to view image in full size

This is purely for human readability — disk tools and partition managers display this name to you. The system itself uses the GUIDs, not this name, to identify partitions.

Component 4 — Your Actual Partitions (LBA 34 to Last Usable LBA)

This is the space where your C: drive, D: drive, and any other partitions live. Everything from LBA 34 to the Last Usable LBA is available for partition data. Each partition’s exact location is defined by the Starting LBA and Ending LBA in its partition entry.

Component 5 — Backup GPT (End of Disk)

GPT stores a complete backup of both the Partition Entry Array and the GPT Header at the very end of the disk. The backup Partition Entry Array comes first, followed by the backup GPT Header at the very last sector.

If the primary GPT Header or Partition Entry Array fails its CRC32 check, the system reads the Backup LBA from whatever it could parse of the primary, jumps to the end of the disk, and reads the backup. If the backup is intact, the primary is automatically restored. This is the self-healing system that MBR never had.

The EFI System Partition (ESP) — Critical Concept

The first partition on any GPT disk is almost always the EFI System Partition. This is where the bootloader files live — files with the .efi extension that are responsible for loading your operating system.

In MBR, the bootloader was crammed into the tiny 446 bytes of bootloader code in Sector 0. In GPT/UEFI, the bootloader is a collection of proper files stored in this dedicated partition — much more flexible and robust.

MBR approach:
┌─────────────────────────────────┐
│ Sector 0 — 512 bytes total │
│ ├── 446 bytes: Bootloader code │ ← entire bootloader crammed here
│ ├── 64 bytes: Partition table │
│ └── 2 bytes: Signature │
└─────────────────────────────────┘
446 bytes is tiny — barely enough for a basic bootloader

GPT/UEFI approach:
┌──────────────────────────────────────────┐
│ EFI System Partition (100 MB typical) │
│ ├── /EFI/Boot/bootx64.efi │ ← actual bootloader files
│ ├── /EFI/Microsoft/Boot/bootmgfw.efi │ ← Windows boot manager
│ ├── /EFI/ubuntu/grubx64.efi │ ← Linux bootloader
│ └── ... more .efi files │
└──────────────────────────────────────────┘
Hundreds of megabytes — full files, multiple OS bootloaders can coexist

With MBR, you had 446 bytes to work with. With GPT, you have an entire partition — typically 100 MB — filled with proper .efi files. This is why modern systems can dual-boot Windows and Linux cleanly, with each OS storing its own bootloader file in the ESP without conflicting.

Step 5 — Load Bootloader

After the system firmware (BIOS/UEFI) identifies the bootable partition using the MBR or GPT, it loads a more advanced program called the bootloader from that partition into memory. This bootloader (such as GRUB for Linux or Windows Boot Manager) is capable of understanding the disk’s filesystem, unlike the tiny first-stage code in the MBR. Its job is to locate the necessary operating system files, especially the kernel, and prepare the system for startup. In some cases, it also provides a menu that allows the user to choose between multiple operating systems or boot options. At this stage, the system transitions from very basic hardware-level instructions to a more intelligent program that can interact with stored data in a structured way.

Step 6 — Load OS

Once the bootloader has done its job, it loads the operating system’s kernel into RAM and transfers control to it. The kernel is the core of the operating system and is responsible for managing hardware, memory, processes, and system resources. After taking control, the kernel initializes essential components such as device drivers, sets up communication between hardware and software, and starts system services. This process eventually leads to the launching of the user interface, such as a login screen or desktop environment. At this point, the computer is fully operational, and the operating system is ready for user interaction.

The Full Boot Chain at a Glance

Power button pressed

CPU executes UEFI firmware

POST — hardware health check

Firmware reads boot order → selects disk

Reads Sector 0 → Protective MBR → identifies GPT disk

Reads Sector 1 → GPT Header → verifies CRC32

Reads Sectors 2–33 → Partition Entry Array → verifies CRC32

Finds EFI System Partition → mounts FAT32 filesystem

Loads bootmgfw.efi → Windows Boot Manager runs

Loads winload.efi → verifies Secure Boot signatures

Loads ntoskrnl.exe → Windows kernel takes control

Drivers, services, login screen → OS fully running

At any stage where a CRC32 fails, the system automatically attempts recovery from the backup GPT structures. At any stage where Secure Boot detects a signature mismatch, loading is refused. This layered resilience is what separates modern GPT-based systems from the fragile MBR-based boot process they replaced.

Why This Knowledge Matters

For cybersecurity: The structures covered here are the primary targets of the most sophisticated malware — bootkits — because they execute before the OS and therefore before any antivirus. Understanding these structures is prerequisite knowledge for understanding how bootkit attacks work and why Secure Boot was designed to counter them.

For digital forensics: The Starting LBA of every partition is recorded in the partition table even after the partition is deleted. A forensic analyst who knows how to read these entries can jump directly to former partition locations and recover data that the user believed was erased. The Disk GUID also persists through most deletions and can link a disk to a specific machine.

For system administration: When a disk fails to boot, understanding the chain above tells you exactly which component to investigate first — is the GPT Header corrupted? Is the ESP missing? Is the bootloader file absent? Each failure has a specific symptom and a specific repair procedure. Without this foundation, troubleshooting is guesswork.

The structures discussed here are not esoteric knowledge. They are the literal foundation that every piece of software on your computer depends on, every time it starts.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

This blog is written for students and beginners moving beyond surface-level understanding into how systems actually work — particularly those interested in cybersecurity, digital forensics, and operating systems.


文章来源: https://infosecwriteups.com/before-windows-loads-the-hidden-boot-architecture-every-tech-person-should-understand-d2217d9b0b2b?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh