Centos – Expanding a disk with a GPT table

centosdiskgptpartedpartition

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?

Best Answer

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.

Related Question