4

I have tried to sort my partitions to change the order, but when I try to use s command of gdisk, this warning appears:

You may need to edit /etc/fstab and/or your boot loader configuration!

And it doesn't let me use the command. What can I do to sort the partitions? (I can't use fdisk).

Thank you!

2 Answers 2

7

Use the s command in gdisk.

The warning doesn't prevent you from using the command. It's just a warning. If you use s and then p, you'll probably find that the partitions are, indeed, sorted and ready to be written.

Note that the "Sort" command only does what it says – sorts the partition table entries in ascending order, to match the actual disk layout. It doesn't let you move the GPT entries manually (use "Expert" → "Transpose" for that), and it does not move the actual partition contents.

4
  • 2
    Absolutely correct. I'd like to add that the warning is a bit of overabundance of caution. In the Old Days, /etc/fstab and boot loader configurations referred to partitions by device filename, like /dev/sda4. If you sort the entries, those may change, and therefore require edits to /etc/fstab and boot loader configuration files. Today, filesystems are usually identified by UUID values, which will not change because of a gdisk sort operation. Still, the old method can be used, and occasionally is.
    – Rod Smith
    May 4, 2016 at 13:15
  • AFAIK, some other things (e.g. the UEFI boot entries, and apparently the Windows BCD thing) still refer to disk UUID + partition index as well? (I remember having temporarily broken Windows on my dualboot system by deleting a preceding Linux partition…) May 4, 2016 at 13:20
  • That may well be. I'm not too familiar with Windows' BCD, so I can't comment on it. EFI boot entries normally refer to files on the EFI System Partition (ESP), which is usually the first or second partition, in part to minimize the risk of problems arising by it being renumbered. Still, if the ESP is a later-numbered partition (which is legal, even if it's unusual), problems might arise if it were to be renumbered. I can't say I've experimented with such changes, so I don't know firsthand what would actually happen.
    – Rod Smith
    May 5, 2016 at 12:54
  • Right, seems like I was mistaken about EFI boot entries – checking mine now I can see the ESP's UUID, not the disk UUID. May 6, 2016 at 4:31
2

Slightly easier, from the command prompt:

sgdisk --sort <device>

sgdisk is included in the gdisk package on CentOS 6 and 7

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .