GPT标头签名是做什么用的?


13

根据此Wikipedia文章,GUID分区表(LBA 1)的第二个逻辑块地址是主要的GPT标头。然后,它在有关标头的部分中指出,标头的前8个字节用于“签名”。

这个GPT标头签名是什么,与GPT表/存储设备的功能/操作有什么关系?

我在网上进行了搜索,但是发现很少有关此标头签名的信息。

编辑:

我在对Deltik的答案的评论中问了这些后续问题,这些问题非常有帮助地扩展为:

  • 如果签名为空,那么GPT表是否无法识别?
  • 我目前正在检查Chrome操作系统GPT,该签名似乎已设置为“ IGNOREME”。那会产生什么影响?
  • 还有其他有效的GPT签名吗?(除默认的“ EFI PART”外)

Answers:


23

签名EFI PART0x45 0x46 0x49 0x20 0x50 0x41 0x52 0x54)仅表示“这是GUID分区表”。这是软件如何知道块设备在GPT布局中格式化的方式。

您可以从以下十六进制转储片段中看到它:

*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
00000210  ea b5 99 a4 00 00 00 00  01 00 00 00 00 00 00 00  |................|
00000220  af 12 9e 3b 00 00 00 00  22 00 00 00 00 00 00 00  |...;....".......|
00000230  8e 12 9e 3b 00 00 00 00  7f 8c d6 05 c8 e8 01 4a  |...;...........J|
00000240  b8 74 6b 37 30 7c bf 15  02 00 00 00 00 00 00 00  |.tk70|..........|
00000250  80 00 00 00 80 00 00 00  10 d3 0e 29 00 00 00 00  |...........)....|
00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*

签名并非GPT独有。文件还具有签名,软件可以使用这些签名来识别文件是什么。这是file命令的操作机制。(的例子file


后续问题的答案

那么,如果此签名为空,那么将无法识别GPT分区表?

至少,gdisk将不再识别它。查看此演示:

  1. 为演示创建文件(充当块设备):

    root@demo [/tmp]# truncate -s 1M gpt-demo
    
  2. 使用GPT格式化文件:

    root@demo [/tmp]# sgdisk --clear gpt-demo
    Creating new GPT entries.
    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.
    
  3. 检查分区表的二进制数据:

    root@demo [/tmp]# hexdump -C gpt-demo
    00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000001c0  02 00 ee 20 20 00 01 00  00 00 ff 07 00 00 00 00  |...  ...........|
    000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
    00000200  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
    00000210  13 14 6d 6a 00 00 00 00  01 00 00 00 00 00 00 00  |..mj............|
    00000220  ff 07 00 00 00 00 00 00  22 00 00 00 00 00 00 00  |........".......|
    00000230  de 07 00 00 00 00 00 00  be 2c cb 6e 58 d4 e3 46  |.........,.nX..F|
    00000240  84 84 3c 83 52 59 5b 58  02 00 00 00 00 00 00 00  |..<.RY[X........|
    00000250  80 00 00 00 80 00 00 00  86 d2 54 ab 00 00 00 00  |..........T.....|
    00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000ffe00  45 46 49 20 50 41 52 54  00 00 01 00 5c 00 00 00  |EFI PART....\...|
    000ffe10  18 3a 1f d9 00 00 00 00  ff 07 00 00 00 00 00 00  |.:..............|
    000ffe20  01 00 00 00 00 00 00 00  22 00 00 00 00 00 00 00  |........".......|
    000ffe30  de 07 00 00 00 00 00 00  be 2c cb 6e 58 d4 e3 46  |.........,.nX..F|
    000ffe40  84 84 3c 83 52 59 5b 58  df 07 00 00 00 00 00 00  |..<.RY[X........|
    000ffe50  80 00 00 00 80 00 00 00  86 d2 54 ab 00 00 00 00  |..........T.....|
    000ffe60  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00100000
    
  4. 检查如何gdisk读取分区表:

    root@demo [/tmp]# gdisk gpt-demo
    GPT fdisk (gdisk) version 1.0.3
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    
    Command (? for help): q
    
  5. 更改GPT签名:

    root@demo [/tmp]# sed -i 's/EFI PART/IGNOREME/g' gpt-demo
    
  6. 验证签名是否为裸体:

    root@demo [/tmp]# hexdump -C gpt-demo
    00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000001c0  02 00 ee 20 20 00 01 00  00 00 ff 07 00 00 00 00  |...  ...........|
    000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
    00000200  49 47 4e 4f 52 45 4d 45  00 00 01 00 5c 00 00 00  |IGNOREME....\...|
    00000210  13 14 6d 6a 00 00 00 00  01 00 00 00 00 00 00 00  |..mj............|
    00000220  ff 07 00 00 00 00 00 00  22 00 00 00 00 00 00 00  |........".......|
    00000230  de 07 00 00 00 00 00 00  be 2c cb 6e 58 d4 e3 46  |.........,.nX..F|
    00000240  84 84 3c 83 52 59 5b 58  02 00 00 00 00 00 00 00  |..<.RY[X........|
    00000250  80 00 00 00 80 00 00 00  86 d2 54 ab 00 00 00 00  |..........T.....|
    00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000ffe00  49 47 4e 4f 52 45 4d 45  00 00 01 00 5c 00 00 00  |IGNOREME....\...|
    000ffe10  18 3a 1f d9 00 00 00 00  ff 07 00 00 00 00 00 00  |.:..............|
    000ffe20  01 00 00 00 00 00 00 00  22 00 00 00 00 00 00 00  |........".......|
    000ffe30  de 07 00 00 00 00 00 00  be 2c cb 6e 58 d4 e3 46  |.........,.nX..F|
    000ffe40  84 84 3c 83 52 59 5b 58  df 07 00 00 00 00 00 00  |..<.RY[X........|
    000ffe50  80 00 00 00 80 00 00 00  86 d2 54 ab 00 00 00 00  |..........T.....|
    000ffe60  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00100000
    
  7. 请注意,GUID分区表(GPT)不再被识别gdisk

    root@demo [/tmp]# gdisk gpt-demo
    GPT fdisk (gdisk) version 1.0.3
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: not present
    
    Creating new GPT entries.
    
    Command (? for help): q
    

我目前正在检查Chrome操作系统GPT,该签名似乎已设置为“ IGNOREME”。你知道会有什么影响吗?

据我从上面的演示可以看出,如果签名不同于EFI PART,则无法识别GPT。

IGNOREME“签名”是铬创建一个特殊的签名。这是我找到IGNOREME文档

cgptlib: Add support for IGNOREME GPT signature

This patch makes cgpt aware of a special "IGNOREME" GPT header signature
string that may appear in either the primary or the secondary GPT and
cause cgpt (and other cgptlib clients) to completely ignore that GPT. It
will continue to function correctly for all other purposes (using the
data from the non-ignored GPT), but never write any data back to the
ignored GPT.

BRANCH=None
BUG=chrome-os-partner:52595
TEST=unit tests

Change-Id: I7e53542385ae9d8d24dc25b75e91f4ff4917f66f
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340072
Reviewed-by: Nam Nguyen <namnguyen@google.com>

您是否在磁盘/块设备的末尾检查了辅助GPT?

还有其他有效的GPT签名吗?

不,没有其他签名,EFI PART因为那是UEFI规范中唯一的签名(请参阅第123页)。(UEFI规范版本2.7(勘误A)的存档副本


这很有趣,谢谢。因此,如果此签名为空,那么将无法识别GPT分区表?我目前正在检查Chrome操作系统GPT,该签名似乎已设置为“ IGNOREME”。你知道会有什么影响吗?还有其他有效的GPT签名吗?
Time4Tea

3
@ Time4Tea:在对以上答案的修改中,我已经回答了您的后续问题。
Deltik

1
很棒的编辑。谢谢您这么详细的回答!
Time4Tea

因此,“ IGNOREME”可能对Chromium / Chrome OS有意义,但是如果我将设备连接到“常规” Linux系统,它可能不会认出吗?
Time4Tea

2
@ Time4Tea:正确。您可以从我的答案中的演示中看到,将签名更改为以后,Linux将不再能够识别GPT布局IGNOREME
Deltik
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.