GPT 分区表中是否有扩展分区?

dir*_*obs 2 partition gpt mbr partition-table

在 MBR 模型下,我们可以创建四个主分区,其中一个可以是进一步细分为逻辑分区的扩展分区。

考虑一下来自维基百科的 GPT 示意图:

GPT

分区条目范围从 LBA 1 到 LBA 34,大概我们用完了那个空间,我知道这是相当数量的分区,如果磁盘使用 GPT 分区,是否可以创建扩展分区?如果可能,我们可以为每个 GPT 分区表创建多少个扩展分区?

我不确定这是否是在 LBA 1 到 LBA 34 范围内拥有分区条目的标准,也许我们可以扩展分区条目?

实际上这是相当数量的分区,我无意这样做。

fro*_*utz 5

128 个分区是 GPT 的默认限制,实际上使用一半的分区可能会很痛苦......

Linux 本身在其设备命名空间中最初也有一些限制。对于 /dev/sdX,它假设不超过 15 个分区(sda 为 8,0,sdb 为 8,16 等)。如果有更多分区,它们将使用 259,X aka Block Extended Major 表示。

您当然仍然可以通过各种方式进行更多分区。循环设备、LVM 甚至 GPT 内的 GPT。有时,当将分区作为块设备传递给虚拟机时,这种情况会自然发生,他们将分区视为虚拟磁盘驱动器并对其进行分区。

只是不要指望分区内的此类分区会被自动拾取。


正如@fpmurphy1 在评论中指出的那样,我错了:您可以更改限制,使用gdisk, expert menu, resize partition table。如果在驱动器的开头和结尾有未分区的空间(4 个附加分区条目的 512 字节扇区),也可以对现有分区表执行此操作。但是我不确定这得到了多大的支持;在parted我尝试过的分区器或其他分区器中似乎没有选择。


您可以设置的最高限制gdisk似乎是65536但它被窃听了:

Expert command (? for help): s   
Current partition table size is 128.
Enter new size (4 up, default 128): 65536
Value out of range
Run Code Online (Sandbox Code Playgroud)

进而...

Expert command (? for help): s   
Current partition table size is 128.
Enter new size (4 up, default 128): 65535
Adjusting GPT size from 65535 to 65536 to fill the sector

Expert command (? for help): s
Current partition table size is 65536.
Run Code Online (Sandbox Code Playgroud)

诶?不管你说什么。

但是尝试保存该分区表并gdisk陷入循环几分钟。

Expert command (? for help): w

--- gdisk gets stuck here ---
      PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND    
    22253 root      20   0   24004  11932   3680 R 100.0  0.1   1:03.47 gdisk      
--- unstuck several minutes later ---

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Your option? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/loop0.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
Run Code Online (Sandbox Code Playgroud)

以下是parted关于成功完成操作的说明:

# parted /dev/loop0 print free
Backtrace has 8 calls on stack:
  8: /usr/lib64/libparted.so.2(ped_assert+0x45) [0x7f7e780181f5]
  7: /usr/lib64/libparted.so.2(+0x24d5e) [0x7f7e7802fd5e]
  6: /usr/lib64/libparted.so.2(ped_disk_new+0x49) [0x7f7e7801d179]
  5: parted() [0x40722e]
  4: parted(non_interactive_mode+0x92) [0x40ccd2]
  3: parted(main+0x1102) [0x405f52]
  2: /lib64/libc.so.6(__libc_start_main+0xf1) [0x7f7e777ec1e1]
  1: parted(_start+0x2a) [0x40610a]


You found a bug in GNU Parted! Here's what you have to do:

Don't panic! The bug has most likely not affected any of your data.
Help us to fix this bug by doing the following:

Check whether the bug has already been fixed by checking
the last version of GNU Parted that you can find at:

    http://ftp.gnu.org/gnu/parted/

Please check this version prior to bug reporting.

If this has not been fixed yet or if you don't know how to check,
please visit the GNU Parted website:

    http://www.gnu.org/software/parted

for further information.

Your report should contain the version of this release (3.2)
along with the error message below, the output of

    parted DEVICE unit co print unit s print

and the following history of commands you entered.
Also include any additional information about your setup you
consider important.

Assertion (gpt_disk_data->entry_count <= 8192) at gpt.c:793 in function
_parse_header() failed.

Aborted                                                                   
Run Code Online (Sandbox Code Playgroud)

所以parted拒绝使用具有超过 8192 个分区条目的 GPT。从来没有人这样做过,所以它一定是腐败的,对吧?

这就是当您不坚持默认值时会发生的情况。

  • @frostschutz。当前规范规定为 GPT 分区表数组保留 16,384 字节的最小值 - 因此有 128 个分区条目。如果您增加分区表数组的大小,没有什么可以阻止您拥有超过 128 个分区。 (4认同)