Hard Disk structure, Master Boot Record MBR, Hard Disk Partition Table DPT, Master partition, extended partition and logical partition, PC Startup Process

Source: Internet
Author: User

The filex file system is in the fog. Let's summarize some basic knowledge about fat first.

Hard Disk Structure
A hard disk consists of multiple disks, each of which has a read/write head. If n disks exist. There are 2n faces, corresponding to 2N head (heads), starting from 0, 1, 2. The radius of each disc is the concentric circle of the fixed value R and then logically forms a cylinders with the motor Spindle as the axis, numbered 0, 1, 2... from the outside ....... Each track on each disk is divided into dozens of sectors (sector). The general capacity is 512 bytes and is numbered 1, 2, 3, etc. according to certain rules ...... Multiple cylinders × heads × sector sectors are formed.


Primary Boot Sector
The primary Boot Sector is located in the entire hard disk, with 0 cylinders, 0 heads, 1 sectors {(cylinder, Head, Sector) | (0, 0, 1 )}, after the BIOS executes its own program, it will jump to the first instruction in MBR. Control of the system is handed over to MBR for execution. The primary boot sector consists of three parts: the primary Boot Record MBR (Master Boot Record or Main Boot Record), the hard disk partition table DPT (Disk Partition Table), and the ending flag.



For a hard disk, the possible number of bytes in a sector is 128 x 2n (n = ). In most cases, take n = 2, that is, the size of a single sector (sector) is 512 bytes. In the master boot records of a total of 446 bytes, the MBR boot program occupies the first bytes (offset 0 h ~ Offset 1bdh), followed by 64 bytes (offset 1beh ~ Offset 1fdh) is DPT (Disk partitiontable, Hard Disk Partition Table), and the last two bytes are "55 AA" (offset 1feh ~ Offset 1ffh) indicates the effective end of the partition.

Master Boot Record (MBR)
The Master Boot Record contains a series of Hard Disk parameters and a boot program. The main function of the hard disk boot program is to check whether the partition table is correct and boot the operating system on the partition with the activation mark after the system hardware completes the self-check, and hand the control to the boot program. MBR is generated by a partition program (such as fdisk). It does not rely on any operating system, and the hard disk boot program can also be changed to implement multi-system boot.

Disk Partition Table (DPT)
The Hard Disk Partition Table occupies 64 bytes of the MBR sector (offset 01beh -- offset 01fdh). You can describe the information of the four partitions. The information of each partition occupies 16 bytes. For the definition of each byte, see hard disk partition structure information.


Ending flag
The ending flag is 55, and AA (1feh offset-1ffh offset) is the last two bytes of the MBR sector, which indicates whether the Master Guide record is valid.

Computer Startup Process

  • Start or restart the system.
  • Power on self test -- post ). The BIOS executes the jump command at the memory address FFFF: 0000 h, jumps to the self-check program solidified in the Rom, and checks the system hardware (including memory.
  • Read the primary Boot Record (MBR) sector. When the BIOS detects that the hardware is normal and consistent with the settings in CMOS, it checks the available boot devices according to the setup sequence of the boot devices in CMOS. The BIOS reads the first sector (that is, the MBR sector) of the device to the memory address 0000: 7c00h.
  • Check whether 0000: 7dfeh-0000: 7 dffh (MBR end flag) is equal to aa55h. If not, try another Startup Device, if the device is not enabled, the system displays "no rom basic" and then crashes.
  • When a Startup Device is detected to meet the requirements, the BIOS gives control to the corresponding Startup Device. Start the MBR of the device and copy it to 0000: 0600h. Then proceed.
  • Search for active partitions in the primary partition table to check whether the first byte of DPT in the disk partition table is 80 h. If 80 h is detected, the partition is an active partition. Read the first sector of the active partition (Operating System Boot Record area, DOS boot recorder, DBR) to the memory address 0000: 7c00h.
  • Check whether 0000: 7dfeh-0000: 7 dffh (the end flag of DBR) is equal to aa55h. If not equal, the system is displayed as "missing Operating System" and then stopped.
  • When a partition is detected to meet the requirements, the MBR gives control to the corresponding active partition.

For short:
BiOS> hard disk MBR> active partition DBR> Operating System

Primary Boot Sector and hard disk partition

It can be seen from the structure of the primary boot sector that it only contains a 64-byte hard disk partition table. Because each partition information requires 16 bytes, a hard disk using an MBR partition structure (its disk volume type is MS-DOS) can only recognize up to four primary partitions. Therefore, it is impossible for a hard disk to have more than four primary partitions. Here we need to introduce the extended partition. Extended partitions are also a type of primary partition, but they differ from primary partitions in that they can be divided into countless logical partitions.

The boot records of the logical drive in the extended partition are chained. Each logical partition has an extended guidance record (EBR) similar to the MBR partition table structure. The first entry of the Partition Table points to the guidance sector of the logical partition, the second option points to the EBR of the next logical drive. For Windows systems, only one primary partition is divided into extended partitions.


Blue indicates the primary partition; green, red, and purple indicate logical partitions; gray indicates logical partitions are extended partitions;


Extended Partition Table item content

Extended Partition Table item Partition Table item content
Item 1 Information related to the current logical drive in the extended partition, including the data start address
Item 2 Information about the next logical drive in the extended partition, including the address of the EBR sector that contains the next logical drive. This field is not used if no further logical drive exists.
Item 3 Unused
Item 4 Unused


Reference:
Http://zh.wikipedia.org/zh-cn/%E4%B8%BB%E5%BC%95%E5%AF%BC%E6%89%87%E5%8C%BA
Www.raid-recovery.org/article/sjhfdoc/200404/1.html

Www.pcguide.com/ref/hdd/file/structpartitions-c.html
Www.msexchange.org/tutorials/disk-geometry.html

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.