Remove partition and enlarge partition

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am trying to delete my linux-swap partition /dev/sda5 and allocate the free space to /dev/sda6.



But when i try to delete sda5 GParted gives an error "You have to umount sda6".
But i can not umount sda6. I gives me the error "umount: /: target is busy"
If i reduce the size of sda5 i can not allocate the unallocated space to sda6.



Can anyone give me some advice on how to do this the right way?



I have a multi-boot system with windows and Linux. (Grub2)



enter image description here







share|improve this question















  • 1




    Neither of those addresses his problem.
    – Thomas Dickey
    Jun 13 at 23:08










  • If you happen to be running a remote (no direct access) system, live media is of limited usefulness. If the system had been setup to use LVM, you could have changed that swap partition to another chunk of the volume group containing /, and extended the filesystem with little impact.
    – Thomas Dickey
    Jun 13 at 23:50










  • @Dafnie, first you'll need to get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition. Next, turn off your swap partition with swapoff -a. Next, edit /etc/fstab and remove the entry for your swap partition...
    – Emmanuel Rosa
    Jun 14 at 15:26










  • ...Next, delete the swap partition with parted /dev/sda rm 5 Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /. Next, resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE. Finally, you can grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE...
    – Emmanuel Rosa
    Jun 14 at 15:27










  • ...Before running any of these commends, I highly recommend you have backups for everything; Basically you accept the possibility of wrecking your entire disk. And that you read the documentation for the commands so you know what they do and can adjust accordingly.
    – Emmanuel Rosa
    Jun 14 at 15:27














up vote
1
down vote

favorite












I am trying to delete my linux-swap partition /dev/sda5 and allocate the free space to /dev/sda6.



But when i try to delete sda5 GParted gives an error "You have to umount sda6".
But i can not umount sda6. I gives me the error "umount: /: target is busy"
If i reduce the size of sda5 i can not allocate the unallocated space to sda6.



Can anyone give me some advice on how to do this the right way?



I have a multi-boot system with windows and Linux. (Grub2)



enter image description here







share|improve this question















  • 1




    Neither of those addresses his problem.
    – Thomas Dickey
    Jun 13 at 23:08










  • If you happen to be running a remote (no direct access) system, live media is of limited usefulness. If the system had been setup to use LVM, you could have changed that swap partition to another chunk of the volume group containing /, and extended the filesystem with little impact.
    – Thomas Dickey
    Jun 13 at 23:50










  • @Dafnie, first you'll need to get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition. Next, turn off your swap partition with swapoff -a. Next, edit /etc/fstab and remove the entry for your swap partition...
    – Emmanuel Rosa
    Jun 14 at 15:26










  • ...Next, delete the swap partition with parted /dev/sda rm 5 Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /. Next, resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE. Finally, you can grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE...
    – Emmanuel Rosa
    Jun 14 at 15:27










  • ...Before running any of these commends, I highly recommend you have backups for everything; Basically you accept the possibility of wrecking your entire disk. And that you read the documentation for the commands so you know what they do and can adjust accordingly.
    – Emmanuel Rosa
    Jun 14 at 15:27












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am trying to delete my linux-swap partition /dev/sda5 and allocate the free space to /dev/sda6.



But when i try to delete sda5 GParted gives an error "You have to umount sda6".
But i can not umount sda6. I gives me the error "umount: /: target is busy"
If i reduce the size of sda5 i can not allocate the unallocated space to sda6.



Can anyone give me some advice on how to do this the right way?



I have a multi-boot system with windows and Linux. (Grub2)



enter image description here







share|improve this question











I am trying to delete my linux-swap partition /dev/sda5 and allocate the free space to /dev/sda6.



But when i try to delete sda5 GParted gives an error "You have to umount sda6".
But i can not umount sda6. I gives me the error "umount: /: target is busy"
If i reduce the size of sda5 i can not allocate the unallocated space to sda6.



Can anyone give me some advice on how to do this the right way?



I have a multi-boot system with windows and Linux. (Grub2)



enter image description here









share|improve this question










share|improve this question




share|improve this question









asked Jun 13 at 22:52









Dafnie

113




113







  • 1




    Neither of those addresses his problem.
    – Thomas Dickey
    Jun 13 at 23:08










  • If you happen to be running a remote (no direct access) system, live media is of limited usefulness. If the system had been setup to use LVM, you could have changed that swap partition to another chunk of the volume group containing /, and extended the filesystem with little impact.
    – Thomas Dickey
    Jun 13 at 23:50










  • @Dafnie, first you'll need to get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition. Next, turn off your swap partition with swapoff -a. Next, edit /etc/fstab and remove the entry for your swap partition...
    – Emmanuel Rosa
    Jun 14 at 15:26










  • ...Next, delete the swap partition with parted /dev/sda rm 5 Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /. Next, resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE. Finally, you can grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE...
    – Emmanuel Rosa
    Jun 14 at 15:27










  • ...Before running any of these commends, I highly recommend you have backups for everything; Basically you accept the possibility of wrecking your entire disk. And that you read the documentation for the commands so you know what they do and can adjust accordingly.
    – Emmanuel Rosa
    Jun 14 at 15:27












  • 1




    Neither of those addresses his problem.
    – Thomas Dickey
    Jun 13 at 23:08










  • If you happen to be running a remote (no direct access) system, live media is of limited usefulness. If the system had been setup to use LVM, you could have changed that swap partition to another chunk of the volume group containing /, and extended the filesystem with little impact.
    – Thomas Dickey
    Jun 13 at 23:50










  • @Dafnie, first you'll need to get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition. Next, turn off your swap partition with swapoff -a. Next, edit /etc/fstab and remove the entry for your swap partition...
    – Emmanuel Rosa
    Jun 14 at 15:26










  • ...Next, delete the swap partition with parted /dev/sda rm 5 Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /. Next, resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE. Finally, you can grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE...
    – Emmanuel Rosa
    Jun 14 at 15:27










  • ...Before running any of these commends, I highly recommend you have backups for everything; Basically you accept the possibility of wrecking your entire disk. And that you read the documentation for the commands so you know what they do and can adjust accordingly.
    – Emmanuel Rosa
    Jun 14 at 15:27







1




1




Neither of those addresses his problem.
– Thomas Dickey
Jun 13 at 23:08




Neither of those addresses his problem.
– Thomas Dickey
Jun 13 at 23:08












If you happen to be running a remote (no direct access) system, live media is of limited usefulness. If the system had been setup to use LVM, you could have changed that swap partition to another chunk of the volume group containing /, and extended the filesystem with little impact.
– Thomas Dickey
Jun 13 at 23:50




If you happen to be running a remote (no direct access) system, live media is of limited usefulness. If the system had been setup to use LVM, you could have changed that swap partition to another chunk of the volume group containing /, and extended the filesystem with little impact.
– Thomas Dickey
Jun 13 at 23:50












@Dafnie, first you'll need to get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition. Next, turn off your swap partition with swapoff -a. Next, edit /etc/fstab and remove the entry for your swap partition...
– Emmanuel Rosa
Jun 14 at 15:26




@Dafnie, first you'll need to get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition. Next, turn off your swap partition with swapoff -a. Next, edit /etc/fstab and remove the entry for your swap partition...
– Emmanuel Rosa
Jun 14 at 15:26












...Next, delete the swap partition with parted /dev/sda rm 5 Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /. Next, resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE. Finally, you can grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE...
– Emmanuel Rosa
Jun 14 at 15:27




...Next, delete the swap partition with parted /dev/sda rm 5 Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /. Next, resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE. Finally, you can grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE...
– Emmanuel Rosa
Jun 14 at 15:27












...Before running any of these commends, I highly recommend you have backups for everything; Basically you accept the possibility of wrecking your entire disk. And that you read the documentation for the commands so you know what they do and can adjust accordingly.
– Emmanuel Rosa
Jun 14 at 15:27




...Before running any of these commends, I highly recommend you have backups for everything; Basically you accept the possibility of wrecking your entire disk. And that you read the documentation for the commands so you know what they do and can adjust accordingly.
– Emmanuel Rosa
Jun 14 at 15:27










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










As you can see in the image, sda6 is an ext4 partition that's mounted as /. That's the main node of your system, so it will stay busy as long as the system is up. You need either a live USB/DVD session or to connect the drive under another running system and perform the operation from there.






share|improve this answer





















  • Thanks for the answars. I booted on a Linux USB and removed the swapdrive this way. 1. Disabled swap by rightkliking the swapdrive. 2. Unmount the swapdrive. 3. Delete the swapdrive. 4. expand the / drive 5. Edit /etc/fstab and remove the entry for your swap partition.
    – Dafnie
    Jun 16 at 19:28










  • @Dafnie Well done.
    – Tomasz
    Jun 16 at 19:30

















up vote
0
down vote













Here's how you can remove your swap partition and use the free/unallocated space for your / partition.



Warning



But first... Before running any of these commands, I insist you have backups for everything. This is so important it's worth mentioning twice: no backups? Do not proceed.



By proceeding you accept the possibility of wrecking your entire disk. That's the nature of manipulating partitions.



Procedure



  1. Get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition.


  2. Turn off your swap partition with swapoff -a.


  3. Edit /etc/fstab and remove the entry for your swap partition.


  4. Delete the swap partition with parted /dev/sda rm 5. Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /.


  5. Resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE.


  6. Grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE






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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f449687%2fremove-partition-and-enlarge-partition%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    As you can see in the image, sda6 is an ext4 partition that's mounted as /. That's the main node of your system, so it will stay busy as long as the system is up. You need either a live USB/DVD session or to connect the drive under another running system and perform the operation from there.






    share|improve this answer





















    • Thanks for the answars. I booted on a Linux USB and removed the swapdrive this way. 1. Disabled swap by rightkliking the swapdrive. 2. Unmount the swapdrive. 3. Delete the swapdrive. 4. expand the / drive 5. Edit /etc/fstab and remove the entry for your swap partition.
      – Dafnie
      Jun 16 at 19:28










    • @Dafnie Well done.
      – Tomasz
      Jun 16 at 19:30














    up vote
    2
    down vote



    accepted










    As you can see in the image, sda6 is an ext4 partition that's mounted as /. That's the main node of your system, so it will stay busy as long as the system is up. You need either a live USB/DVD session or to connect the drive under another running system and perform the operation from there.






    share|improve this answer





















    • Thanks for the answars. I booted on a Linux USB and removed the swapdrive this way. 1. Disabled swap by rightkliking the swapdrive. 2. Unmount the swapdrive. 3. Delete the swapdrive. 4. expand the / drive 5. Edit /etc/fstab and remove the entry for your swap partition.
      – Dafnie
      Jun 16 at 19:28










    • @Dafnie Well done.
      – Tomasz
      Jun 16 at 19:30












    up vote
    2
    down vote



    accepted







    up vote
    2
    down vote



    accepted






    As you can see in the image, sda6 is an ext4 partition that's mounted as /. That's the main node of your system, so it will stay busy as long as the system is up. You need either a live USB/DVD session or to connect the drive under another running system and perform the operation from there.






    share|improve this answer













    As you can see in the image, sda6 is an ext4 partition that's mounted as /. That's the main node of your system, so it will stay busy as long as the system is up. You need either a live USB/DVD session or to connect the drive under another running system and perform the operation from there.







    share|improve this answer













    share|improve this answer



    share|improve this answer











    answered Jun 13 at 23:14









    Tomasz

    8,03052560




    8,03052560











    • Thanks for the answars. I booted on a Linux USB and removed the swapdrive this way. 1. Disabled swap by rightkliking the swapdrive. 2. Unmount the swapdrive. 3. Delete the swapdrive. 4. expand the / drive 5. Edit /etc/fstab and remove the entry for your swap partition.
      – Dafnie
      Jun 16 at 19:28










    • @Dafnie Well done.
      – Tomasz
      Jun 16 at 19:30
















    • Thanks for the answars. I booted on a Linux USB and removed the swapdrive this way. 1. Disabled swap by rightkliking the swapdrive. 2. Unmount the swapdrive. 3. Delete the swapdrive. 4. expand the / drive 5. Edit /etc/fstab and remove the entry for your swap partition.
      – Dafnie
      Jun 16 at 19:28










    • @Dafnie Well done.
      – Tomasz
      Jun 16 at 19:30















    Thanks for the answars. I booted on a Linux USB and removed the swapdrive this way. 1. Disabled swap by rightkliking the swapdrive. 2. Unmount the swapdrive. 3. Delete the swapdrive. 4. expand the / drive 5. Edit /etc/fstab and remove the entry for your swap partition.
    – Dafnie
    Jun 16 at 19:28




    Thanks for the answars. I booted on a Linux USB and removed the swapdrive this way. 1. Disabled swap by rightkliking the swapdrive. 2. Unmount the swapdrive. 3. Delete the swapdrive. 4. expand the / drive 5. Edit /etc/fstab and remove the entry for your swap partition.
    – Dafnie
    Jun 16 at 19:28












    @Dafnie Well done.
    – Tomasz
    Jun 16 at 19:30




    @Dafnie Well done.
    – Tomasz
    Jun 16 at 19:30












    up vote
    0
    down vote













    Here's how you can remove your swap partition and use the free/unallocated space for your / partition.



    Warning



    But first... Before running any of these commands, I insist you have backups for everything. This is so important it's worth mentioning twice: no backups? Do not proceed.



    By proceeding you accept the possibility of wrecking your entire disk. That's the nature of manipulating partitions.



    Procedure



    1. Get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition.


    2. Turn off your swap partition with swapoff -a.


    3. Edit /etc/fstab and remove the entry for your swap partition.


    4. Delete the swap partition with parted /dev/sda rm 5. Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /.


    5. Resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE.


    6. Grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE






    share|improve this answer

























      up vote
      0
      down vote













      Here's how you can remove your swap partition and use the free/unallocated space for your / partition.



      Warning



      But first... Before running any of these commands, I insist you have backups for everything. This is so important it's worth mentioning twice: no backups? Do not proceed.



      By proceeding you accept the possibility of wrecking your entire disk. That's the nature of manipulating partitions.



      Procedure



      1. Get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition.


      2. Turn off your swap partition with swapoff -a.


      3. Edit /etc/fstab and remove the entry for your swap partition.


      4. Delete the swap partition with parted /dev/sda rm 5. Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /.


      5. Resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE.


      6. Grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Here's how you can remove your swap partition and use the free/unallocated space for your / partition.



        Warning



        But first... Before running any of these commands, I insist you have backups for everything. This is so important it's worth mentioning twice: no backups? Do not proceed.



        By proceeding you accept the possibility of wrecking your entire disk. That's the nature of manipulating partitions.



        Procedure



        1. Get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition.


        2. Turn off your swap partition with swapoff -a.


        3. Edit /etc/fstab and remove the entry for your swap partition.


        4. Delete the swap partition with parted /dev/sda rm 5. Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /.


        5. Resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE.


        6. Grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE






        share|improve this answer













        Here's how you can remove your swap partition and use the free/unallocated space for your / partition.



        Warning



        But first... Before running any of these commands, I insist you have backups for everything. This is so important it's worth mentioning twice: no backups? Do not proceed.



        By proceeding you accept the possibility of wrecking your entire disk. That's the nature of manipulating partitions.



        Procedure



        1. Get the last sector of your swap partition. Review the output of parted /dev/sda unit s print. If the start/end sector range of your swap partition is not AFTER the start/end range of your / partition, abort this procedure. Otherwise make a note of the end sector of the swap partition.


        2. Turn off your swap partition with swapoff -a.


        3. Edit /etc/fstab and remove the entry for your swap partition.


        4. Delete the swap partition with parted /dev/sda rm 5. Removing that partition will likely change the partition number for /, so run lsblk to get the correct partition number for /.


        5. Resize the / partition with parted /dev/sda unit s resizepart ROOT_PART_NUMBER_HERE LAST_SECTOR_HERE.


        6. Grow the filesystem online with resize2fs /dev/sdaROOT_PART_NUMBER_HERE







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Jun 15 at 14:43









        Emmanuel Rosa

        2,1801410




        2,1801410






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449687%2fremove-partition-and-enlarge-partition%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay