Expanding a GPT partitioned volume in Linux

The GPT partition table is both at the beginning and end of the disk. When you expand your volume, you will need to re-write the GPT backup headers at the end of the expanded volume.

 

Enter into the “parted” utility on your resized volume.

$ parted /dev/nvmeX

 

Try to print the partition table and you will get a warning message. This is where you will re-write the GPT backup headers. Tell the parted utility to “fix” the backup GPT table.

(parted) p                                                                

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                                                    

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

Fix/Ignore? Fix

 

Print your partition table, and you will see it list.

(parted) p  

 

Now you are able to continue with resizing partitions or adding new ones to your volume.