MSDOS (MBR) and gpt--early Linux systems used MBR to process boot and partition tables, usually placed in the first sector of the disk (512 bytes), but the MBR partition can only crawl 2TB of capacity, and so on, the new partition format GPT resulting
a , MBR
The MBR is located in the first sector of the entire disk and is divided into three parts:
boot loader: The main function is to load the kernel into memory and boot the system to load
partition Table DPT(16 bytes): The partition information of the disk is saved, because the DPT has only 64 bytes, so it can divide up to four partitions, after all, the partition of the disk is only the division of DPT , of course, The system will reserve an extended partition (Extended), and the extended partition itself cannot create a file system format and continue dividing it so that more partitions (logical partitions) can be partitioned. And the first few sectors in each logical partition are also used to record partition information.
Each of these 16 bytes contains the following content:
First byte: 80 indicates active partition, 00 is inactive partition
Second byte: Represents the number of magnets, accounting for 8 bits
Third byte: High 2 bits, indicating cylinder number, low 6 bits, indicating sector code
Fourth byte: Represents the cylinder number, which occupies 8 bits
2nd 3 4-bit total 24 bits, (8-bit head, 10-bit cylinder, 6-bit sector) can represent 8G of space
Fifth byte: Record partition type, 0 means partition not used
Create partition default is 83, change to 8e:
Sixth byte: Represents the end of the head, accounting for 8 bits
Seventh byte: High 2 bit, cylinder end number, low 6 bit, sector end number
Eighth byte: Indicates the cylinder end number, which is 8 bits
Nineth bytes to 12th bytes: partition start LBA address, number of hidden sectors
13th bytes to 16th bytes: partition End LBA address, total sector number of partitions
Total 4*8=32 bit, can represent the space of 2T
End Glyph of AA
A logical partition has a EBR (512 bytes) before it, like the MBR structure, except that there is no data in the first 446 bytes in the EBR, 16 bytes in the first 16 bytes to the current logical partition, the second 16 bytes to the next EBR, and the remaining two 16 bytes unused, In short, hard disk use will first read the MBR, if the hard disk MBR is broken, then the entire hard disk will be broken.
Second, GPT
As the capacity of the hard disk becomes larger, the traditional MBR supported 2TB space has not been able to support the current large capacity of the hard disk, in which the GPT partition format, GPT using LBA processing, and the first LBA is LBA 0 (starting from 0 numbering )
Supports 128 partitions
Use a 128-bit UUID to represent a disk partition
UEFI-only boot mode is supported (traditional BIOS only supports MBR, if you want to boot only from GPT only using UEFI)
GPT uses 34 LBA chunks to record partition information, and to prevent the traditional MBR from having only one partition table limit, GPT uses the last 33 LBA of the disk as another backup
Structure:
LBA 0:pmbr (512 bytes)
For the traditional operating system default boot is MBR, so in order to ensure that the GPT can start only support MBR-only operating system, reserved 512 bytes as a protection MBR, its structure and MBR similar, where the 55AA is necessary, in the original partition table is now stored in the special flag partition, As GPT means, so that the management program that does not understand the GPT partition will not recognize the disk and further protect the disk.
LBA 1:GPT Partition Header
The LBA Block records the location and size of the partitioned table ,the location of the GPT backup area , and the check bit (CRC32), which can be used by the operating system to determine if the GPT is correct based on the check bit and, if wrong, to restore the GPT based on the last backup.
LBA 2-33: Partitioned table
Each LBA chunk can be divided into 4 partition records, so there can be a total of 4*32=128 partition records, each partition record 512/4=128 bytes, 64 bytes in 128 bytes to represent the start and end of the sector area code, so each partition maximum limit capacity is 2^64*512bytes=2^ 33tb=8zb.
. . . : Partition
The GPT format does not have the concept of extended partitioning, so each partition can be formatted
LBA N-32 ... LBA N: Backup area
Small tips: Theoretically the GPT format can be partitioned infinitely (128 or more), but if the partitioning is too large, it seems that the partition after 128 cannot be formatted for use.
Linux Learning-mbr and GPT