Linux:在不更新 GPT 的情况下调整磁盘大小:gdisk 表示新扇区不可用

rec*_*lic 2 linux hard-drive partitioning gpt gdisk

我有一个 1TB 的硬盘/dev/sda,我买了一个 2TB 的新磁盘/dev/sdb。中已经有一些分区sda

我跑了dd if=/dev/sda of=/dev/sdb,然后把我的旧 1TB 磁盘/dev/sda扔进垃圾箱。然后我在新磁盘中启动到操作系统,一切正常。

然后我想添加一个新分区到/dev/sdb. 我跑,gdisk但它不允许我这样做。

这是 gdisk 所说的:(有 3907029168 个扇区(2TB),但最后一个可用扇区是 1953525134(1TB))

Command (? for help): p
Disk /dev/sdb: 3907029168 sectors, 1.8 TiB
Model: ST2000LX001-1RG1
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): F1EABB30-5410-4D71-AF46-3AA39380AB87
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 8-sector boundaries
Total free space is 4068 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          534527   260.0 MiB   EF00  EFI system partition
   2          534528          567295   16.0 MiB    0C01  Microsoft reserved ...
   3          567296       573710282   273.3 GiB   0700  Basic data partition
   4       778510336       780386303   916.0 MiB   2700  
   5       780388352       781410303   499.0 MiB   2700  Basic data partition
   6       781410304      1200836310   200.0 GiB   0700  Basic data partition
   7      1200836312      1515409111   150.0 GiB   0700  Microsoft basic data
   8      1515409112      1725124311   100.0 GiB   8300  Linux filesystem
   9      1725124312      1953525134   108.9 GiB   0700  Basic data partition
  10       573710288       778510335   97.7 GiB    8300  Linux filesystem

Command (? for help): n
Partition number (11-128, default 11): 
First sector (34-1200836311, default = 780386304) or {+-}size{KMGTP}: 1953525135
First sector (34-1200836311, default = 780386304) or {+-}size{KMGTP}: 
Run Code Online (Sandbox Code Playgroud)

怎么了?

谢谢!

rec*_*lic 7

由这篇文章解决:https : //serverfault.com/questions/848576/unable-to-extend-partition-with-gdisk-on-xenserver-6-5

我的磁盘现在是 2TB,但 GPT 分区表仍然认为有 1TB。使用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!
Run Code Online (Sandbox Code Playgroud)

运行x(专家模式)e(修复指针)m(返回主菜单)p(重新检查您的修改)w(保存!),然后一切正常。