Master boot record mbr/hard disk partition table dpt/primary partition, extended partition, and logical partition/PC boot process

Source: Internet
Author: User

Main boot Sector
The main boot sector is located on the entire hard disk 0 cylinder 0 Head 1 Sector {(cylinder, head, Sector) | ( 0,0,1)},bios will jump to the first instruction in the MBR after executing its own inherent program. Take control of the system to the MBR. The main boot sector consists mainly of three parts: the Master boot record MBR (master boot recording or main boot record), the partition table DPT (disk Partition table), and the end glyph.

For hard disks, the possible number of bytes for a sector is 128x2n (n=0,1,2,3). In most cases, the size of the n=2, that is, a sector (sector), is 512 bytes. In a total of 512byte master boot records, the MBR's bootloader accounted for the first 446 bytes (offset 0h~ offset 1BDH), followed by 64 bytes (offset 1beh~ offset 1FDH) for DPT (disk partitiontable, hard disk partition table), The last two bytes "1feh~" (offset, offset, 1FFH) is the partition valid end flag.

Master boot record MBR (Master boot Record)
The Master boot record contains a series of parameters and a boot program for the hard disk. The primary role of the hard disk bootstrapper is to check that the partition table is correct and boot the operating system on the partition that has the activation flag after the system hardware completes the self-test, and give control to the startup program. MBR is produced by a partitioner (such as Fdisk), which does not depend on any operating system, and the hard drive boot program can also be changed to enable multi-system booting.

Hard disk partition table DPT (Disk Partition table)
The hard disk partition table occupies 64 bytes (offset 01beh--offset 01FDH) of the MBR sector and can describe information for four partitions, where the information for each partition occupies 16 bytes. Specific definitions of each byte can be found in the hard disk partition structure information.

End marker Word
The end glyph 55,aa (offset 1feh-offset 1FFH) is the last two bytes of the MBR sector and is a flag that verifies that the master boot record is valid.

Computer startup process

    • The system is powered on or restarted.
    • BIOS Power On Self test-post. The BIOS performs a jump instruction at the memory address of ffff:0000h, jumps to the self-test program that is cured in ROM, and checks the system hardware (including memory).
    • Reads the master boot record (MBR) sector. When the BIOS checks that the hardware is healthy and matches the settings in the CMOS, the available boot devices are detected in the CMOS setup sequence for the boot device. The BIOS reads the first sector (that is, the MBR sector) of the corresponding boot device into the memory address at 0000:7c00h.
    • Check 0000:7DFEH-0000:7DFFH (MBR end flag bit) is equal to aa55h, if not equal to go to try other boot device, if no boot device meets the requirements, then display "No ROM BASIC" and then panic.
    • When a boot device is detected to meet the requirements, the BIOS gives control to the appropriate boot device. The MBR that initiates the device copies itself to the 0000:0600h, and then resumes execution.
    • In the primary partition table, search for the partition marked active, that is, the first byte of the DPT to verify the partition table is 80H. If 80H is detected, the partition is the active partition, and the first sector of the active partition (operating system boot record area, Dos boot RECORDER,DBR) is read into the memory address 0000:7c00h.
    • Check if the 0000:7DFEH-0000:7DFFH (DBR's end flag bit) is equal to aa55h, and if not equal then show: "Missing Operating System" and then stop.
    • When a partition is detected to satisfy the requirement, the MBR gives control to the corresponding active partition.

For short:
BIOS--hard disk MBR--active partition DBR--os

Primary boot sector and hard disk partitioning

From the structure of the main boot sector, it is possible to know that it contains only a 64-byte hard disk partition table. Because each partition information requires 16 bytes, it is possible to identify up to 4 primary partitions for a hard disk with MBR-type partition structure (the Disk volume label type is MS-DOS). Therefore, it is not possible to get more than 4 primary partitions for a hard disk with this partition structure. You need to draw out the extended partition here. The extended partition is also a primary partition, but it differs from the primary partition in that it can be divided into countless logical partitions.

The boot record for the logical drive in the extended partition is chained. Each logical partition has an extended boot record (EBR) similar to the MBR partition table structure, with the first entry of its partitioned table pointing to the boot sector of the logical partition itself, and the second pointing to the EBR of the next logical drive. For Windows systems, it is common to divide only one primary partition into the system, and the remaining portions are all zoned as extended partitions.


Blue is the primary partition, green, red, purple is the logical partition, Gray contains the logical partition is the extended partition;

 

Extending the contents of a partitioned table entry

Extended Partition Table entry Contents of a partitioned table entry
First item Information about the current logical drive in the extended partition, including the start address of the data
A second item Information about the next logical drive in the extended partition, including the address of the sector that contains the EBR of the next logical drive. If no further logical drives exist, the field will not be used
A third item Not used
Fourth item Not used

Master boot record mbr/hard disk partition table dpt/primary partition, extended partition, and logical partition/computer boot process

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.