How to create a partition with GNU Parted exactly at the end of the previous partition?












1














I have a 8 TB hard disk with two partitions on it: 3 TB and 1 TB, so remaining 4 TB is free. I'd like to create a 3rd partition which would span rest of the disk. In the early days with fdisk when creating a new partition the program would automatically offer a start position which would be right after the end of the previous partition. However GNU parted doesn't offer such an option.



The layout of the drive looks like this:



GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: ATA WDC WD80EFZX-68U (scsi)
Disk /dev/sdc: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 3001GB 3001GB primary
2 3001GB 4001GB 1000GB primary


All the guides suggest to use (in this case) "4001GB" as a start and "-1" as an end for the partition. The "4001GB" boundary in this case seems a bit ambiguous to me. While 1 GB in the scope of terabytes is insignificant, OCD-me would like to have the entire disk used.



Hence my question:



Is there a sensible way to create a new partition with GNU Parted in such a way that the new partition is right after the previous one, with proper alignment taken into account?
Or - if it is used with MB/GB/TB, does it just "do the right thing"?










share|improve this question


















  • 2




    Use the unit command to switch to something more fine grained (eg s for sector, or cyl for cylinder)
    – Stephen Harris
    Dec 27 '18 at 14:46










  • It does the right thing, it will not leave 1GB unused...
    – don_crissti
    Dec 27 '18 at 15:54








  • 2




    If you're more comfortable usingfdisk, you can also consider using gdisk to handle GPT disks.
    – Haxiel
    Dec 27 '18 at 16:25










  • @StephenHarris Yes, but what is the proper way? I would think that cylinders are irrelevant for SSDs so let's go with sectors. If the previous partition ends on a sector X, what number should I enter as a start for the new partition? X, or X+1, or X+something to keep it aligned?
    – Alex Darrell
    Dec 28 '18 at 16:14










  • @don_crissti Could you back this statement up with a link to relevant documentation?
    – Alex Darrell
    Dec 28 '18 at 16:14
















1














I have a 8 TB hard disk with two partitions on it: 3 TB and 1 TB, so remaining 4 TB is free. I'd like to create a 3rd partition which would span rest of the disk. In the early days with fdisk when creating a new partition the program would automatically offer a start position which would be right after the end of the previous partition. However GNU parted doesn't offer such an option.



The layout of the drive looks like this:



GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: ATA WDC WD80EFZX-68U (scsi)
Disk /dev/sdc: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 3001GB 3001GB primary
2 3001GB 4001GB 1000GB primary


All the guides suggest to use (in this case) "4001GB" as a start and "-1" as an end for the partition. The "4001GB" boundary in this case seems a bit ambiguous to me. While 1 GB in the scope of terabytes is insignificant, OCD-me would like to have the entire disk used.



Hence my question:



Is there a sensible way to create a new partition with GNU Parted in such a way that the new partition is right after the previous one, with proper alignment taken into account?
Or - if it is used with MB/GB/TB, does it just "do the right thing"?










share|improve this question


















  • 2




    Use the unit command to switch to something more fine grained (eg s for sector, or cyl for cylinder)
    – Stephen Harris
    Dec 27 '18 at 14:46










  • It does the right thing, it will not leave 1GB unused...
    – don_crissti
    Dec 27 '18 at 15:54








  • 2




    If you're more comfortable usingfdisk, you can also consider using gdisk to handle GPT disks.
    – Haxiel
    Dec 27 '18 at 16:25










  • @StephenHarris Yes, but what is the proper way? I would think that cylinders are irrelevant for SSDs so let's go with sectors. If the previous partition ends on a sector X, what number should I enter as a start for the new partition? X, or X+1, or X+something to keep it aligned?
    – Alex Darrell
    Dec 28 '18 at 16:14










  • @don_crissti Could you back this statement up with a link to relevant documentation?
    – Alex Darrell
    Dec 28 '18 at 16:14














1












1








1







I have a 8 TB hard disk with two partitions on it: 3 TB and 1 TB, so remaining 4 TB is free. I'd like to create a 3rd partition which would span rest of the disk. In the early days with fdisk when creating a new partition the program would automatically offer a start position which would be right after the end of the previous partition. However GNU parted doesn't offer such an option.



The layout of the drive looks like this:



GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: ATA WDC WD80EFZX-68U (scsi)
Disk /dev/sdc: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 3001GB 3001GB primary
2 3001GB 4001GB 1000GB primary


All the guides suggest to use (in this case) "4001GB" as a start and "-1" as an end for the partition. The "4001GB" boundary in this case seems a bit ambiguous to me. While 1 GB in the scope of terabytes is insignificant, OCD-me would like to have the entire disk used.



Hence my question:



Is there a sensible way to create a new partition with GNU Parted in such a way that the new partition is right after the previous one, with proper alignment taken into account?
Or - if it is used with MB/GB/TB, does it just "do the right thing"?










share|improve this question













I have a 8 TB hard disk with two partitions on it: 3 TB and 1 TB, so remaining 4 TB is free. I'd like to create a 3rd partition which would span rest of the disk. In the early days with fdisk when creating a new partition the program would automatically offer a start position which would be right after the end of the previous partition. However GNU parted doesn't offer such an option.



The layout of the drive looks like this:



GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: ATA WDC WD80EFZX-68U (scsi)
Disk /dev/sdc: 8002GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 3001GB 3001GB primary
2 3001GB 4001GB 1000GB primary


All the guides suggest to use (in this case) "4001GB" as a start and "-1" as an end for the partition. The "4001GB" boundary in this case seems a bit ambiguous to me. While 1 GB in the scope of terabytes is insignificant, OCD-me would like to have the entire disk used.



Hence my question:



Is there a sensible way to create a new partition with GNU Parted in such a way that the new partition is right after the previous one, with proper alignment taken into account?
Or - if it is used with MB/GB/TB, does it just "do the right thing"?







partition parted






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 27 '18 at 14:38









Alex DarrellAlex Darrell

80116




80116








  • 2




    Use the unit command to switch to something more fine grained (eg s for sector, or cyl for cylinder)
    – Stephen Harris
    Dec 27 '18 at 14:46










  • It does the right thing, it will not leave 1GB unused...
    – don_crissti
    Dec 27 '18 at 15:54








  • 2




    If you're more comfortable usingfdisk, you can also consider using gdisk to handle GPT disks.
    – Haxiel
    Dec 27 '18 at 16:25










  • @StephenHarris Yes, but what is the proper way? I would think that cylinders are irrelevant for SSDs so let's go with sectors. If the previous partition ends on a sector X, what number should I enter as a start for the new partition? X, or X+1, or X+something to keep it aligned?
    – Alex Darrell
    Dec 28 '18 at 16:14










  • @don_crissti Could you back this statement up with a link to relevant documentation?
    – Alex Darrell
    Dec 28 '18 at 16:14














  • 2




    Use the unit command to switch to something more fine grained (eg s for sector, or cyl for cylinder)
    – Stephen Harris
    Dec 27 '18 at 14:46










  • It does the right thing, it will not leave 1GB unused...
    – don_crissti
    Dec 27 '18 at 15:54








  • 2




    If you're more comfortable usingfdisk, you can also consider using gdisk to handle GPT disks.
    – Haxiel
    Dec 27 '18 at 16:25










  • @StephenHarris Yes, but what is the proper way? I would think that cylinders are irrelevant for SSDs so let's go with sectors. If the previous partition ends on a sector X, what number should I enter as a start for the new partition? X, or X+1, or X+something to keep it aligned?
    – Alex Darrell
    Dec 28 '18 at 16:14










  • @don_crissti Could you back this statement up with a link to relevant documentation?
    – Alex Darrell
    Dec 28 '18 at 16:14








2




2




Use the unit command to switch to something more fine grained (eg s for sector, or cyl for cylinder)
– Stephen Harris
Dec 27 '18 at 14:46




Use the unit command to switch to something more fine grained (eg s for sector, or cyl for cylinder)
– Stephen Harris
Dec 27 '18 at 14:46












It does the right thing, it will not leave 1GB unused...
– don_crissti
Dec 27 '18 at 15:54






It does the right thing, it will not leave 1GB unused...
– don_crissti
Dec 27 '18 at 15:54






2




2




If you're more comfortable usingfdisk, you can also consider using gdisk to handle GPT disks.
– Haxiel
Dec 27 '18 at 16:25




If you're more comfortable usingfdisk, you can also consider using gdisk to handle GPT disks.
– Haxiel
Dec 27 '18 at 16:25












@StephenHarris Yes, but what is the proper way? I would think that cylinders are irrelevant for SSDs so let's go with sectors. If the previous partition ends on a sector X, what number should I enter as a start for the new partition? X, or X+1, or X+something to keep it aligned?
– Alex Darrell
Dec 28 '18 at 16:14




@StephenHarris Yes, but what is the proper way? I would think that cylinders are irrelevant for SSDs so let's go with sectors. If the previous partition ends on a sector X, what number should I enter as a start for the new partition? X, or X+1, or X+something to keep it aligned?
– Alex Darrell
Dec 28 '18 at 16:14












@don_crissti Could you back this statement up with a link to relevant documentation?
– Alex Darrell
Dec 28 '18 at 16:14




@don_crissti Could you back this statement up with a link to relevant documentation?
– Alex Darrell
Dec 28 '18 at 16:14










1 Answer
1






active

oldest

votes


















1














With parted, use print free to see all free segments or gaps in your partitioning, as start/end/size that you can use in your subsequent mkpart commands.



(parted) unit mib # or s, b, whatever you prefer
(parted) print free
Model: (file)
Disk /dev/shm/foobar.img: 7629395MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
0.02MiB 1.00MiB 0.98MiB Free Space
1 1.00MiB 953674MiB 953673MiB root
953674MiB 2861023MiB 1907349MiB Free Space
3 2861023MiB 7629394MiB 4768371MiB data
7629394MiB 7629395MiB 0.52MiB Free Space


So in this example there is free space 953674MiB - 2861023MiB.



Create a partition and it should fill out perfectly.



(parted) mkpart home 953674MiB 2861023MiB
(parted) print free
Model: (file)
Disk /dev/shm/foobar.img: 7629395MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
0.02MiB 1.00MiB 0.98MiB Free Space
1 1.00MiB 953674MiB 953673MiB root
2 953674MiB 2861023MiB 1907349MiB home
3 2861023MiB 7629394MiB 4768371MiB data
7629394MiB 7629395MiB 0.52MiB Free Space



with proper alignment taken into account?




As already stated in the comments, the alignment depends on the correct end sector of the previous partition. It's best to check manually for correct MiB alignment.



If a partition did not have a correct size, it's usually (but not always) possible to grow the end sector of the previous partition accordingly, using the resizepart command. Leaving gaps in the partitioning is not harmful in any way, so don't worry too much about it.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f491138%2fhow-to-create-a-partition-with-gnu-parted-exactly-at-the-end-of-the-previous-par%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    With parted, use print free to see all free segments or gaps in your partitioning, as start/end/size that you can use in your subsequent mkpart commands.



    (parted) unit mib # or s, b, whatever you prefer
    (parted) print free
    Model: (file)
    Disk /dev/shm/foobar.img: 7629395MiB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:

    Number Start End Size File system Name Flags
    0.02MiB 1.00MiB 0.98MiB Free Space
    1 1.00MiB 953674MiB 953673MiB root
    953674MiB 2861023MiB 1907349MiB Free Space
    3 2861023MiB 7629394MiB 4768371MiB data
    7629394MiB 7629395MiB 0.52MiB Free Space


    So in this example there is free space 953674MiB - 2861023MiB.



    Create a partition and it should fill out perfectly.



    (parted) mkpart home 953674MiB 2861023MiB
    (parted) print free
    Model: (file)
    Disk /dev/shm/foobar.img: 7629395MiB
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:

    Number Start End Size File system Name Flags
    0.02MiB 1.00MiB 0.98MiB Free Space
    1 1.00MiB 953674MiB 953673MiB root
    2 953674MiB 2861023MiB 1907349MiB home
    3 2861023MiB 7629394MiB 4768371MiB data
    7629394MiB 7629395MiB 0.52MiB Free Space



    with proper alignment taken into account?




    As already stated in the comments, the alignment depends on the correct end sector of the previous partition. It's best to check manually for correct MiB alignment.



    If a partition did not have a correct size, it's usually (but not always) possible to grow the end sector of the previous partition accordingly, using the resizepart command. Leaving gaps in the partitioning is not harmful in any way, so don't worry too much about it.






    share|improve this answer


























      1














      With parted, use print free to see all free segments or gaps in your partitioning, as start/end/size that you can use in your subsequent mkpart commands.



      (parted) unit mib # or s, b, whatever you prefer
      (parted) print free
      Model: (file)
      Disk /dev/shm/foobar.img: 7629395MiB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags:

      Number Start End Size File system Name Flags
      0.02MiB 1.00MiB 0.98MiB Free Space
      1 1.00MiB 953674MiB 953673MiB root
      953674MiB 2861023MiB 1907349MiB Free Space
      3 2861023MiB 7629394MiB 4768371MiB data
      7629394MiB 7629395MiB 0.52MiB Free Space


      So in this example there is free space 953674MiB - 2861023MiB.



      Create a partition and it should fill out perfectly.



      (parted) mkpart home 953674MiB 2861023MiB
      (parted) print free
      Model: (file)
      Disk /dev/shm/foobar.img: 7629395MiB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags:

      Number Start End Size File system Name Flags
      0.02MiB 1.00MiB 0.98MiB Free Space
      1 1.00MiB 953674MiB 953673MiB root
      2 953674MiB 2861023MiB 1907349MiB home
      3 2861023MiB 7629394MiB 4768371MiB data
      7629394MiB 7629395MiB 0.52MiB Free Space



      with proper alignment taken into account?




      As already stated in the comments, the alignment depends on the correct end sector of the previous partition. It's best to check manually for correct MiB alignment.



      If a partition did not have a correct size, it's usually (but not always) possible to grow the end sector of the previous partition accordingly, using the resizepart command. Leaving gaps in the partitioning is not harmful in any way, so don't worry too much about it.






      share|improve this answer
























        1












        1








        1






        With parted, use print free to see all free segments or gaps in your partitioning, as start/end/size that you can use in your subsequent mkpart commands.



        (parted) unit mib # or s, b, whatever you prefer
        (parted) print free
        Model: (file)
        Disk /dev/shm/foobar.img: 7629395MiB
        Sector size (logical/physical): 512B/512B
        Partition Table: gpt
        Disk Flags:

        Number Start End Size File system Name Flags
        0.02MiB 1.00MiB 0.98MiB Free Space
        1 1.00MiB 953674MiB 953673MiB root
        953674MiB 2861023MiB 1907349MiB Free Space
        3 2861023MiB 7629394MiB 4768371MiB data
        7629394MiB 7629395MiB 0.52MiB Free Space


        So in this example there is free space 953674MiB - 2861023MiB.



        Create a partition and it should fill out perfectly.



        (parted) mkpart home 953674MiB 2861023MiB
        (parted) print free
        Model: (file)
        Disk /dev/shm/foobar.img: 7629395MiB
        Sector size (logical/physical): 512B/512B
        Partition Table: gpt
        Disk Flags:

        Number Start End Size File system Name Flags
        0.02MiB 1.00MiB 0.98MiB Free Space
        1 1.00MiB 953674MiB 953673MiB root
        2 953674MiB 2861023MiB 1907349MiB home
        3 2861023MiB 7629394MiB 4768371MiB data
        7629394MiB 7629395MiB 0.52MiB Free Space



        with proper alignment taken into account?




        As already stated in the comments, the alignment depends on the correct end sector of the previous partition. It's best to check manually for correct MiB alignment.



        If a partition did not have a correct size, it's usually (but not always) possible to grow the end sector of the previous partition accordingly, using the resizepart command. Leaving gaps in the partitioning is not harmful in any way, so don't worry too much about it.






        share|improve this answer












        With parted, use print free to see all free segments or gaps in your partitioning, as start/end/size that you can use in your subsequent mkpart commands.



        (parted) unit mib # or s, b, whatever you prefer
        (parted) print free
        Model: (file)
        Disk /dev/shm/foobar.img: 7629395MiB
        Sector size (logical/physical): 512B/512B
        Partition Table: gpt
        Disk Flags:

        Number Start End Size File system Name Flags
        0.02MiB 1.00MiB 0.98MiB Free Space
        1 1.00MiB 953674MiB 953673MiB root
        953674MiB 2861023MiB 1907349MiB Free Space
        3 2861023MiB 7629394MiB 4768371MiB data
        7629394MiB 7629395MiB 0.52MiB Free Space


        So in this example there is free space 953674MiB - 2861023MiB.



        Create a partition and it should fill out perfectly.



        (parted) mkpart home 953674MiB 2861023MiB
        (parted) print free
        Model: (file)
        Disk /dev/shm/foobar.img: 7629395MiB
        Sector size (logical/physical): 512B/512B
        Partition Table: gpt
        Disk Flags:

        Number Start End Size File system Name Flags
        0.02MiB 1.00MiB 0.98MiB Free Space
        1 1.00MiB 953674MiB 953673MiB root
        2 953674MiB 2861023MiB 1907349MiB home
        3 2861023MiB 7629394MiB 4768371MiB data
        7629394MiB 7629395MiB 0.52MiB Free Space



        with proper alignment taken into account?




        As already stated in the comments, the alignment depends on the correct end sector of the previous partition. It's best to check manually for correct MiB alignment.



        If a partition did not have a correct size, it's usually (but not always) possible to grow the end sector of the previous partition accordingly, using the resizepart command. Leaving gaps in the partitioning is not harmful in any way, so don't worry too much about it.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 28 '18 at 18:27









        frostschutzfrostschutz

        26.2k15282




        26.2k15282






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2funix.stackexchange.com%2fquestions%2f491138%2fhow-to-create-a-partition-with-gnu-parted-exactly-at-the-end-of-the-previous-par%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

            Morgemoulin

            Scott Moir

            Souastre