10

I'm running a CentOS 7 VM, where I have a second disk (sdb), which I need to expand often. After expanding the disk and I open 'parted' so that I can create a new partition, the following error message is returned:

Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)? Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space (an extra 10485760 blocks) or continue with the current setting?

If I type in Fix, the message disappears and I'm able to create the new partition.

Can someone advise if there is a chance of data corruption or breaking/deleting the data on the disk by using this method?

Mads Skjern
  • 921
  • 1
  • 7
  • 13
Alex Y
  • 101
  • 1
  • 1
  • 4

4 Answers4

8

That message is normal, if your (virtual) disk magically became larger.

GPT partition table is both at the start and at the end of the disk. It's supposed to make it more resilient against failure.

When you "fix" this issue it will simply re-write the GPT backup header at the new end of your disk. This does not affect existing partitions in any way at all, provided the main GPT header at the start of the device is intact.

It would be a different story if you were to change the logical sector size. GPT unfortunately still depends on that one... in this case you have to know the partition offsets (in bytes) and recreate the partition table from scratch, or hope that one of gdisk extended modes is capable of fixing it.

frostschutz
  • 47,228
  • 5
  • 112
  • 159
4

2019 Update :::

Had a similar situation as above ( ran parted -l ) but with an additional error as shown below. Entering 'Fix' for both the issues did not cause anything detrimental to the server.

Message 1:

Error: The backup GPT table is not at the end of the disk, as it should be.
This might mean that another operating system believes the disk is smaller.
Fix, by moving the backup to the end (and removing the old backup)?

Fix/Ignore/Cancel? Fix 

Message 2:

Warning: Not all of the space available to /dev/sda appears to be used,
you can fix he GPT to use all of the space (an extra 7812939776 
blocks) or continue with the current setting? 

Fix/Ignore? Fix  
MarcoZen
  • 181
  • 5
4

See this answer on Superuser. After moving the secondary GPT header to the new end of the disk, the parted warning should be gone.

# Move secondary GPT header to end of disk
sgdisk -e /dev/sda
Simon A. Eugster
  • 431
  • 1
  • 3
  • 11
  • I upvoted because this fixed my situation. I have vbox guest machines (Ubuntu 20.04) for which I occasionally want to change disk size via script. I use parted in the script to grow the partition. I could type 'fix' on the command line to make it work, however, it failed in script. This is undoubtedly what 'fix' did. – Steve O Apr 01 '22 at 22:06
1

I had the same issue and I used growpart instead of parted.

It doesn't show any error and it supports expanding primary disk without restarting VM.

I wrote the instructions in the below article:

https://superuser.com/a/1732414/988140

Anselmo Park
  • 171
  • 1
  • 7