Shrinking LVM partition in order to enlarge swap on Ubuntu Mate 18.04

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








up vote
2
down vote

favorite












I'm facing an issue in my Ubuntu Mate 18.04 system.



I installed the file system in a LVM partition and would like to enlarge the swap space. I followed the instructions here but I get this message when I try to enlarge the partition




Insufficient free space: 512 extents needed, but only 0 available




This is the content of my disk according to fdisk -l



Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 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: 8F28ED66-4E76-4B77-AB4B-D0AB345E21CA

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 488396799 487346176 232,4G Linux LVM

Disk /dev/mapper/ubuntu--mate--vg-root: 231,4 GiB, 248474763264 bytes, 485302272 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

Disk /dev/mapper/ubuntu--mate--vg-swap_1: 996 MiB, 1044381696 bytes, 2039808 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


It seems like there's no free space left on the Physical volume in order to further enlarge the swap partition. If I type



sudo lvresize -l +100%FREE /dev/ubuntu-mate-vg/swap_1


I get



New size (249 extents) matches existing size (249 extents).


Therefore I'd like to shrink a bit (say, 5 Gb) my main partition vg-root and make that space available for swap. But I don't know how to do it :-/ Do you have any suggestion?



Thank you
Marco







share|improve this question
























    up vote
    2
    down vote

    favorite












    I'm facing an issue in my Ubuntu Mate 18.04 system.



    I installed the file system in a LVM partition and would like to enlarge the swap space. I followed the instructions here but I get this message when I try to enlarge the partition




    Insufficient free space: 512 extents needed, but only 0 available




    This is the content of my disk according to fdisk -l



    Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 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: 8F28ED66-4E76-4B77-AB4B-D0AB345E21CA

    Device Start End Sectors Size Type
    /dev/sda1 2048 1050623 1048576 512M EFI System
    /dev/sda2 1050624 488396799 487346176 232,4G Linux LVM

    Disk /dev/mapper/ubuntu--mate--vg-root: 231,4 GiB, 248474763264 bytes, 485302272 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

    Disk /dev/mapper/ubuntu--mate--vg-swap_1: 996 MiB, 1044381696 bytes, 2039808 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


    It seems like there's no free space left on the Physical volume in order to further enlarge the swap partition. If I type



    sudo lvresize -l +100%FREE /dev/ubuntu-mate-vg/swap_1


    I get



    New size (249 extents) matches existing size (249 extents).


    Therefore I'd like to shrink a bit (say, 5 Gb) my main partition vg-root and make that space available for swap. But I don't know how to do it :-/ Do you have any suggestion?



    Thank you
    Marco







    share|improve this question






















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I'm facing an issue in my Ubuntu Mate 18.04 system.



      I installed the file system in a LVM partition and would like to enlarge the swap space. I followed the instructions here but I get this message when I try to enlarge the partition




      Insufficient free space: 512 extents needed, but only 0 available




      This is the content of my disk according to fdisk -l



      Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 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: 8F28ED66-4E76-4B77-AB4B-D0AB345E21CA

      Device Start End Sectors Size Type
      /dev/sda1 2048 1050623 1048576 512M EFI System
      /dev/sda2 1050624 488396799 487346176 232,4G Linux LVM

      Disk /dev/mapper/ubuntu--mate--vg-root: 231,4 GiB, 248474763264 bytes, 485302272 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

      Disk /dev/mapper/ubuntu--mate--vg-swap_1: 996 MiB, 1044381696 bytes, 2039808 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


      It seems like there's no free space left on the Physical volume in order to further enlarge the swap partition. If I type



      sudo lvresize -l +100%FREE /dev/ubuntu-mate-vg/swap_1


      I get



      New size (249 extents) matches existing size (249 extents).


      Therefore I'd like to shrink a bit (say, 5 Gb) my main partition vg-root and make that space available for swap. But I don't know how to do it :-/ Do you have any suggestion?



      Thank you
      Marco







      share|improve this question












      I'm facing an issue in my Ubuntu Mate 18.04 system.



      I installed the file system in a LVM partition and would like to enlarge the swap space. I followed the instructions here but I get this message when I try to enlarge the partition




      Insufficient free space: 512 extents needed, but only 0 available




      This is the content of my disk according to fdisk -l



      Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 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: 8F28ED66-4E76-4B77-AB4B-D0AB345E21CA

      Device Start End Sectors Size Type
      /dev/sda1 2048 1050623 1048576 512M EFI System
      /dev/sda2 1050624 488396799 487346176 232,4G Linux LVM

      Disk /dev/mapper/ubuntu--mate--vg-root: 231,4 GiB, 248474763264 bytes, 485302272 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

      Disk /dev/mapper/ubuntu--mate--vg-swap_1: 996 MiB, 1044381696 bytes, 2039808 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


      It seems like there's no free space left on the Physical volume in order to further enlarge the swap partition. If I type



      sudo lvresize -l +100%FREE /dev/ubuntu-mate-vg/swap_1


      I get



      New size (249 extents) matches existing size (249 extents).


      Therefore I'd like to shrink a bit (say, 5 Gb) my main partition vg-root and make that space available for swap. But I don't know how to do it :-/ Do you have any suggestion?



      Thank you
      Marco









      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 23 at 12:19









      Marco Zanetti

      362




      362




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          I made it!



          What I did was:



          • install Ubuntu on a USB disk

          • run ubuntu without installing it

          • install KVPM on the live session

          • Reduced the main disk partition from KVPM (just a few seconds)

          • Expanded the swap partition from KVPM (just a few seconds again)

          Then I rebooted the PC (with my fingers crossed) and I could see the new size of the mail partition but NOT the new - enlarged size of the swap.



          What I did then was performing the following:



          sudo swapoff /dev/ubuntu-mate-vg/swap_1
          sudo mkswap /dev/ubuntu-mate-vg/swap_1
          sudo swapon /dev/ubuntu-mate-vg/swap_1


          Then the OS could see the whole swapping filesystem.



          It wasn't easy so I wanted all of you to know about it.






          share|improve this answer
















          • 1




            Nice work that you got it right!
            – George Udosen
            Apr 23 at 14:27










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          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: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2faskubuntu.com%2fquestions%2f1027446%2fshrinking-lvm-partition-in-order-to-enlarge-swap-on-ubuntu-mate-18-04%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          I made it!



          What I did was:



          • install Ubuntu on a USB disk

          • run ubuntu without installing it

          • install KVPM on the live session

          • Reduced the main disk partition from KVPM (just a few seconds)

          • Expanded the swap partition from KVPM (just a few seconds again)

          Then I rebooted the PC (with my fingers crossed) and I could see the new size of the mail partition but NOT the new - enlarged size of the swap.



          What I did then was performing the following:



          sudo swapoff /dev/ubuntu-mate-vg/swap_1
          sudo mkswap /dev/ubuntu-mate-vg/swap_1
          sudo swapon /dev/ubuntu-mate-vg/swap_1


          Then the OS could see the whole swapping filesystem.



          It wasn't easy so I wanted all of you to know about it.






          share|improve this answer
















          • 1




            Nice work that you got it right!
            – George Udosen
            Apr 23 at 14:27














          up vote
          2
          down vote













          I made it!



          What I did was:



          • install Ubuntu on a USB disk

          • run ubuntu without installing it

          • install KVPM on the live session

          • Reduced the main disk partition from KVPM (just a few seconds)

          • Expanded the swap partition from KVPM (just a few seconds again)

          Then I rebooted the PC (with my fingers crossed) and I could see the new size of the mail partition but NOT the new - enlarged size of the swap.



          What I did then was performing the following:



          sudo swapoff /dev/ubuntu-mate-vg/swap_1
          sudo mkswap /dev/ubuntu-mate-vg/swap_1
          sudo swapon /dev/ubuntu-mate-vg/swap_1


          Then the OS could see the whole swapping filesystem.



          It wasn't easy so I wanted all of you to know about it.






          share|improve this answer
















          • 1




            Nice work that you got it right!
            – George Udosen
            Apr 23 at 14:27












          up vote
          2
          down vote










          up vote
          2
          down vote









          I made it!



          What I did was:



          • install Ubuntu on a USB disk

          • run ubuntu without installing it

          • install KVPM on the live session

          • Reduced the main disk partition from KVPM (just a few seconds)

          • Expanded the swap partition from KVPM (just a few seconds again)

          Then I rebooted the PC (with my fingers crossed) and I could see the new size of the mail partition but NOT the new - enlarged size of the swap.



          What I did then was performing the following:



          sudo swapoff /dev/ubuntu-mate-vg/swap_1
          sudo mkswap /dev/ubuntu-mate-vg/swap_1
          sudo swapon /dev/ubuntu-mate-vg/swap_1


          Then the OS could see the whole swapping filesystem.



          It wasn't easy so I wanted all of you to know about it.






          share|improve this answer












          I made it!



          What I did was:



          • install Ubuntu on a USB disk

          • run ubuntu without installing it

          • install KVPM on the live session

          • Reduced the main disk partition from KVPM (just a few seconds)

          • Expanded the swap partition from KVPM (just a few seconds again)

          Then I rebooted the PC (with my fingers crossed) and I could see the new size of the mail partition but NOT the new - enlarged size of the swap.



          What I did then was performing the following:



          sudo swapoff /dev/ubuntu-mate-vg/swap_1
          sudo mkswap /dev/ubuntu-mate-vg/swap_1
          sudo swapon /dev/ubuntu-mate-vg/swap_1


          Then the OS could see the whole swapping filesystem.



          It wasn't easy so I wanted all of you to know about it.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 23 at 13:46









          Marco Zanetti

          362




          362







          • 1




            Nice work that you got it right!
            – George Udosen
            Apr 23 at 14:27












          • 1




            Nice work that you got it right!
            – George Udosen
            Apr 23 at 14:27







          1




          1




          Nice work that you got it right!
          – George Udosen
          Apr 23 at 14:27




          Nice work that you got it right!
          – George Udosen
          Apr 23 at 14:27

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1027446%2fshrinking-lvm-partition-in-order-to-enlarge-swap-on-ubuntu-mate-18-04%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          pylint3 and pip3 broken

          Missing snmpget and snmpwalk

          How to enroll fingerprints to Ubuntu 17.10 with VFS491