Difference between revisions of "GUID Partition Table (简体中文)"

From ArchWiki
Jump to: navigation, search
(Kernel Support)
(Use new related template.)
(26 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[Category:File systems]]
+
[[Category:File systems (简体中文)]]
{{i18n|GUID Partition Table}}
+
[[el:GUID Partition Table]]
 
+
[[en:GUID Partition Table]]
{{Article summary start}}
+
[[es:GUID Partition Table]]
{{Article summary text|An overview of the GUID Partition Table.}}
+
[[tr:Guid_Bölümledirme_Tablosu]]
{{Article summary heading|Overview}}
+
{{Related articles start (简体中文)}}
{{Article summary text|{{Boot process overview}}}}
+
{{Related|Arch Boot Process}}
{{Article summary heading|Related}}
+
{{Related|Master Boot Record}}
{{Article summary wiki|Unified Extensible Firmware Interface}}
+
{{Related|Unified Extensible Firmware Interface}}
{{Article summary wiki|Master Boot Record}}
+
{{Related|Partitioning}}
{{Article summary wiki|Arch Boot Process}}
+
{{Related articles end}}
{{Article summary end}}
+
{{Translateme (简体中文)|翻译前请重新从英文页面复制最新版本。}}  
 
+
GUID Partition Table (GPT) is a new style of partitioning which is part of the [[Unified Extensible Firmware Interface]] Specification, using the [[Wikipedia:Globally unique identifier | globally unique identifier]] for devices. It is different from the [[Master Boot Record]] (the more commonly used partitioning style) in many aspects and has many advantages.
GUID Partition Table (GPT) 是一个新的分区格式[[Unified Extensible Firmware Interface]] Specification, using the [[Wikipedia:Globally unique identifier | globally unique identifier]] for devices. It is different from the [[Master Boot Record]] (the more commonly used partitioning style) in many aspects and has many advantages.
+
  
 
To understand GPT, it is important to understand what is MBR and what are its disadvantages.
 
To understand GPT, it is important to understand what is MBR and what are its disadvantages.
Line 18: Line 17:
 
For any partitioning style, the number of partitions that can be defined is based on the total space allotted for the partition table and the space required for storing the information of a single partition.
 
For any partitioning style, the number of partitions that can be defined is based on the total space allotted for the partition table and the space required for storing the information of a single partition.
  
== 主引导 ==
+
== Master Boot Record ==
MBR分区表 stores the partitions info in the first sector of a hard disk as follows
+
存储在硬盘的第一个扇区的MBR分区表分区信息如下
  
 
{| border="1"
 
{| border="1"
! Location in the HDD !! Purpose of the Code
+
! HDD的位置 !! 作用
 
|-
 
|-
| First 440 bytes || MBR boot code that is launched by the BIOS.
+
| 440 个字节 || 由BIOS锁存的MBR启动代码
 
|-
 
|-
| 441-446 bytes || MBR disk signature.
+
| 441-446 字节 || MBR盘标识
 
|-
 
|-
| 447-510 bytes || Actual partition table with info about primary and extended partitions. (Note that logical partitions are not listed here)
+
| 447-510 字节 || 实际的主分区和扩展分区的分区表信息 。(注,此处未列出逻辑分区)
 
|-
 
|-
| 511-512 bytes || MBR boot signature 0xAA55.
+
| 511-512 字节 || MBR 启动标识 0xAA55。
 
|}
 
|}
  
The entire information about the primary partitions is limited to the 64 bytes allotted. To extend this, extended partitions were used. An extended partition is simply a primary partition in the MBR which acts like a container for other partitions called logical partitions. So one is limited to either 4 primary partitions, or 3 primary and 1 extended partitions with many logical partitions inside it.
+
有64字节的空间用来描述主分区的信息。为了扩展它,启用了扩展分区的概念。 An extended partition is simply a primary partition in the MBR which acts like a container for other partitions called logical partitions. So one is limited to either 4 primary partitions, or 3 primary and 1 extended partitions with many logical partitions inside it.
  
=== Problems with MBR ===
+
=== MBR 带来的问题 ===
# Only 4 primary partitions or 3 primary + 1 extended partitions with many logical partitions can be defined. If you have 3 primary + 1 extended partitions, and you have some free space outside the extended partition area, you cannot create a new partition over that space.
+
#一块磁盘只能存在 4 个主分区或者是最多 3 个主分区加上 1 个扩展分区(扩展分区里面可以建立任意数量的逻辑分区)。 如果你已经有 3 个主分区加上一个扩展分区,就算硬盘上还存在一些自由空间,你也不能在上面新建任何的分区。
# Within the extended partition, the logical partitions meta-data is stored in a linked-list structure. If one link is lost, all the logical partitions following that metadata is lost.
+
# 扩展分区中的逻辑分区的元数据被存储在一个链表结构。如果一条链路丢失,所有的逻辑分区后的元数据都将丢失。
# MBR supports only 1 byte partition type codes which leads to many collisions.
+
# MBR只支持1字节的分区类型代码,从而导致一些冲突。
# MBR stores partition sector information using 32-bit LBA values. This LBA length along with 512 byte sector size (more commonly used) limits the maximum addressable size of the disk to be 2TB. Any space beyond 2TB cannot be defined in a partition if MBR partitioning is used.
+
# MBR分区扇区存储信息使用32位LBA值。LBA 使用扇区为 512 比特(较常用)导致 2 TiB 为的磁盘的最大寻址。如果使用 MBR 超过 2 TiB 的磁盘便不能被识别或者是分区。
  
 
+
== GUID Partition Table(GPT 分区表) ==
== GUID Partition Table ==
+
GUID 分区表(GPT)使用 GUID 分区定义及其类型(Linux中叫做 UUID ),因此得名。GPT 分区表包括:
GUID Partition Table (GPT) uses GUIDs (or UUIDs in linux world) to define partitions and its types, hence the name. The GPT consists of a:
+
 
{| border="1"
 
{| border="1"
! Location in the HDD !! Purpose
+
! 硬盘上的位置 !! 作用
 
|-
 
|-
| First 512 bytes || Protective MBR - Same as a normal MBR but the 64-byte area contains a single 0xEE type Primary partition entry defined over the entire size of the disk or in case of >2 TB, upto a partition size of 2 TB.
+
| 磁盘的第一逻辑扇区或前 512 字节 || 保护MBR-与MBR相像,只是64字节区域包含一个单个0XEE类型的主分区入口,这个入口支持>2TiB的空间,分区大小高达2TiB
 
|-
 
|-
| Next 512 bytes || Primary GPT Header - Contains the Unique Disk GUID, Location of the Primary Partition Table, No. of possible entries in the partition table, CRC32 checksums of itself and the Primary Partition Table, Location of the Secondary (or Backup) GPT Header
+
| 磁盘的第二个逻辑扇区或下一个 512 直接 || Primary GPT Header - Contains the Unique Disk GUID, Location of the Primary Partition Table, Number of possible entries in partition table, CRC32 checksums of itself and the Primary Partition Table, Location of the Secondary (or Backup) GPT Header
 
|-
 
|-
| Next 16 KB (by default)
+
| 16 KiB (by default) following the second logical sector of the disk
| Primary GPT Table - 128 Partition entries each with each entry of size 128 byte (hence 16 KB). This size can be changed to accommodate more table entries  (>128) and it can also be reduced (but UEFI Spec requires space for minimum of 128 table entries which is 16 KB). Sector numbers are stored as 64-bit LBA and each partition has a Partition type GUID and a Unique Partition GUID.
+
| Primary GPT Table - 128 Partition entries (by default, can be higher), each with an entry of size 128 bytes (hence total of 16 KiB for 128 partition entries). Sector numbers are stored as 64-bit LBA and each partition has a Partition Type GUID and a Unique Partition GUID.
 
|-
 
|-
| 16 KB (minus 512 bytes) from the end || Secondary GPT table - It is byte-for-byte identical to the Primary table. Used mainly for recovery operations.
+
| 16 KiB (by default) before the last logical sector of the disk || Secondary GPT table - It is byte-for-byte identical to the Primary table. Used mainly for recovery in case the primary partition table is damaged.
 
|-
 
|-
| Last 512 bytes || Secondary GPT Header - Contains the Unique Disk GUID, Location of the Secondary Partition Table, No. of possible entries in the partition table, CRC32 checksums of itself and the Secondary Partition Table, Location of the Primary GPT Header. This header can be used to recover GPT info in case the primary header is corrupted.
+
| 最后一个逻辑扇区或最后 512 字节 || Secondary GPT Header - Contains the Unique Disk GUID, Location of the Secondary Partition Table, Number of possible entries in the partition table, CRC32 checksums of itself and the Secondary Partition Table, Location of the Primary GPT Header. This header can be used to recover GPT info in case the primary header is corrupted.
 
|}
 
|}
  
 
=== Advantages of GPT ===
 
=== Advantages of GPT ===
# Uses GUIDs to identify partition types - No collisions.
+
# Uses GUIDs (UUIDs) to identify partition types - No collisions.
# Provides a unique disk GUID and partition GUID for each partition - A good filesystem-independent way of referencing partitions and disks.
+
# Provides a unique disk GUID and unique partition GUID for each partition - A good filesystem-independent way of referencing partitions and disks.
# Minimum of 128 partition table entries - No need for extended and logical partitions.
+
# Arbitary number of partitions - depends on space allocated for the partition table (maximum of 128 partitions) - No need for extended and logical partitions.
 
# Uses 64-bit LBA for storing Sector numbers - maximum addressable disk size is 2 ZiB.
 
# Uses 64-bit LBA for storing Sector numbers - maximum addressable disk size is 2 ZiB.
# Stores a backup header and partition table at the end of the disk that aids in recovery if the main copy is clobbered.
+
# Stores a backup header and partition table at the end of the disk that aids in recovery in case the primary ones are damaged.
# CRC32 checksums to detect errors and corruption of the partition table.
+
# CRC32 checksums to detect errors and corruption of the header and partition table.
  
=== Kernel 支持 ===
+
=== Kernel Support ===
内核CONFIG_EFI_PARTITION选项必须被设置成'y'使内核支持 EFI 分区; 'm', for a loadable module, is not sufficient.  CONFIG_EFI_PARTITION is enabled (i.e. set to CONFIG_EFI_PARTITION=y) by default in the Arch default kernel; if you are running a different kernel, you can use {{Ic|zgrep CONFIG_EFI_PARTITION /proc/config.gz}} to check for this setting.  这个选项要求 even if GPT-formatted disks are used only for storing data and not for booting linux.
+
  
== Bootloader Support ==
+
{{ic|CONFIG_EFI_PARTITION}} option in the kernel config enables GPT support in the kernel (despite the name EFI PARTITION). This options must be built-in the kernel and not compiled as a loadable module. This option is required even if GPT disks are used only for data storage and not for booting. This option is enabled by default in Arch's {{Pkg|linux}} and {{Pkg|linux-lts}} kernels in [core] repo. In case of a custom kernel enable this option by doing {{ic|1=CONFIG_EFI_PARTITION=y}}.
Archlinux provides three bootloaders [[GRUB-Legacy]], [[GRUB2]] and [[Syslinux]]. The default bootloader of the Arch Linux installer, GRUB-Legacy, does not support GPT.
+
  
GRUB2 provides the ability to boot from GPT in both BIOS and UEFI based systems. All partition defining commands remain the same ( like (hd0,8) ). Just load the '''part_gpt''' grub2 module from grub2 shell or include "{{Ic|insmod part_gpt}}" line before "{{Ic|<nowiki>set root=</nowiki>}}" line in {{ic|grub.cfg}} file. Usually '''grub-probe''' will automatically add this module to the {{ic|core.img}} or {{ic|grub.efi}} file if it detects the HDD to be using GPT.
+
== 引导支持 ==
  
To enable GRUB2 to embed the {{ic|core.img}} file in GPT disks for BIOS based systems, a BIOS boot partition of about 1 MB (no filesystem) is required. See [[GRUB2#GPT specific instructions]] on how to create it.
+
=== UEFI 系统 ===
  
For Syslinux and Extlinux GPT support refer to [[Syslinux#GUID_Partition_Table_aka_GPT]].
+
自从 GPT 成为 UEFI 规范的一部分且强制其为UEFI的引导,所有 UEFI 引导程序都支持GPT磁盘。 阅读 [[UEFI_Bootloaders]] 可以获得更多的信息。
 +
 
 +
=== BIOS 系统 ===
 +
 
 +
* [[GRUB2]] 需要一个2 MiB 的“BIOS引导分区” (在 gdisk 中分区代码为 EF02,在 GNU Parted 中使用 bios_grub 标志)。in BIOS systems to embed its {{ic|core.img}} file due to lack of post-MBR embed gap in GPT disks. Runtime GPT support in GRUB2 is provided by the {{ic|part_gpt}} module. See [[GRUB2#GPT specific instructions]] for more info.
 +
 
 +
* [[Syslinux]] requires the {{ic|/boot}} partition to be marked as "Legacy BIOS Bootable" GPT attribute (legacy_boot flag in GNU Parted) to identify the partition containing the syslinux boot files by its MBR boot code {{ic|gptmbr.bin}} . See [[Syslinux#GUID_Partition_Table_aka_GPT]] for more info.
 +
 
 +
* [[GRUB Legacy]], present in the AUR as {{AUR|grub-legacy}}, does not support GPT disks. Fedora's heavily patched GRUB Legacy fork {{AUR|grub-legacy-fedora-git}} contains GPT patches from Intel (tested in Fedora, not tested in Arch).
 +
 
 +
{{Note|Fedora developers have mentioned that after the release of Fedora 17, grub-legacy-fedora development will stop. Fedora already uses GRUB2 as its default BIOS bootloader since F16. Users are recommended to switch to GRUB2 or Syslinux instead.}}
 +
 
 +
* [[LILO]]'s GPT support has not been tested so it is unclear whether it has issues booting in GPT disks.
  
 
== Partitioning Utilities ==
 
== Partitioning Utilities ==
 
=== GPT fdisk ===
 
=== GPT fdisk ===
GPT fdisk is a set of text-mode utilities for editing GPT disks. It consists of gdisk,sgdisk and cgdisk which are equivalent to respective tools from util-linux fdisk (used for MBR disks). It is available in the [extra] repository as {{Pkg|gptfdisk}}.
 
  
{{Note|The fdisk partitioning utilities from util-linux (i.e. fdisk, cfdisk and sfdisk) do not support GPT.}}
+
GPT fdisk is a set of text-mode utilities for editing GPT disks. It consists of gdisk, sgdisk and cgdisk which are equivalent to respective tools from util-linux fdisk (used for MBR disks). It is available in the [extra] repository as {{Pkg|gptfdisk}}.
 +
 
 +
{{Note|The fdisk partitioning utilities from util-linux (i.e. fdisk, cfdisk and sfdisk) do not support GPT, and may damage the GPT header and partition table if used on a GPT disk.}}
  
 
==== Convert from MBR to GPT ====
 
==== Convert from MBR to GPT ====
One of the best features of gdisk is its ability to convert MBR and BSD disklabels to GPT without data loss. Upon conversion, all the MBR primary partitions and the logical partitions become GPT partitions with the correct partition type GUIDs and Unique partition GUIDs created for each partition.
 
  
Just open the MBR disk using gdisk: '''Watch out for any error and fix them before writing any change to disk''' because you may risk losing data [http://www.rodsbooks.com/gdisk/mbr2gpt.html Doc for gdisk] ! Exit with "w" option to write the changes back to the disk (similar to fdisk) to convert the MBR disk to GPT. After conversion, the bootloaders will need to be reinstalled to configure them to boot from GPT.
+
One of the best features of gdisk (and sgdisk and cgdisk too) is its ability to convert MBR and BSD disklabels to GPT without data loss. Upon conversion, all the MBR primary partitions and the logical partitions become GPT partitions with the correct partition type GUIDs and Unique partition GUIDs created for each partition.
 +
 
 +
Just open the MBR disk using gdisk and exit with "w" option to write the changes back to the disk (similar to fdisk) to convert the MBR disk to GPT. '''Watch out for any error and fix them before writing any change to disk''' because you may risk losing data. See http://www.rodsbooks.com/gdisk/mbr2gpt.html for more info. After conversion, the bootloaders will need to be reinstalled to configure them to boot from GPT.
 +
 
 +
{{Note|Remember that GPT stores a secondary table at the end of disk. You must make sure that the last 1 [[Wikipedia:MiB|MiB]] of the disk is not used by any partition.}}
  
{{Note|Remember that GPT stores a secondary table at the end of disk. You may have to make sure that the last 33 sectors are not used by any partition.}}
+
{{Note|Keep in mind that if your Boot-Manager is GRUB, it needs a [[GRUB#GUID Partition Table (GPT) specific instructions|BIOS Boot Partition]]. If your MBR Partitioning Layout isn't too old, there is a good chance that the first partition starts at sector 2048 for alignment reasons. That means at the beginning will be 1007 [[Wikipedia:KiB|KiB]] of empty space where this bios-boot partition can be created. To do this, first do the mbr->gpt conversion with gdisk as described above. Afterwards, create a new partition with gdisk and manually specify its position to be sectors 34 - 2047, and set the {{ic|EF02}} partition type.}}
  
 
=== GNU Parted ===
 
=== GNU Parted ===
GNU Parted 3.0 has all its FS related code removed. Filesystem specific tools are recommended to do all the FS operations.
 
  
GUI wrappers are available for parted.
+
In GNU Parted >=3.0, the {{ic|parted}} command-line utility does not support any filesystem related operation, and most of the FS related code has been removed from the libparted, leaving only minimal code required by external applications like gparted. The upstream recommends using the filesystem specific tools or one of the parted's GUI wrappers like gparted (which calls these external tools) for filesystem related operations.
  
 
==See also==
 
==See also==
Line 101: Line 112:
 
# [http://rodsbooks.com/gdisk/ Homepage of Rod Smith's GPT fdisk tool] and its [http://sourceforge.net/projects/gptfdisk/ Sourceforge.net Project page - gptfdisk]
 
# [http://rodsbooks.com/gdisk/ Homepage of Rod Smith's GPT fdisk tool] and its [http://sourceforge.net/projects/gptfdisk/ Sourceforge.net Project page - gptfdisk]
 
# Rod Smith's page on [http://rodsbooks.com/gdisk/mbr2gpt.html Converting MBR to GPT] and [http://rodsbooks.com/gdisk/booting.html Booting OSes from GPT]
 
# Rod Smith's page on [http://rodsbooks.com/gdisk/mbr2gpt.html Converting MBR to GPT] and [http://rodsbooks.com/gdisk/booting.html Booting OSes from GPT]
 +
# Rod Smith's page on the [http://www.rodsbooks.com/linux-fs-code/index.html New Partition Type GUID] for Linux data partitions
 
# [http://sysresccd.org/Sysresccd-Partitioning-The-new-GPT-disk-layout System Rescue CD's page on GPT]
 
# [http://sysresccd.org/Sysresccd-Partitioning-The-new-GPT-disk-layout System Rescue CD's page on GPT]
 
# Wikipedia page on [http://en.wikipedia.org/wiki/BIOS_Boot_partition BIOS Boot Partition]
 
# Wikipedia page on [http://en.wikipedia.org/wiki/BIOS_Boot_partition BIOS Boot Partition]
 
# [http://www.ibm.com/developerworks/linux/library/l-gpt/index.html?ca=dgr-lnxw07GPT-Storagedth-lx&S_TACT=105AGY83&S_CMP=grlnxw07 Make the most of large drives with GPT and Linux - IBM Developer Works]
 
# [http://www.ibm.com/developerworks/linux/library/l-gpt/index.html?ca=dgr-lnxw07GPT-Storagedth-lx&S_TACT=105AGY83&S_CMP=grlnxw07 Make the most of large drives with GPT and Linux - IBM Developer Works]
 
# [http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx Microsoft's Windows and GPT FAQ]
 
# [http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx Microsoft's Windows and GPT FAQ]

Revision as of 02:32, 24 November 2013

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: 翻译前请重新从英文页面复制最新版本。

GUID Partition Table (GPT) is a new style of partitioning which is part of the Unified Extensible Firmware Interface Specification, using the globally unique identifier for devices. It is different from the Master Boot Record (the more commonly used partitioning style) in many aspects and has many advantages.

To understand GPT, it is important to understand what is MBR and what are its disadvantages.

For any partitioning style, the number of partitions that can be defined is based on the total space allotted for the partition table and the space required for storing the information of a single partition.

Master Boot Record

存储在硬盘的第一个扇区的MBR分区表分区信息如下

HDD的位置 作用
前 440 个字节 由BIOS锁存的MBR启动代码
441-446 字节 MBR盘标识
447-510 字节 实际的主分区和扩展分区的分区表信息 。(注,此处未列出逻辑分区)
511-512 字节 MBR 启动标识 0xAA55。

有64字节的空间用来描述主分区的信息。为了扩展它,启用了扩展分区的概念。 An extended partition is simply a primary partition in the MBR which acts like a container for other partitions called logical partitions. So one is limited to either 4 primary partitions, or 3 primary and 1 extended partitions with many logical partitions inside it.

MBR 带来的问题

  1. 一块磁盘只能存在 4 个主分区或者是最多 3 个主分区加上 1 个扩展分区(扩展分区里面可以建立任意数量的逻辑分区)。 如果你已经有 3 个主分区加上一个扩展分区,就算硬盘上还存在一些自由空间,你也不能在上面新建任何的分区。
  2. 扩展分区中的逻辑分区的元数据被存储在一个链表结构。如果一条链路丢失,所有的逻辑分区后的元数据都将丢失。
  3. MBR只支持1字节的分区类型代码,从而导致一些冲突。
  4. MBR分区扇区存储信息使用32位LBA值。LBA 使用扇区为 512 比特(较常用)导致 2 TiB 为的磁盘的最大寻址。如果使用 MBR 超过 2 TiB 的磁盘便不能被识别或者是分区。

GUID Partition Table(GPT 分区表)

GUID 分区表(GPT)使用 GUID 分区定义及其类型(Linux中叫做 UUID ),因此得名。GPT 分区表包括:

硬盘上的位置 作用
磁盘的第一逻辑扇区或前 512 字节 保护MBR-与MBR相像,只是64字节区域包含一个单个0XEE类型的主分区入口,这个入口支持>2TiB的空间,分区大小高达2TiB
磁盘的第二个逻辑扇区或下一个 512 直接 Primary GPT Header - Contains the Unique Disk GUID, Location of the Primary Partition Table, Number of possible entries in partition table, CRC32 checksums of itself and the Primary Partition Table, Location of the Secondary (or Backup) GPT Header
16 KiB (by default) following the second logical sector of the disk Primary GPT Table - 128 Partition entries (by default, can be higher), each with an entry of size 128 bytes (hence total of 16 KiB for 128 partition entries). Sector numbers are stored as 64-bit LBA and each partition has a Partition Type GUID and a Unique Partition GUID.
16 KiB (by default) before the last logical sector of the disk Secondary GPT table - It is byte-for-byte identical to the Primary table. Used mainly for recovery in case the primary partition table is damaged.
最后一个逻辑扇区或最后 512 字节 Secondary GPT Header - Contains the Unique Disk GUID, Location of the Secondary Partition Table, Number of possible entries in the partition table, CRC32 checksums of itself and the Secondary Partition Table, Location of the Primary GPT Header. This header can be used to recover GPT info in case the primary header is corrupted.

Advantages of GPT

  1. Uses GUIDs (UUIDs) to identify partition types - No collisions.
  2. Provides a unique disk GUID and unique partition GUID for each partition - A good filesystem-independent way of referencing partitions and disks.
  3. Arbitary number of partitions - depends on space allocated for the partition table (maximum of 128 partitions) - No need for extended and logical partitions.
  4. Uses 64-bit LBA for storing Sector numbers - maximum addressable disk size is 2 ZiB.
  5. Stores a backup header and partition table at the end of the disk that aids in recovery in case the primary ones are damaged.
  6. CRC32 checksums to detect errors and corruption of the header and partition table.

Kernel Support

CONFIG_EFI_PARTITION option in the kernel config enables GPT support in the kernel (despite the name EFI PARTITION). This options must be built-in the kernel and not compiled as a loadable module. This option is required even if GPT disks are used only for data storage and not for booting. This option is enabled by default in Arch's linux and linux-lts kernels in [core] repo. In case of a custom kernel enable this option by doing CONFIG_EFI_PARTITION=y.

引导支持

UEFI 系统

自从 GPT 成为 UEFI 规范的一部分且强制其为UEFI的引导,所有 UEFI 引导程序都支持GPT磁盘。 阅读 UEFI_Bootloaders 可以获得更多的信息。

BIOS 系统

  • GRUB2 需要一个2 MiB 的“BIOS引导分区” (在 gdisk 中分区代码为 EF02,在 GNU Parted 中使用 bios_grub 标志)。in BIOS systems to embed its core.img file due to lack of post-MBR embed gap in GPT disks. Runtime GPT support in GRUB2 is provided by the part_gpt module. See GRUB2#GPT specific instructions for more info.
  • Syslinux requires the /boot partition to be marked as "Legacy BIOS Bootable" GPT attribute (legacy_boot flag in GNU Parted) to identify the partition containing the syslinux boot files by its MBR boot code gptmbr.bin . See Syslinux#GUID_Partition_Table_aka_GPT for more info.
Note: Fedora developers have mentioned that after the release of Fedora 17, grub-legacy-fedora development will stop. Fedora already uses GRUB2 as its default BIOS bootloader since F16. Users are recommended to switch to GRUB2 or Syslinux instead.
  • LILO's GPT support has not been tested so it is unclear whether it has issues booting in GPT disks.

Partitioning Utilities

GPT fdisk

GPT fdisk is a set of text-mode utilities for editing GPT disks. It consists of gdisk, sgdisk and cgdisk which are equivalent to respective tools from util-linux fdisk (used for MBR disks). It is available in the [extra] repository as gptfdisk.

Note: The fdisk partitioning utilities from util-linux (i.e. fdisk, cfdisk and sfdisk) do not support GPT, and may damage the GPT header and partition table if used on a GPT disk.

Convert from MBR to GPT

One of the best features of gdisk (and sgdisk and cgdisk too) is its ability to convert MBR and BSD disklabels to GPT without data loss. Upon conversion, all the MBR primary partitions and the logical partitions become GPT partitions with the correct partition type GUIDs and Unique partition GUIDs created for each partition.

Just open the MBR disk using gdisk and exit with "w" option to write the changes back to the disk (similar to fdisk) to convert the MBR disk to GPT. Watch out for any error and fix them before writing any change to disk because you may risk losing data. See http://www.rodsbooks.com/gdisk/mbr2gpt.html for more info. After conversion, the bootloaders will need to be reinstalled to configure them to boot from GPT.

Note: Remember that GPT stores a secondary table at the end of disk. You must make sure that the last 1 MiB of the disk is not used by any partition.
Note: Keep in mind that if your Boot-Manager is GRUB, it needs a BIOS Boot Partition. If your MBR Partitioning Layout isn't too old, there is a good chance that the first partition starts at sector 2048 for alignment reasons. That means at the beginning will be 1007 KiB of empty space where this bios-boot partition can be created. To do this, first do the mbr->gpt conversion with gdisk as described above. Afterwards, create a new partition with gdisk and manually specify its position to be sectors 34 - 2047, and set the EF02 partition type.

GNU Parted

In GNU Parted >=3.0, the parted command-line utility does not support any filesystem related operation, and most of the FS related code has been removed from the libparted, leaving only minimal code required by external applications like gparted. The upstream recommends using the filesystem specific tools or one of the parted's GUI wrappers like gparted (which calls these external tools) for filesystem related operations.

See also

  1. Wikipedia's Page on GPT and MBR
  2. Homepage of Rod Smith's GPT fdisk tool and its Sourceforge.net Project page - gptfdisk
  3. Rod Smith's page on Converting MBR to GPT and Booting OSes from GPT
  4. Rod Smith's page on the New Partition Type GUID for Linux data partitions
  5. System Rescue CD's page on GPT
  6. Wikipedia page on BIOS Boot Partition
  7. Make the most of large drives with GPT and Linux - IBM Developer Works
  8. Microsoft's Windows and GPT FAQ