The difference between disk MBR and GPT

Source: Internet
Author: User

Basic disks vs. dynamic disks
The way disks are used can be divided into two categories: one is "basic disk". Basic disks are very common, and the types of disks we use are basically "basic disks". "Basic Disk" is limited by 26 English letters, which means that the drive letter of the disk can only be one of the 26 English characters. Since A and B are already occupied by the floppy drive, there are actually only c~z 24 disk drives available. Also, you can only create four primary partitions on basic disks (note that the primary partition is not an extended partition), and the other disk type is dynamic disk. "Dynamic Disk" is not limited by 26 English letters, it is named with "Volume". The biggest advantage of dynamic disks is the ability to extend disk capacity to non-contiguous disk space.
A dynamic hard disk is an upgrade of a local hard disk in Disk Manager. The biggest difference between a dynamic disk and a basic disk is that it is no longer a previous partitioning method, but rather a volume set (Volume), which is divided into simple volumes, spanned volumes, striped volumes, mirrored volumes, RAID-5 volumes. There are several differences between a basic disk and a dynamic disk:
1, Volume set or number of partitions. There is no limit on the number of volume sets that a dynamic disk can create on one hard disk. A basic disk can only have a maximum of four primary partitions on a single hard disk.
2, disk space management. Dynamic disks can create partitions of different disks into a volume set, and these partitions can be non-contiguous, which is the total size of several disk partitions. Basic disks cannot be partitioned across hard disks and require partitions to be contiguous, with each partition having a maximum capacity of only a single hard disk, and no increase in access speed compared to a single hard drive.
3, Disk capacity size management. Dynamic disks allow us to resize dynamic disks without restarting the machine, without losing or corrupting existing data. Once a partition of a basic disk is created, the capacity cannot be changed unless the third-party disk utility software, such as PQ Magic, is used.
4, disk configuration information management and fault tolerance. Dynamic disks Place disk configuration information on disk, and if a raid fault-tolerant system is replicated to other dynamic disks, it can take advantage of RAID-1 's fault tolerance, and if a hard disk is damaged, the system automatically calls the data of the other hard disk to maintain the integrity of the data. The basic disk stores the configuration information in the boot area without fault tolerance.
A basic disk can be converted to a dynamic disk directly, but the process is irreversible. To get back to the basic disk, you only have to copy all of the data and then delete all the partitions of the hard disk before you can return.

MBR partition table:

In traditional hard disk partitioning mode, the boot sector is the first sector of each partition (Partition), and the primary boot sector is the first sector of the hard disk. It consists of three parts, master boot record MBR, hard disk partition table DPT and hard disk valid flag. The MBR occupies 446 bytes in a total of 512 bytes of the main boot sector, the second part is the partition table area (partition table), the DPT, which accounts for 64 bytes, how many partitions are in the hard disk, and the size of each partition is recorded in it. The third part is the magic number, which accounts for 2 bytes and is fixed at 55AA.

One sector of the hard disk master boot record MBR consists of 4 parts.

    • The Master Boot program (offset address 0000h--0088h), which is responsible for loading from the active partition and running the system boot program.
    • Error message data area, offset address 0089h--00e1h is an error message, 00e2h--01bdh is all 0 bytes.
    • The partition table (Dpt,disk Partition table) contains 4 partition entries, offset address 01BEH--01FDH, 16 bytes per partition table entry, 64 bytes for partition entry 1, partition entry 2, partition entry 3, and partition item 4.
    • The end glyph, offset address 01fe--01ff, has a 2-byte value of end flag 55AA, and the system cannot start if the flag is incorrect.

Limitations of MBR
MBR means "Master boot Record", which was first presented in IBM PC DOS 2.0 in 1983.
The "Master boot Record" is called because it is a special boot sector that exists in the start part of the drive. This sector contains logical partition information for the boot loader and drive of the installed operating system. The so-called bootloader is a small piece of code that is used to load larger loaders on other partitions on the drive. If you have installed the initial information for the Windows,windows boot loader in this area-if the MBR information is overwritten causing Windows to not start, you will need to use the MBR Repair feature of Windows to get it back to normal. If you have Linux installed, it will usually be the grub loader in the MBR.
The MBR supports a maximum of 2TB disks, and it cannot handle disks larger than 2TB capacity. MBR also supports only up to 4 primary partitions--if you want more partitions, you need to create so-called "extended partitions" and create logical partitions in them.
MBR has become the industry standard for disk partitioning and startup.

GPT Partition table:

GPT partition information is in the partition, not like MBR in the main boot sector, in order to protect GPT from the MBR class Disk management software, GPT in the main boot sector to establish a protection partition (protective MBR) MBR partition table (this partition is not necessary), This type of partition is identified as 0xEE, the size of the protected partition under Windows 128mb,mac OS x 200MB, in the window Disk Manager named GPT protected Partition, you can have MBR class Disk management software to the GPT as an unknown format of the partition, Instead of mistakenly treating it as an unpartitioned disk.

The advantages of GPT
GPT means a GUID partition table. (The GUID means a globally unique identifier). This is a new standard that is gradually replacing the MBR. It complements the UEFI--uefi to replace the old BIOS, while GPT replaces the old MBR. It is called a GUID partition table because each partition on your drive has a globally unique identifier (globally unique identifier,guid)-a randomly generated string You can guarantee that each GPT partition on the earth is assigned a completely unique identifier.
This standard does not have those limitations of MBR. Disk drive capacity can be much larger than the operating system and file systems are not supported. It also supports an almost unlimited number of partitions, limiting only that the operating system--windows supports up to 128 GPT partitions, and you do not need to create an extended partition.
On an MBR disk, the partition and boot information is saved together. If this part of the data is overwritten or destroyed, things will be in trouble. In contrast, GPT keeps a copy of this information on the entire disk, so it is more robust and can restore this piece of information that is corrupted. GPT also maintains a cyclic redundancy check code (CRC) for this information to ensure it is complete and correct-if the data is corrupted, GPT will detect the damage and recover from other places on the disk. The MBR is powerless on these issues-only after the problem has occurred can you find that the computer is not booting, or that the disk partitions are missing.

Compatibility
A drive that uses GPT will contain a "protective mbr". This MBR will assume that the GPT drive has a partition that occupies the entire disk. If you use the Honest MBR disk utility to manage GPT disks, you will only see a partition that occupies the entire disk. This protective MBR guarantees that older disk tools do not treat GPT disks as empty disks without partitions and overwrite the existing GPT information with MBR. In addition, to protect the partitioned table, the GPT partition information is saved at the head and tail of each partition so that the partition table is lost and then resumed.

MBR, known as Master boot Record, is the master boot recording of the hard disk.
To facilitate understanding, the MBR is generally divided into generalized and narrow two: The generalized MBR contains the entire sector (boot program, partition table and delimited identity), which is referred to as the main boot record, and the narrow-sense MBR refers only to the boot program.
The hard disk's 0 cylinders, 0 heads, and 1 sectors are referred to as the primary boot sector (also called the Master Boot Record MBR). It consists of three parts, the master boot program, the hard disk partition table DPT, and the hard disk valid flag (55AA). The Master boot program (boot loader) occupies 446 bytes in a total of 512 bytes of the main boot sector, and the second part is the partition table area (partition table), which is the DPT, which accounts for 64 bytes, how many partitions are in the hard disk, and the size of each partition. The third part is the magic number, which accounts for 2 bytes and is fixed at 55AA.
The MBR is not part of any operating system, nor can it be read with the disk operation commands provided by the operating system, but may be modified and rewritten through commands, such as in Minix3, which can be used with commands: Installboot-m/dev/c0d0/usr/mdec/ Masterboot to masterboot This small program written in the MBR, Masterboot usually written in assembly language. We can also read out the contents of the sector using the INT13h 2nd function provided in Rom-bios, and also use the DISKEDIT.EXE in the software tool Norton8.0.
The calling parameters for the read disk sector function with INT13h are as follows:
Entry parameter: ah=2 (Specify function number)
Al= number of sectors to read
dl= disk number (0, 1-floppy; 80, 81-hard disk)
Dh= Magnetic Number One
CL High 2-bit +ch= cylinder number
CL Low 6 bit = Sector code
cs:bx= memory buffer address for storing read data
Export parameters: cs:bx= read data storage address
Error message: Cf=1 ah= error code if error
Use Debug to read on the hard disk 0 cylinder, 0 heads, 1 sectors operation as follows:
A>debug
-A 100
Xxxx:xxxx MOV ax,0201 (read 1 sectors with function number 2)
Xxxx:xxxx MOV bx,1000 (the address of the read-out data into the buffer is cs:1000)
Xxxx:xxxx MOV cx,0001 (read 0 cylinder face, 1 sectors)
Xxxx:xxxx MOV dx,0080 (Specify 0 heads of the first physical disk)
Xxxx:xxxx INT 13
Xxxx:xxxx INT 3
Xxxx:xxxx (Press Enter)
-G=100 (execute above procedure)
-D 11FF (displays 512 bytes of MBR content)
Under Windows operating system, such as XP,2003,VISTA,WINDOWS7, there are interfaces provided by Microsoft to read and write MBR directly;
FILE * Fd=fopen ("\\\\.\\physicaldrive0", "rb+");
Char buffer[512];
Fread (BUFFER,512,1,FD);
Then you can edit buffer[512] as your wish ...
Fseek (Fd,0,seek_set); is important
Fwrite (BUFFER,512,1,FD); Write the modified MBR to your machine
Fclose (FD); Done
MBR composition
The HDD master boot record for a sector is comprised of 4 parts shown in the MBR by 6-15.
• The master boot program (offset address 0000h--0088h), which is responsible for loading from the active partition and running the system boot program.
• Error message data area, offset address 0089h--00e1h is an error message, 00e2h--01bdh is all 0 bytes.
• Partition table (Dpt,disk Partition table) with 4 partition entries, offset address 01BEH--01FDH, each partition table entry is 16 bytes long, a total of 64 bytes are partition item 1, partition item 2, partition item 3, partition item 4.
• End glyph, offset address 01fe--01ff 2 byte value for end flag 55AA, if the flag is incorrect the system cannot start.

Supplemental Knowledge: EFI (extensible Firmware Interface)  
    Extensible Firmware Interface (English name extensible Firmware Interface or EFI) is by Intel, A company that dominates the development of PC technology has introduced an alternative to BIOS upgrades in future PC-like PC systems. The rise of BIOS technology stems from the popularity of IBM Pc/at machines and the first "clone" PC developed by Compaq. During PC startup, the BIOS assumes responsibility for initializing hardware, detecting hardware functions, and booting the operating system, and in the early days, the BIOS also provides a set of runtime service programs for use by the operating system and applications. The BIOS program is stored in a read-only memory that is not lost after a power-down, and the address of the first instruction of the processor is located in the memory of the BIOS when the system is power-up, allowing the initialization program to be executed.  

Efi generation

    As we all know, Intel has led the x86 series processor-based PC technology trend for nearly 20 years, and its products such as CPUs, chipsets, etc. occupy an absolute leading position in the PC production line. As a result, many believe the move is an indication of Intel's ambition to meddle in the market for firmware products. In fact, EFI technology is the result of the launch of the Intel Itanium processor platform. The Itanium processor is a 64-bit new architecture that has been designed by Intel's high-end market to target the server for nearly a decade, with the x86 series completely different. With the x86 series processors entering the 32-bit era, the new processor (I80386) retains its 16-bit operating mode (real mode) for compatibility reasons, and this operation is retained by successive processor upgrades. Even in a Xeon series processor with 64-bit extension technology, the processor is switched to a 16-bit real mode operation when power-on starts. Intel blames this situation on the slow development of BIOS technology. Since the PC compatibility maker has copied the first BIOS source program through the cleanroom, the BIOS has existed for more than 10 years in the form of 16-bit assembler code, register parameter invocation, static link, and memory fixed address of 1MB or less. Although due to the efforts of the major BIOS manufacturers in recent years, there are many new elements added to the product, such as PnP BIOS,ACPI, traditional USB device support and so on, but the basic nature of the BIOS has not been changed. This forces Intel to consider adding a compatibility mode that significantly reduces performance when developing newer processors. Someone once made a metaphor: it's like a Porsche new generation of fully automatic sports cars being put on a crappy gear.  
However, the Itanium processor has no such concern, it is a new processor architecture, and the interface between the system firmware and the operating system can be completely redefined. And this time, Intel defines it as an extensible, standardized firmware interface specification that differs from the traditional bios of a fixed, lack of documentation, completely based on empirical and obscure conventions of a fact standard. EFI's first system product has been around for more than five years now, and Intel is trying to extend the technology that has been successfully used on high-end servers to the PC product line, which has a more competitive market share, and is committed to full technical support over the 2006-year period.  

Compare EFI and BIOS

    A notable difference is that EFI is a modular, C-style parameter stack transfer, dynamic link form of the system, more easy to implement, more fault-tolerant and error-correcting features, shorten the system development time. It runs in 32-bit or 64-bit mode, and in the future enhanced processor mode, breaking the traditional 16-bit code addressing capability to reach maximum processor addressing. It uses the form of loading EFI drivers to identify and manipulate the hardware, unlike the BIOS that increases hardware functionality by using a Mount Real mode interrupt. The latter must place a driver-like 16-bit code in a fixed 0x000c0000-to-0x000dffff storage area and run the initialization portion of the code, which will mount the interrupt vectors in real mode to other programs. For example, VGA graphics and text output interrupts (int 10h), Disk access interrupt service (int 13h), and so on. Because of this limited storage space (128KB), the BIOS is powerless to place the required drive code larger than the size of the space. In addition, the BIOS hardware service program is already in the form of 16-bit code, which makes it difficult for the operating system running in enhanced mode to access its services. As a result, the BIOS provides services that can only be used in real-world operating system boot programs or MS-DOS class operating systems. The drive under the EFI system is not made up of code that can run directly on the CPU, but is written in EFI Byte code. This is a set of virtual machine instructions that are specific to the EFI driver and must be interpreted to run under the EFI Driver Runtime Environment (Driver execution Environment, or DXE). This guarantees full backwards compatibility, for example, an EFI-powered expansion device that can be installed on an Itanium processor system or in a new PC system that supports EFI, and its EFI driver does not need to be rewritten. This eliminates the need for any consideration of the compatibility factors associated with system upgrades. In addition, because EFI driver development is simple, all PC component providers can participate, the situation is very similar to the modern operating system development mode, this development model has made windows in a short span of two or three years to become a powerful, superior performance operating system. EFI-based drive models can make the EFI system accessible to all hardware features, and browsing the World Wide Web site before operating the OS runs is no longer a fantasy or even a simple implementation. This is an impossible task for a system based on a traditional bios, and adding a few simple USB device support to the BIOS has made many BIOS designers miserable, not to mention the addition of support for countless network hardware, and the creation of a TCP/IP stack in 16-bit mode.  
Some people think that the BIOS is nothing more than a trivial part of the compatibility issue, and it is not worth the effort to upgrade it too much. Opponents believe that when the advent of the BIOS restricts the development of PC technology, someone must make the necessary changes to it.

EFI and operating system

EFI is conceptually very similar to a low-order operating system and has the ability to manipulate all hardware resources. Many people feel that its continuous development will likely replace the modern operating system. In fact, EFI's creators have limited EFI's capabilities to the dominance of the operating system when the first edition of the specification is introduced. First, it is only the interface specification between the hardware and the pre-boot software, and secondly, the EFI environment does not provide an interrupt access mechanism, that is, each EFI driver must be polled to check the hardware status, and need to operate in an interpreted manner, less than the operating system drive efficiency; The EFI system does not provide complex memory protection functions, it only has a simple memory management mechanism, in particular, is running in the x86 processor in the Segment protection mode, with maximum addressing capacity of the memory is divided into a flat segment, all programs have access to any part of the location, does not provide real protection services. When all EFI components are loaded, the system can turn on an operating system shell-like command interpretation environment, where users can tune in to execute any EFI application, which can be hardware detection and debugging software, boot management, setup software, operating system boot software, and so on. Theoretically, there is no limit to the functionality of the EFI application, and anyone can write such software, and the effect is more ornate and more powerful than the previous MS-DOS software. Once the boot software gives control to the operating system, all service code used to boot will stop working, and some run time service programs can continue to work so that the device can continue to be used when the operating system cannot find a driver for a particular device.

The composition of EFI

It is generally assumed that EFI consists of the following parts:
1. Pre-efi Initialization Module
2. EFI drives the execution environment
3. EFI Driver
4. Compatibility support Module (CSM)
5. EFI High-level applications
6. GUID Disk partition


    in implementation, the EFI initialization module and the drive execution environment are typically integrated into a read-only memory. The Pre-efi initialization program is executed first when the system is powered on, and it is responsible for initializing the initial CPU, main bridge and memory, and then loading the EFI Driver Execution Environment (DXE). When DXE is loaded into the runtime, the system has the ability to enumerate and load other EFI drivers. In a PCI architecture-based system, the EFI drivers for each PCI bridge and PCI adapter are loaded and initialized sequentially, and the system then enumerates and loads the various bus and device drivers behind each bridge and adapter, again and again, until the last device driver is successfully loaded. Because of this, the EFI driver can be placed anywhere on the system, as long as it is guaranteed to be correctly enumerated in order. For example, an ATAPI mass storage adapter with a PCI bus interface, whose EFI driver is typically placed in the PCI-compliant extended read-only memory (PCI Expansion ROM) of this device, when the PCI bus driver is loaded and begins enumerating its sub-devices, This storage adapter is immediately recognized and loaded with its drivers. Some EFI drivers can also be placed on the EFI dedicated partition of a disk as long as these drivers are not necessary to load the drive for this disk. In the EFI specification, a GUID disk partitioning system (GPT) that breaks the traditional MBR disk partition structure limit is introduced, and the number of partitions in the new structure is no longer restricted (only 4 primary partitions exist under the MBR structure), and the partition type is represented by a GUID. Among the many partition types, the EFI system partition can be accessed by the EFI system for storing part of the drivers and applications. Many people worry that this will lead to new security factors, because the EFI system is more susceptible to computer virus attacks than the traditional bios, and when some of the EFI drivers are compromised, the system is likely to face a situation that is not bootable. In fact, the EFI drivers that the system boot relies on are usually not stored in the EFI GUID partition, and can be recovered in a simple way even if the driver in the partition is compromised, consistent with the storage habits of the drivers under the operating system. CSM is a special module in the EFI system of the x86 platform that provides system services similar to the traditional BIOS for operating systems that do not have EFI boot capabilities.  

EFI's development

Intel is undoubtedly promoting EFI's positive factors, in recent years, due to the industry's understanding of its deepening, more manufacturers are investing in this research. Some PC manufacturers, including Intel and AMD, have jointly established the Joint Extensible Firmware Interface Forum, which will launch the first edition of the specification in the near future. The organization will take over the task of planning EFI development and interpret Intel's EFI framework as a concrete implementation of this specification. In addition, the major BIOS providers such as Phoenix, AMI, etc., were originally considered to be the power of EFI development, and now also continue to introduce their own solutions. Analysts point out that this is due to the fact that BIOS vendors have re-located market locations such as the Pre-efi startup environment in the EFI architecture, but with the successful use of EFI on PC systems and the launch of the Intel Next generation chipset, this portion of the market share will not be expected to be under Intel's control.

About UEFI
The graphical hardware setup interface in UEFI extensible Firmware Interface (EFI, Extensible Firmware Interface) is the recommended standard for Intel's architecture, interfaces, and services for new types of PC firmware. Its primary purpose is to provide a set of correctly specified startup services that are consistent across all platforms before the OS is loaded, and are seen as a successor to the PC BIOS with a history of nearly more than 20 years.
Because of the popularity of computer education, many people know that the BIOS is the basic input/output system, translated into Chinese is "basic input/output systems", is a so-called "firmware", responsible for hardware startup and detection at boot time, and as the operating system control hardware intermediary role.
However, those are the things of the past DOS era, since the advent of Windows NT, Linux began to emerge, these operating systems have previously needed to be completed through the BIOS of the hardware control program is done in the operating system, no longer need to invoke the BIOS function. In general, today's so-called "computer whiz", mostly using the BIOS to do some overclocking hardware performance, in addition to professionals, few people use the BIOS for the underlying work.
Because of the rapid development of hardware, the traditional (Legacy) BIOS has become a burden of progress, has now developed the latest EFI (extensible Firmware Interface) Extensible Firmware Interface, in the current traditional BIOS view, the future will be a "no specific BIOS "in the computer age.
UEFI was developed on the basis of EFI1.10, whose owner is no longer intel, but a unified EFI Form (www.uefi.org) of the international organizations, contributors have Intel,microsoft,ami, such as several manufacturers, belong to open source, the current version is 2.1. The biggest differences compared to the legacy BIOS are the following:
1. The code 99% is completed by C language;
2. A new way to change the previous interrupt, hardware port operation, and adopt driver/protocal;
3. X86 mode will not be supported, and the direct use of flat mode (that is, no DOS, now some EFI or UEFI can be used because of compatibility, but in fact this part is not the definition of UEFI);
4. The output is no longer a simple binary code, instead removable binary Drivers;
5. OS boot no longer calls Int19, but uses protocol/device Path directly;
6. For third-party development, the former basically does not, unless involved in the design of the BIOS, but also by the size of the ROM limit, the latter is much more convenient.
UEFI will be the trend of nearly 3 years, when the use of PC and maintenance will enter a new era.
[edit this paragraph] UEFI Architecture
The UEFI concept is based on the structure of the UEFI concept map, and we will take the UEFI concept into two parts: Uefi entity (Uefi Image) and the platform initialization framework.
UEFI Entity-uefi image (the blue frame around the picture)
As defined by the UEFI specification, UEFI image contains three types: UEFI applications, OS loaders and Uefi Drivers.
UEFI applications is the core application of hardware initialization, before operating system startup, such as: Startup management, BIOS setup, UEFI Shell, diagnostics, scheduling and provisioning, debugging applications ... Wait a minute
OS Loaders is a special UEFI application that starts the operating system and exits and shuts down the Uefi app.
The UEFI drivers is an inter-device interface protocol that runs independently of each device providing the device version number and corresponding parameters, as well as inter-device affinity, which no longer requires operating system-based support.
Start queue
Platform Initialization Framework
The UEFI framework consists of two main parts, the PEI (EFI pre-initialization) and the drive Execution Environment (DXE).
Pei is mainly used to detect the boot mode, load the main memory initialization module, detect and load drive execution environment core.
DXE is the main part of device initialization, which provides a device driver and protocol interface environment interface.

Articles:

https://my.oschina.net/lintur/blog/31954

Http://www.ithome.com/html/win8/58192.htm

Http://fyzx.ankang.gov.cn/Article/Class26/201408/1484.html

The difference between disk MBR and GPT

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.