Sort GPT partitions in Linux with gdisk (command s)












0















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!










share|improve this question





























    0















    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!










    share|improve this question



























      0












      0








      0








      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!










      share|improve this question
















      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!







      linux partitioning gdisk






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 3 '16 at 16:36









      GAD3R

      2,4321226




      2,4321226










      asked May 3 '16 at 10:51









      fenshanfenshan

      1




      1






















          2 Answers
          2






          active

          oldest

          votes


















          3














          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.






          share|improve this answer





















          • 1





            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 '16 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…)

            – grawity
            May 4 '16 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 '16 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.

            – grawity
            May 6 '16 at 4:31



















          1














          Slightly easier, from the command prompt:



          sgdisk --sort <device>


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






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1072490%2fsort-gpt-partitions-in-linux-with-gdisk-command-s%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            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.






            share|improve this answer





















            • 1





              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 '16 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…)

              – grawity
              May 4 '16 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 '16 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.

              – grawity
              May 6 '16 at 4:31
















            3














            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.






            share|improve this answer





















            • 1





              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 '16 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…)

              – grawity
              May 4 '16 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 '16 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.

              – grawity
              May 6 '16 at 4:31














            3












            3








            3







            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.






            share|improve this answer















            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.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 5 '16 at 4:32

























            answered May 3 '16 at 11:13









            grawitygrawity

            241k37508562




            241k37508562








            • 1





              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 '16 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…)

              – grawity
              May 4 '16 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 '16 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.

              – grawity
              May 6 '16 at 4:31














            • 1





              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 '16 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…)

              – grawity
              May 4 '16 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 '16 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.

              – grawity
              May 6 '16 at 4:31








            1




            1





            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 '16 at 13:15





            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 '16 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…)

            – grawity
            May 4 '16 at 13:20







            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…)

            – grawity
            May 4 '16 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 '16 at 12:54





            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 '16 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.

            – grawity
            May 6 '16 at 4:31





            Right, seems like I was mistaken about EFI boot entries – checking mine now I can see the ESP's UUID, not the disk UUID.

            – grawity
            May 6 '16 at 4:31













            1














            Slightly easier, from the command prompt:



            sgdisk --sort <device>


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






            share|improve this answer




























              1














              Slightly easier, from the command prompt:



              sgdisk --sort <device>


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






              share|improve this answer


























                1












                1








                1







                Slightly easier, from the command prompt:



                sgdisk --sort <device>


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






                share|improve this answer













                Slightly easier, from the command prompt:



                sgdisk --sort <device>


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







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 6 at 20:25









                lickdragonlickdragon

                111




                111






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1072490%2fsort-gpt-partitions-in-linux-with-gdisk-command-s%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido