5

I am using Ubuntu 18.04 OS alone with GPT Partitioning Style.

I have several times installed dual OS, removed one OS etc.
I never let my data to erase.
In regards to this I am only deleting the partitions like EFI, MSReserved, OEM, /, /home, swap etc.

I want to know why /dev/sda shows irregular numbers like below and how can I make them in order.. I want to see the below table in this order.. sda1 sda2 sda3 sda4 and sda5

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors  
Units: sectors of 1 * 512 = 512 bytes  
Sector size (logical/physical): 512 bytes / 512 bytes  
I/O size (minimum/optimal): 512 bytes / 512 bytes  
Disklabel type: gpt  
Disk identifier: 918BD4B2-E90D-4F50-8E3E-4EFE6B86495D


Device          Start        End   Sectors   Size Type  
/dev/sda1        2048     194559    192512    94M EFI System  
/dev/sda2      194560   65298431  65103872    31G Linux filesystem  
/dev/sda3    65298432  488957951 423659520   202G Linux filesystem  
/dev/sda6   488957952 1221242879 732284928 349.2G Microsoft basic data  
/dev/sda7  1221242880 1953523711 732280832 349.2G Microsoft basic data

enter image description here

Update: Issue solved with @crass answer. enter image description here

7

Use sgdisk from the gdisk package to sort the entries. This can be done by issuing the below command.

sgdisk -s /dev/sda
   -s, --sort
          Sort partition entries. GPT partition numbers need not match the
          order of partitions on the disk. If you want them to match,  you
          can use this option.  Note that some partitioning utilities sort
          partitions whenever they make  changes.  Such  changes  will  be
          reflected  in  your  device  filenames,  so you may need to edit
          /etc/fstab if you use this option.
2
  • Nice feature of gdisk. I would have said just use parted to delete the partitions and recreate them with exactly the same start and size.
    – psusi
    Jun 22 '18 at 22:43
  • @PRATAP, if you follow psusi's method correctly (recreating the partitinos at exact same sector values), you won't lose any data... but it can be a scarier thing to do
    – crass
    Jun 23 '18 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.