MBR primary Boot Sector resolution and mbr Boot Sector resolution

Source: Internet
Author: User

MBR primary Boot Sector resolution and mbr Boot Sector resolution

Recently, the structure of the MBR main guide sector needs to be studied in a simple way during image production. Here we record the structure to facilitate later review. Next we will go directly to the question:

The MBR primary Boot Sector is located in the first sector of the disk, that is, the 0 sector. It consists of three parts: the boot code, the partition table, and the ending mark, accounting for 512 bytes in total.

The following describes the overall structure of the MBR primary Boot Sector:

 

1. Pilot code

In the yellow box, the boot program occupies the first 446 bytes of the sector. After the computer completes BIOS self-check after power-on, it will load the Main Boot Sector to the memory and execute the boot program of the first 446 bytes. The BOOT program will first find the active partition in the partition table, if an active partition exists, locate the address of the boot sector on the active partition based on the offset of the active partition, load the Boot Sector to the memory, and check the validity of the boot sector, then boot the operating system according to the rules of the boot sector. In some non-boot disks, the MBR Boot Code may be 0, which has no impact on disk usage.

2. Partition Table

The area in the blue box is a partition table, which occupies 64 bytes in the middle of the sector. Partition tables are the most important part of disk management. You can use partition table information to locate partitions and access user data. A partition table contains four partition items. Each partition item uniquely identifies a primary partition or an extended partition by location offset and partition size. Each partition item occupies 16 bytes, including the guide ID, CHS parameters for the start and end positions, partition type, start sector, and partition size. The specific descriptions are as follows:

 

Note that the 1st bytes of the partition item indicates whether the partition is an active partition, that is, whether the partition contains the System Boot Sector, which is used to guide the operating system. Each disk can have only one active partition at a time. The Boot indicator of the active partition is 0x80, and the others are 0x00. Although we can use some tools to manually modify the boot indicator, however, the bootstrap only looks for and uses the active partition with the first boot indicator 0x80.

3. End mark

The last "55 AA" in is the ending sign, or the magic number, occupying the last 2 bytes of the slice. During each execution of the System Boot Code, the system checks whether the last 2 bytes of the MBR primary Boot Sector are "55 AA". If yes, the subsequent program will be executed. Otherwise, this is regarded as an invalid MBR Boot Sector and the boot system is stopped.

 

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: info-contact@alibabacloud.com 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.