Ubuntu – How to fix the partitions’ number on GPT disk (/dev/sdaX)

gpartedpartitioning

I used Gparted to delete EFI (/dev/sda1) and Ubuntu (/dev/sda2) partitions on my secondary drive. The third partition (/dev/sda3) is for data, so I resized it in order to use all unallocated space I've got by deleting the first two partitions. Now, having only a unique partion on the disk, I would like to fix it's number, in order to get /dev/sda1.
What's the easiest way to do it that works with a disk having GPT partition table?
Thank you!

Best Answer

You may use gdisk to rewrite the partition-table:

sudo gdisk /dev/sda
p  (the p-command prints the recent partition-table on-screen)
s  (the s-command sorts the partition-table entries)
p  (use the p-command again to see the result on your screen)
w  (write the changed partition-table to the disk)
q  (quit gdisk)

You will find most useful information about gdisk at http://www.rodsbooks.com/gdisk/

Related Question