AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 761197
Accepted
zomega
zomega
Asked: 2023-11-11 17:20:46 +0800 CST2023-11-11 17:20:46 +0800 CST 2023-11-11 17:20:46 +0800 CST

如何在 Linux 上调整 GPT 分区表本身的大小?

  • 772

我已使用dd.

但GPT的大小仍然是1GB。例如,辅助(备份)GPT 仍然位于 1GB(必须移至磁盘末尾)。

另外,我认为主 GPT 内的两个字段(偏移量 32 和 48)必须更新。

我已经调查过gdisk但找不到任何东西。

debian
  • 2 2 个回答
  • 224 Views

2 个回答

  • Voted
  1. Kamil Maciorowski
    2023-11-12T01:41:50+08:002023-11-12T01:41:50+08:00

    只需写入分区表gdisk即可。w你会看见:

    Warning! Secondary header is placed too early on the disk! Do you want to
    correct this problem? (Y/N):
    

    说y是。如有必要请再次确认。完毕。


    或者使用fdisk. 你会看见:

    GPT PMBR size mismatch (…) will be corrected by write.
    The backup GPT table is not on the end of the device. This problem will be corrected by write.
    

    同样只需w写入分区表即可。完毕。

    • 3
  2. Best Answer
    frostschutz
    2023-11-12T01:41:56+08:002023-11-12T01:41:56+08:00

    使用示例gdisk:

    # gdisk /dev/yourdisk
    Command (? for help): v
    
    Problem: The secondary header's self-pointer indicates that it doesn't reside
    at the end of the disk. If you've added a disk to a RAID array, use the 'e'
    option on the experts' menu to adjust the secondary header's and partition
    table's locations.
    
    Identified 1 problems!
    

    gdiskx使用起来可能有点神秘,但它在这里通过专家菜单( , )直接告诉您如何解决此问题e。

    Command (? for help): x
    
    Expert command (? for help): ?
    e   relocate backup data structures to the end of the disk
    
    Expert command (? for help): e
    Relocating backup data structures to the end of the disk
    

    此时你可以调整分区或者直接写出来:

    Expert command (? for help): v
    
    No problems found. 15624933 free sectors (7.5 GiB) available in 1
    segments, the largest of which is 15624933 (7.5 GiB) in size.
    
    Expert command (? for help): w
    
    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!
    
    Do you want to proceed? (Y/N): Y
    OK; writing new GUID partition table (GPT) to /dev/yourdisk.
    

    parted也可以使用,当你使用任何命令时它都会要求你修复它:

    # parted /dev/yourdisk print
    Warning: Not all of the space available to /dev/yourdisk appears to be used, 
    you can fix the GPT to use all of the space (an extra 13671875 blocks)
    or continue with the current setting?
    Fix/Ignore?
    

    fdisk将通过写入来调整 GPT 的大小。

    # fdisk /dev/yourdisk
    
    Welcome to fdisk (util-linux 2.39.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    GPT PMBR size mismatch (1953124 != 15624999) will be corrected by write.
    The backup GPT table is not on the end of the device. This problem will be corrected by write.
    
    Command (m for help): w
    
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    
    • 3

相关问题

  • GRUB 配置以识别同一 Linux 发行版的不同桌面环境(安装)

  • astyle 不会更改源文件格式

  • 接收有关全新 Debian 的电子邮件

  • Debian Stretch:libgs_plugin_systemd-updates.so 中的 gnome-software 段错误

  • 如何在拼音输入法中输入ü?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve