Detailed description of MBR partition structure and GPT partition structure

Source: Internet
Author: User

I. MBR partition structure

MBR disk partitioning is the most widely used partition structure. It is also called DOS partition structure, but it is not only used on Windows systems, but also in Linux, x86-based UNIX and other system platforms. It is located in the first sector of the disk 0, one sector is equal to 512 bytes), is an important sector referred to as MBR sector ).

The MBR sector consists of the following four parts:

Boot Code: The Boot Code occupies the first 440 bytes of the MBR partition and is responsible for starting the entire system. If the boot code is corrupted, the system cannot start.

Windows disk Signature: 4 bytes after the Boot Code. It is the disk tag written to the Windows initialization disk. If this tag is damaged, the system will prompt "initialize disk ".

MBR Partition Table: 64 bytes after the Windows disk tag. It is the Partition Table of the entire hard disk.

MBR end flag: occupies the last two bytes of the MBR sector and remains "55 AA ".

650) this. length = 650; "src =" "title =" 1.png" width = "468" height = "400" border = "0" hspace = "0" vspace = "0" style = "width: 468px; height: 400px; "alt =" wKioL1LKNVbgiJppAAHQQfWcPwQ942.jpg "/>

Note: The tool used by the author to analyze the disk is Winhex. If you need it, download it yourself.

The partition table structure is analyzed in detail below

The disk must be partitioned before use, that is, the hard disk is divided into logical areas. Each partition has a fixed start and end position. MBR disks are generally divided into three types: Primary partitions, extended partitions, and non-DOS partitions. Primary partitions are both primary DOS partitions and extended DOS partitions can be divided into logical partitions). Non-DOS partitions are a partition area for the operating system of the primary partition, only operating systems in non-DOS partitions can be managed.

The MBR partition table is as follows:

650) this. width = 650; "src =" "title =" 2.png" alt = "wKiom1LKNgyzkviIAACTxTAiH_Y413.jpg"/>

MBR occupies a total of 64 bytes, of which every 16 bytes is a partition table item. That is, only information about four partitions can be recorded in the MBR sector, which can be four primary partitions or three primary partitions and one extended partition.

The corresponding bytes in each partition item are described as follows:

650) this. length = 650; "src =" "title =" 3.png" width = "700" height = "387" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 387px; "alt =" wKioL1LKNlXCchlUAAFbjpz0d3s644.jpg "/>

650) this. length = 650; "src =" "title =" 4.png" width = "700" height = "252" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 252px; "alt =" wKiom1LKNu_xS0nCAAC7bgZMKmE917.jpg "/>

650) this. length = 650; "src =" "title =" 5.png" width = "700" height = "327" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 327px; "alt =" wKioL1LKN22TWqhvAAERmt888K4487.jpg "/>

650) this. length = 650; "src =" "title =" 6.png" width = "700" height = "414" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 414px; "alt =" wKiom1LKN6LDOsMdAAFADGBiJ4A015.jpg "/>

Structure Analysis of extended partitions

Since MBR only reserves 64 bytes of storage space for the partition table, each partition occupies 16 bytes of space, that is, it can only be divided into four partitions, in practice, the four partitions are not enough. As a result, there is an extended partition. The partition information of each logical partition in the extended partition is stored in an extended Boot Record (EBR) similar to MBR, the extended boot records include the partition table and the ending mark "55 AA" without the Boot Code section.

650) this. length = 650; "src =" "title =" 7.png" width = "700" height = "387" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 387px; "alt =" wKioL1LKN-Kj6j8OAAFhlbN46B4606.jpg "/>

For example, the first item of the partition table in EBR describes the first logical partition, and the second item points to the EBR of the next logical partition. If the next logical partition does not exist, the second partition is not required.

The structure of the MBR partition is roughly described here. If the MBR of the hard disk is damaged, you can copy the MBR of another hard disk to the faulty disk, repair the partition table, or initialize the faulty disk and then repair the partition table.

Ii. GPT partition structure

Basic Features of GPT disk partitioning

The GPT disk partition structure solves the disadvantages that MBR can only be divided into four primary partitions. Theoretically, the GPT disk partition structure seems to have no limit on the number of partitions. However, some operating systems may have limits on this.

The partition structure of the GPT disk consists of six parts, for example:

650) this. length = 650; "src =" "title =" 8.png" width = "700" height = "203" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 203px; "alt =" wKiom1LKQX7zOkrSAABNDHxLhq4451.jpg "/>

1. MBR Protection

Protection MBR is located in the first sector of the GPT disk, that is, sector 0. It has a disk signature, a MBR disk partition table, and an ending sign. There is no boot code. In addition, a partition table has only one partition table item. This table item GPT is not required at all, just to make the system think the disk is legal.

650) this. length = 650; "src =" "title =" 9.png" width = "700" height = "193" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 193px; "alt =" wKiom1LKSF7SZd_BAACDsiSCWBo629.jpg "/>

2. GPT Header

The GPT header is located in the second GPT disk, that is, Sector 1. This sector is generated when a GPT disk is created. The GPT header defines the start position of the partition table, the end position of the partition table, the size of each partition table item, the number of Partition Table items, and the checksum of the partition table.

650) this. width = 650; "src =" "title =" 10.png" alt = "wKiom1LKSKbx49XOAAB95x1ZyKM823.jpg"/>

The meanings of parameters in the GPT header are described as follows:

650) this. length = 650; "src =" "title =" 11.png" width = "700" height = "230" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 230px; "alt =" wkiom1lksnwqbhwbaadzklmsqq667.jpg "/>

3. Partition Table

The partition table is located on disk No. 2-33 of the GPT disk. It occupies 32 sectors and can accommodate 128 Partition Table items. The size of each partition table item is 128 bytes. Because each partition table item manages a total of partitions, Windows allows a GPT disk to create 128 partitions.

Each partition table item records the start, end address, GUID of the partition type, partition name, partition attribute, and partition GUID.

650) this. width = 650; "src =" "title =" 12.png" alt = "wKioL1LKSSbwft0fAAC7B9dwnXU848.jpg"/>

The meanings of parameters in the Partition Table items are described as follows:

650) this. length = 650; "src =" "title =" 13.png" width = "700" height = "100" border = "0" hspace = "0" vspace = "0" style = "width: 700px; height: 100px; "alt =" wKiom1LKSUHTowAAAABrpN_N6iM090.jpg "/>

4. Partition Area

The GPT partition area is the partition used by the user and the region where the user stores data. The start address and end address of the partition area are defined by the GPT header.

5. GPT header backup

The GPT header has a backup, which is placed in the last sector of the GPT disk. However, this GPT header backup is not completely GPT header backup, and some parameters are somewhat different. You can change it as needed during replication.

6. Partition Table backup

After the partition area ends, the partition table is backed up. Its address is described in the GPT header backup sector. Partition Table backup is a complete backup of 32 sectors in the partition table. If the partition table is damaged, the system automatically reads the Partition Table backup and ensures that the partition is recognized normally.

The partition structure of GPT is much simpler than MBR, And the partition table and GPT header are backed up.

Author: Deng Qi

TEL: 18911808630

This article is from "Deng Qi's Blog" Blog, please be sure to keep this source

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.