Differences between GPT disks and MBR Disks

Source: Internet
Author: User
Tags gpt partition style

Abstract: In Windows 2008 Disk Manager, right-click the disk tag and "convert to Dynamic Disk" appears as the disk attribute varies ", here is a brief introduction to "convert to basic disk", "convert to GPT disk", and "convert to MBR disk. For some materials, refer to the resources on the network.

 

Basic and dynamic Disks
Disk usage can be divided into two categories: one is "Basic disk ". Basic disks are very common. We usually use basic disks ". The "Basic disk" is limited by 26 English letters. That is to say, the disk drive letter can only be one of 26 English letters. Because drive a and drive B are already occupied by the drive, only drive letters C ~ are available on the disk ~ Z 24. In addition, only four primary partitions can be created on the "Basic disk" (primary partition rather than extended partition), and the other disk type is "Dynamic Disk ". "Dynamic Disk" is not limited by 26 English letters. It is named by "volume. The biggest advantage of "Dynamic Disk" is that it can expand the disk capacity to a non-adjacent disk space.
Dynamic hard disk is obtained by upgrading the local hard disk in the disk manager. The biggest difference between a dynamic disk and a basic disk is that it no longer uses the previous partitioning method, but is called a volume set (volume ), the volume set includes simple volume, cross-zone volume, with-zone volume, mirror volume, and raid-5 volume. Compared with dynamic disks, basic disks have the following differences:
1. Quantity of volumes or partitions. There is no limit on the number of volumes that a dynamic disk can create on a hard disk. A basic disk can only be divided into four primary partitions.
2. disk space management. Dynamic disks can create partitions of different disks into a volume set, and these partitions can be non-adjacent. Such a size is the total size of several disk partitions. Basic disks cannot be partitioned across hard disks and must be contiguous. The maximum capacity of each partition can only be the maximum capacity of a single hard disk, and the access speed is not improved compared with that of a single hard disk.
3. Manage disk capacity and size. Dynamic disks allow us to adjust the size of dynamic Disks without restarting the machine, and do not lose or damage existing data. Once a partition of a basic disk is created, the capacity cannot be changed unless you use a third-party disk tool, such as PQ magic.
4. disk configuration information management and fault tolerance. The Dynamic Disk stores the disk configuration information in the disk. If the RAID fault-tolerant system is copied to another dynamic disk, the fault-tolerant feature of RAID-1 can be used. If a hard disk is damaged, the system will automatically call data from another hard disk to maintain data integrity. The basic disk stores the configuration information in the boot area without fault tolerance.
You can directly convert a basic disk to a dynamic disk, but this process is irreversible. To switch back to a basic disk, you can only copy all the data and then delete all the partitions of the hard disk.

GPT disk and MBR Disk
GPT (globally unique identifier partition table format) is a disk partition architecture used by the extended firmware interface (EFI) on an itanium-based computer. Compared with the primary startup record (MBR) Partitioning Method, GPT has more advantages because it allows each disk to have up to 128 partitions and supports a volume size of up to 18 Gigabit bytes, the partition table of the primary disk and the partition table of the backup disk can be used for redundancy. The unique disk and partition ID (guid) are also supported ).
It supports a maximum of 2 TB (terabytes) volumes and a maximum of 4 primary partitions (or 3 primary partitions, 1 extended partition, and unlimited logical drives) with each disk) the GUID Partition Table (GPT) disk partition style supports a maximum of 18 EB (exabytes) and a maximum of 128 partitions per disk. Unlike an MBR partitioned disk, the crucial platform operation data is located in the partition, not in a non-partition or hidden sector. In addition, GPT partition disks have redundant primary and backup partition tables to improve the integrity of the partition data structure.
On x86 and x64-based Windows Server 2003 running with Service Pack 1 (SP1), the operating system must reside on the MBR disk. Other hard disks can be MBR or GPT.
On an itanium-based computer, the operating system loader and startup partition must reside on the GPT disk. Other hard disks can be MBR or GPT.
You can have either MBR or GPT disks in a single Dynamic Disk group. The basic GPT and MBR disks are also used, but they are not part of the disk group. You can use both MBR and GPT disks to create mirror volumes, with-zone volumes, cross-zone volumes, and raid-5 volumes. However, the limitations of MBR cylindrical alignment may make it difficult to create mirror volumes. Generally, you can mirror the MBR disk to the GPT disk to avoid the problem of cylindrical alignment. You can convert an MBR disk to a GPT disk and convert it to an MBR disk only when the disk is empty. Otherwise, data will be lost !!!
You cannot use the GPT partition style on a removable media, or on a cluster disk that is connected to a shared SCSI or fiber channel bus used by the cluster service.

MBR is called Master Boot Record, which is the Master Boot Record of the hard disk.
To facilitate understanding, MBR is generally divided into two types: broad and narrow: MBR contains the entire sector (pilot program, partition table, and separator), that is, the Master Boot Record mentioned above; in the narrow sense, MBR only refers to the boot program.
The hard disk's 0 cylinder, 0 head, and 1 sector are called the primary Boot Sector (also called the primary Boot Record MBR ). It consists of three parts, the Main Boot Program, the hard disk partition table DPT and the hard disk effective mark (55aa ). In a total of 512 bytes of the primary Boot Sector, the primary Boot Loader occupies 446 bytes, and the second part is the Partition Table area (Partition Table), that is, DPT, which occupies 64 bytes, the number of partitions and the size of each partition are recorded in the hard disk. The third part is magic number, which occupies 2 bytes and is fixed to 55aa.
MBR does not belong to any operating system, nor can it be read by disk operation commands provided by the operating system. However, it can be modified and rewritten by commands, such as in minix3, run installboot-M/dev/c0d0/usr/mdec/masterboot to write the masterboot applet into MBR. masterboot is usually written in assembly language. We can also use the int13h 2 function provided in the ROM-BIOS to read the content of this sector, it can also be read by the software tool norton8.0 diskedit. EXE.
The call parameters for the int13h read disk sector function are as follows:
Entry parameter: Ah = 2 (function number specified)
Al = number of sectors to read
DL = disk number (0, 1-floppy disk; 80, 81-hard disk)
DH = head number
CL height 2-bit + CH = cylindrical number
CL 6-bit lower = fan ID
CS: BX = memory buffer address for storing read data
Export parameter: CS: BX = read data storage address
Error message: cf = 1 Ah = Error Code
You can use DEBUG to read data from the zero-cylinder, zero-head, and one-sector disks on the hard disk as follows:
A> debug
-A 100
XXXX: XXXX mov ax, 0201 (read 1 sector with function number 2)
XXXX: XXXX mov BX, 1000 (put read data into the buffer address Cs: 1000)
XXXX: XXXX mov CX, 0001 (read 0 cylindrical, 1 sector)
XXXX: XXXX mov dx, 0080 (specify the 0 head of the first physical disk)
XXXX: xxxx int 13
XXXX: xxxx int 3
XXXX: xxxx (Press ENTER)
-G = 100 (execute the above program segment)
-D 1000 11ff (display 512 bytes of MBR content)
In Windows operating systems, such as XP, 2003, Vista, and windows7, there are interfaces provided by Microsoft to directly read and write MBR;
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); // very important
Fwrite (buffer, FD); // write the modified MBR to your machine
Fclose (FD); // success
MBR Composition
The Master Boot Record MBR for one sector of a hard disk consists of four parts, as shown in Figure 6-15.
· The primary Bootstrap program (offset h--0088h), which is responsible for loading from the active partition and running the System Bootstrap program.
· Error information data area. The offset address 0089h--00e1h indicates an error message, and 00e2h--01bdh indicates 0 bytes.
· The Partition Table (DPT, disk partition table) contains four partition items, with an offset of 01beh--01fdh. Each partition table item is 16 bytes long, A total of 64 bytes are partition item 1, partition item 2, partition item 3, and partition item 4.
· The end flag. The two byte values of the Offset 01fe--01ff are the end flag 55aa. If this flag is incorrect, it cannot be started.

Additional knowledge: EFI (extensible firmware interface)
Extended firmware interfaces (extensible firmware interface or EFI) are provided by Intel, A company that leads the research and development of personal computer technology has launched an upgrade solution to replace BIOS in PC-like computer systems in the future. The rise of BIOS technology stems from the prevalence of ibm pc/at machines and the first clone PC developed and manufactured by Compaq. During PC startup, BIOS is responsible for initializing hardware, checking hardware functions, and guiding the operating system, the BIOS also provides a set of runtime service programs for the operating system and applications. The BIOS program is stored in a read-only memory that will not be lost after power loss. When the system powers on, the address of the first instruction of the processor will be located in the BIOS memory to facilitate initialization program execution.

Generation of EFI

As we all know, Intel has been leading the PC technology trend based on x86 series Processors in the last two decades. Its products, such as CPU and chipset, have taken an absolute lead in the PC production line. As a result, many people think that this action shows Intel's ambition to dye the firmware product market. In fact, EFI technology originated from the release of Intel's itanium platform. Intel has invested nearly ten years in R & D to design a 64-bit new architecture completely different from the x86 series. In the 32-bit era of X86 series Processors, due to compatibility reasons, the new processor (i80386) retains the 16-bit running mode (real mode ), since then, this operation mode has been retained for many processor upgrades. Even in Xeon series Processors with 64-bit extended technology, the processors will still run in 16-bit real-time mode when powered on. Intel blamed the slowdown in BIOS technology. Since the PC compatible server manufacturer copies the first BIOS source program through the Cleanroom method, the BIOS uses 16-bit assembly code, register parameter call method, static link, and memory fixed addressing below 1 MB has existed for more than 10 years. Despite the efforts of major BIOS manufacturers in recent years, many new elements have been added to products, such as PNP bios, ACPI, and support for traditional USB devices. However, the fundamental nature of BIOS has not been changed. This forces intel to consider adding compatibility modes that greatly reduce performance when developing updated processors. Someone once made a metaphor: It's like a new-generation auto-shift sports car in Porsche, which has been put into a lame archive.
However, the anteng processor does not have such concerns. It is a new processor architecture, and the interfaces between the system firmware and the operating system can be completely redefined. This time, Intel defined it as a scalable, standardized firmware interface specification, which is different from the traditional BIOS's fixed and lacks documentation, it is based entirely on experience and obscure conventions. It has been five years since the emergence of the first EFI-based system product, intel is trying to promote technologies that have been successfully applied to high-end servers to more advantageous PC product lines in the market, and promises to invest in full technical support in 2006.

Compare EFI and BIOS

One notable difference is that EFI uses modular, C-language parameter stack transfer methods, and a system built in the form of dynamic links, which is easier to implement than bios and has stronger fault tolerance and error correction features, this shortens system R & D time. It runs in 32-bit or 64-Bit mode, and even in the enhanced processor mode in the future, it breaks through the addressing capability of traditional 16-bit code to achieve the maximum addressing of the processor. It identifies and operates the hardware by loading the EFI Driver. It is different from the hardware function that the BIOS uses to mount the real-mode interrupt. The latter must place a 16-bit code similar to the driver in a fixed storage area between 0x000c0000 and 0x000dffff and run the initialization part of the code, it provides services to other programs based on the interrupt vectors agreed in the mounting mode. For example, VGA graphics and text output interruptions (INT 10 h), disk access interruption services (INT 13 H), and so on. Due to the limited storage space (Kb), the BIOS is powerless when the size of the driver code to be placed exceeds the size of the space. In addition, BIOS hardware service programs already exist in the form of 16-bit code, which makes it difficult for the operating system running in the enhanced mode to access its services. Therefore, the services provided by BIOS can only be provided to operating system boot programs or MS-DOS Operating Systems in reality. The driver in the EFI system is not composed of code that can be directly run on the CPU, but compiled using the EFI byte code. This is a set of virtual machine commands dedicated to the EFI Driver and must be interpreted and run in the EFI Driver running environment (driver execution environment, or dxe. This ensures full downward compatibility. For example, an extended device with an EFI Driver can be installed in the anteng processor system, it can also be installed in a new PC system that supports EFI, and its EFI Driver does not need to be rewritten. In this way, you do not need to consider the Compatibility factors brought about by the system upgrade. In addition, due to the simple development of the EFI Driver, all PC component providers can participate in the development mode, which is very similar to the development mode of modern operating systems, this development model once made windows a powerful and superior operating system in just two or three years. The EFI-based driver model allows the EFI system to access all hardware functions. browsing the hichina website before the operating system runs is no longer a fantasy, and even easy to implement. This is an impossible task for traditional BIOS-based systems. adding a few simple USB devices to the BIOS has made many BIOS designers suffer, besides adding support for numerous network hardware, we have to build a 16-bit TCP/IP protocol stack.
Some people think that the BIOS is only an insignificant part due to compatibility issues, and it is not worth a lot of effort to upgrade it. Opponents believe that when the emergence of BIOS restricts the development of PC technology, some people must make necessary changes to it.

EFI and Operating System

In concept, EFI is very similar to a low-level operating system and can manipulate all hardware resources. Many people feel that its continuous development may replace the modern operating system. In fact, when the first version of the code was introduced, the EFI creators limited the power of EFI to threaten the operating system's dominance. First, it is only the interface specification between the hardware and the pre-start software. Second, there is no interrupted access mechanism in the EFI environment, that is to say, each EFI Driver must use a polling method to check the hardware status and run it in an interpreted way, which is less efficient than the driver in the operating system, the EFI system does not provide complex memory protection functions. It only provides a simple memory management mechanism, specifically, it runs in the block protection mode of the x86 processor, memory is divided into a flat segment based on the maximum addressing capability. All programs have the permission to access any segment without providing real protection services. When all the components of EFI are loaded, the system can enable a command interpretation environment similar to the operating system shell. Here, you can call and execute any EFI application, these programs can be hardware detection and debugging software, boot management, software setup, operating system boot software, and so on. Theoretically, there is no limit on the functionality of the EFI application, anyone can write this kind of software, and the effect is more gorgeous than the software in the previous MS-DOS, more powerful. Once the guiding software gives control to the operating system, all the service code used for guiding will stop working, and some service programs can continue to work in the era of running, this allows the operating system to continue to be used when the driver of a specific device cannot be found.

Composition of EFI

Generally, EFI consists of the following parts:
1. Pre-EFI initialization module
2. EFI Driver execution environment
3. EFI Driver
4. Compatibility support module (CSM)
5. High-level EFI applications
6. guid disk partition


During implementation, the EFI initialization module and the driver execution environment are usually integrated into a read-only memory. The pre-EFI initialization program is first executed when the system is started. It initializes the initial CPU, Main Bridge, and memory, and then loads the pre-EFI Driver execution environment (dxe ). When dxe is loaded and running, the system has the ability to enumerate and load other EFI drivers. In a PCI-based system, the EFI drivers of each PCI bridge and PCI adapter are loaded and initialized successively, the system then enumerates and loads various bus and device drivers behind each bridge and adapter until the driver of the last device is loaded successfully. For this reason, the EFI Driver can be placed anywhere in the system, as long as it can be properly enumerated in order. For example, an atapi large-capacity storage adapter with a PCI bus interface, its EFI Driver is usually placed in the PCI-compliant extended read-only memory (pCI expansion ROM) of this device, when the PCI bus driver is loaded and its sub-devices are enumerated, the storage adapter is correctly identified and loaded. Some EFI drivers can also be placed in the EFI dedicated partition of a disk, as long as these drivers are not necessary for loading the drive of this disk. In the EFI specification, a guid disk partition system (GPT) that breaks through the limitation of the traditional MBR disk partition structure is introduced. In the new structure, the number of partitions on the disk is no longer limited (only four primary partitions can exist under the MBR structure), and the partition type is represented by guid. Among the many partition types, the EFI system partition can be accessed by the EFI system and used to store some drivers and applications. Many people worry that this will lead to new security factors, because the EFI system is more vulnerable to computer virus attacks than the traditional bios, when some EFI drivers are damaged, the system may be unable to boot. In fact, the EFI Driver that the system boot depends on is usually not stored in the guid partition of EFI. Even if the driver in the partition is damaged, you can recover it in a simple way, this is consistent with the storage habits of drivers in the operating system. CSM is a special module in the EFI system on the X86 platform. It will provide system services similar to the traditional BIOS for operating systems that do not have the EFI boot capability.

Development of EFI

Intel is undoubtedly a positive factor in the promotion of EFI. In recent years, due to the industry's in-depth understanding of it, more vendors are investing in this research. Some PC manufacturers, including Intel and AMD, have jointly set up the joint extensible firmware interface forum, which will launch the first specification in the near future. The organization will take over the mission of planning the development of EFI and interpret Intel's EFI framework as a specific implementation of this specification. In addition, major BIOS providers, such as Phoenix and AMI, are regarded as obstacles to the development of EFI and are constantly introducing their own solutions. Analysts pointed out that this is because BIOS vendors have relocated the market position in the EFI architecture, such as the pre-EFI startup environment. However, with the successful use of EFI on PC systems, as well as the release of Intel's next-generation chipset, this part of the market share will be unexpected in Intel's control.

About UEFI
The graphic hardware setting interface extensible firmware interface (EFI) in UEFI is an Intel Recommendation Standard for the architecture, interfaces, and services of all new types of PC firmware. The main purpose is to provide a set of consistent and correctly specified startup services on all platforms before the OS is loaded (before startup, it is regarded as the successor of pc bios with nearly 20 years of history.
Thanks to the popularity of computer education, many people know that BIOS is a basic input/output system. Turning it into Chinese is a "Basic Input/Output System", which is a so-called "firmware ", responsible for hardware startup and detection during boot, and acts as an intermediary for operating system control of hardware.
However, those are all events in the DOS era. Since the emergence of Windows NT and the emergence of Linux, these operating systems have put hardware control programs that need to be completed through BIOS in the operating system, you no longer need to call the BIOS function. Generally speaking, most of today's so-called "computer experts" use BIOS to tune hardware performance. In addition to professionals, there are few who use BIOS to perform underlying work.
Due to the rapid development of hardware, the traditional (legacy) BIOS has become a burden of progress. Now, the latest extensible firmware interface (EFI) firmware interface has been released. From the perspective of traditional bios, in the future, there will be a "no specific BIOS" computer era.
UEFI was developed based on efi1.10 and its owner is no longer intel, but an international organization called uniied EFI form (www.uefi.org). Its contributors include Intel, Microsoft, Ami, and other major manufacturers, which belong to open source. The current version is 2.1. Compared with legacy bios, the biggest difference is:
1. Encoding 99% is completed in C language;
2. Change the previous interrupt and hardware port operations, and adopt a new driver/protocal approach;
3. the x86 mode is not supported, but flat mode is used directly (that is, DOS is unavailable. Some EFI or UEFI can be used because of compatibility, but in fact this part is not defined by UEFI );
4. The output is no longer a pure binary code, but it is changed to removable binary drivers;
5. When the OS is started, protocol/device path is directly used instead of int19;
6. For third-party development, the former is basically impossible, unless involved in the BIOS design, but also limited by the ROM size, and the latter will be more profitable.
UEFI will be the trend of the past three years, and the use and maintenance of PCs will enter a new era.
[Edit this section] UEFI Structure
Based on the structure of the UEFI concept diagram, the UEFI concept is divided into two parts: the UEFI entity (UEFI image) and the platform initialization framework.
UEFI entity-UEFI image (Blue Circle in the figure)
According to UEFI specifications, UEFI image contains three types: UEFI applications, OS loaders and UEFI drivers.
UEFI applications are core applications before hardware initialization and operating systems are started, such as startup management, BIOS settings, UEFI shell, diagnostic programs, scheduling and supply programs, and application debugging...
OS loaders is a special UEFI Application. Its main function is to start the operating system and exit and close the UEFI Application.
UEFI drivers provides the inter-device interface protocol. Each device runs independently and provides the device version number, corresponding parameters, and association between devices. It is no longer supported by the operating system.
Start queue
Platform initialization framework
The UEFI framework consists of two parts: Pei (EFI pre-initialization) and driver execution environment (dxe ).
PEI is mainly used to detect the startup mode, load the primary memory initialization module, and detect and load the core of the driver execution environment.
Dxe is the main part of device initialization. It provides the device driver and Protocol Interface environment interface.

 

(Reproduced from: http://my.oschina.net/lintur/blog/31954)

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.