How can I modify the size of swap with LVM partitions?












20















I'm trying to add/modify a swap partition on my LVM-formatted hard disk by using GParted from a LiveCD. I only see one big partition taking up the whole disk.



Is there a hidden swap?



Does an LVM-formatted system even need a swap?



I'm using Ubuntu 12.10.










share|improve this question





























    20















    I'm trying to add/modify a swap partition on my LVM-formatted hard disk by using GParted from a LiveCD. I only see one big partition taking up the whole disk.



    Is there a hidden swap?



    Does an LVM-formatted system even need a swap?



    I'm using Ubuntu 12.10.










    share|improve this question



























      20












      20








      20


      9






      I'm trying to add/modify a swap partition on my LVM-formatted hard disk by using GParted from a LiveCD. I only see one big partition taking up the whole disk.



      Is there a hidden swap?



      Does an LVM-formatted system even need a swap?



      I'm using Ubuntu 12.10.










      share|improve this question
















      I'm trying to add/modify a swap partition on my LVM-formatted hard disk by using GParted from a LiveCD. I only see one big partition taking up the whole disk.



      Is there a hidden swap?



      Does an LVM-formatted system even need a swap?



      I'm using Ubuntu 12.10.







      partitioning gparted swap lvm






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 18:06









      Zanna

      50.4k13133241




      50.4k13133241










      asked Dec 7 '12 at 15:19









      fredhfredh

      101113




      101113






















          2 Answers
          2






          active

          oldest

          votes


















          24














          I do not like using GParted, partially because most of my servers are without GUI.



          Here's how to extend a swap setup as a logical volume:



          1) Determine the name of the swap logical volume using the "lvs" command:



          $ lvs
          LV VG Attr LSize Origin Snap% Move Log Copy%
          root_lv volgroup0 -wi-ao 7.00G
          swap_lv1 volgroup0 -wi-ao 30.00G
          tmp_lv volgroup0 -wi-ao 3.00G
          usr_lv volgroup0 -wi-ao 7.00G
          var_lv volgroup0 -wi-ao 4.00G


          2) Turn off the swap partition:



          $ swapoff /dev/volgroup0/swap_lv1


          3) Resize the swap partition, adding 15GB more space to it:



          $ lvresize -L+15G /dev/volgroup0/swap_lv1
          Extending logical volume swap_lv1 to 30.00 GB
          Logical volume swap_lv1 successfully resized


          4) Format the new swap space to make it usable:



          $ mkswap /dev/volgroup0/swap_lv1
          Setting up swapspace version 1, size = 41875927 kB


          5) Turn the swap volume back on:



          $ swapon /dev/volgroup0/swap_lv1


          6) Use free command to show your new swap space:



          $ free -t | grep -i swap
          Swap: 30719 0 30719





          share|improve this answer

































            1














            Whether you use LVM or not has nothing to do with whether you need swap or not.



            To view LVM logical volumes, run lvs on the command line, or use the GNOME Disks utility.



            The version of GParted that ships with Ubuntu 12.10 does not support LVM. It only sees physical volumes, and cannot resize or move them.



            However, the latest version of GParted does support LVM. I would download the GParted Live CD and use that.






            share|improve this answer























              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',
              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%2faskubuntu.com%2fquestions%2f226520%2fhow-can-i-modify-the-size-of-swap-with-lvm-partitions%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









              24














              I do not like using GParted, partially because most of my servers are without GUI.



              Here's how to extend a swap setup as a logical volume:



              1) Determine the name of the swap logical volume using the "lvs" command:



              $ lvs
              LV VG Attr LSize Origin Snap% Move Log Copy%
              root_lv volgroup0 -wi-ao 7.00G
              swap_lv1 volgroup0 -wi-ao 30.00G
              tmp_lv volgroup0 -wi-ao 3.00G
              usr_lv volgroup0 -wi-ao 7.00G
              var_lv volgroup0 -wi-ao 4.00G


              2) Turn off the swap partition:



              $ swapoff /dev/volgroup0/swap_lv1


              3) Resize the swap partition, adding 15GB more space to it:



              $ lvresize -L+15G /dev/volgroup0/swap_lv1
              Extending logical volume swap_lv1 to 30.00 GB
              Logical volume swap_lv1 successfully resized


              4) Format the new swap space to make it usable:



              $ mkswap /dev/volgroup0/swap_lv1
              Setting up swapspace version 1, size = 41875927 kB


              5) Turn the swap volume back on:



              $ swapon /dev/volgroup0/swap_lv1


              6) Use free command to show your new swap space:



              $ free -t | grep -i swap
              Swap: 30719 0 30719





              share|improve this answer






























                24














                I do not like using GParted, partially because most of my servers are without GUI.



                Here's how to extend a swap setup as a logical volume:



                1) Determine the name of the swap logical volume using the "lvs" command:



                $ lvs
                LV VG Attr LSize Origin Snap% Move Log Copy%
                root_lv volgroup0 -wi-ao 7.00G
                swap_lv1 volgroup0 -wi-ao 30.00G
                tmp_lv volgroup0 -wi-ao 3.00G
                usr_lv volgroup0 -wi-ao 7.00G
                var_lv volgroup0 -wi-ao 4.00G


                2) Turn off the swap partition:



                $ swapoff /dev/volgroup0/swap_lv1


                3) Resize the swap partition, adding 15GB more space to it:



                $ lvresize -L+15G /dev/volgroup0/swap_lv1
                Extending logical volume swap_lv1 to 30.00 GB
                Logical volume swap_lv1 successfully resized


                4) Format the new swap space to make it usable:



                $ mkswap /dev/volgroup0/swap_lv1
                Setting up swapspace version 1, size = 41875927 kB


                5) Turn the swap volume back on:



                $ swapon /dev/volgroup0/swap_lv1


                6) Use free command to show your new swap space:



                $ free -t | grep -i swap
                Swap: 30719 0 30719





                share|improve this answer




























                  24












                  24








                  24







                  I do not like using GParted, partially because most of my servers are without GUI.



                  Here's how to extend a swap setup as a logical volume:



                  1) Determine the name of the swap logical volume using the "lvs" command:



                  $ lvs
                  LV VG Attr LSize Origin Snap% Move Log Copy%
                  root_lv volgroup0 -wi-ao 7.00G
                  swap_lv1 volgroup0 -wi-ao 30.00G
                  tmp_lv volgroup0 -wi-ao 3.00G
                  usr_lv volgroup0 -wi-ao 7.00G
                  var_lv volgroup0 -wi-ao 4.00G


                  2) Turn off the swap partition:



                  $ swapoff /dev/volgroup0/swap_lv1


                  3) Resize the swap partition, adding 15GB more space to it:



                  $ lvresize -L+15G /dev/volgroup0/swap_lv1
                  Extending logical volume swap_lv1 to 30.00 GB
                  Logical volume swap_lv1 successfully resized


                  4) Format the new swap space to make it usable:



                  $ mkswap /dev/volgroup0/swap_lv1
                  Setting up swapspace version 1, size = 41875927 kB


                  5) Turn the swap volume back on:



                  $ swapon /dev/volgroup0/swap_lv1


                  6) Use free command to show your new swap space:



                  $ free -t | grep -i swap
                  Swap: 30719 0 30719





                  share|improve this answer















                  I do not like using GParted, partially because most of my servers are without GUI.



                  Here's how to extend a swap setup as a logical volume:



                  1) Determine the name of the swap logical volume using the "lvs" command:



                  $ lvs
                  LV VG Attr LSize Origin Snap% Move Log Copy%
                  root_lv volgroup0 -wi-ao 7.00G
                  swap_lv1 volgroup0 -wi-ao 30.00G
                  tmp_lv volgroup0 -wi-ao 3.00G
                  usr_lv volgroup0 -wi-ao 7.00G
                  var_lv volgroup0 -wi-ao 4.00G


                  2) Turn off the swap partition:



                  $ swapoff /dev/volgroup0/swap_lv1


                  3) Resize the swap partition, adding 15GB more space to it:



                  $ lvresize -L+15G /dev/volgroup0/swap_lv1
                  Extending logical volume swap_lv1 to 30.00 GB
                  Logical volume swap_lv1 successfully resized


                  4) Format the new swap space to make it usable:



                  $ mkswap /dev/volgroup0/swap_lv1
                  Setting up swapspace version 1, size = 41875927 kB


                  5) Turn the swap volume back on:



                  $ swapon /dev/volgroup0/swap_lv1


                  6) Use free command to show your new swap space:



                  $ free -t | grep -i swap
                  Swap: 30719 0 30719






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 19 '18 at 19:41









                  MeSo2

                  58112




                  58112










                  answered Jun 3 '13 at 21:11









                  kobaltzkobaltz

                  35125




                  35125

























                      1














                      Whether you use LVM or not has nothing to do with whether you need swap or not.



                      To view LVM logical volumes, run lvs on the command line, or use the GNOME Disks utility.



                      The version of GParted that ships with Ubuntu 12.10 does not support LVM. It only sees physical volumes, and cannot resize or move them.



                      However, the latest version of GParted does support LVM. I would download the GParted Live CD and use that.






                      share|improve this answer




























                        1














                        Whether you use LVM or not has nothing to do with whether you need swap or not.



                        To view LVM logical volumes, run lvs on the command line, or use the GNOME Disks utility.



                        The version of GParted that ships with Ubuntu 12.10 does not support LVM. It only sees physical volumes, and cannot resize or move them.



                        However, the latest version of GParted does support LVM. I would download the GParted Live CD and use that.






                        share|improve this answer


























                          1












                          1








                          1







                          Whether you use LVM or not has nothing to do with whether you need swap or not.



                          To view LVM logical volumes, run lvs on the command line, or use the GNOME Disks utility.



                          The version of GParted that ships with Ubuntu 12.10 does not support LVM. It only sees physical volumes, and cannot resize or move them.



                          However, the latest version of GParted does support LVM. I would download the GParted Live CD and use that.






                          share|improve this answer













                          Whether you use LVM or not has nothing to do with whether you need swap or not.



                          To view LVM logical volumes, run lvs on the command line, or use the GNOME Disks utility.



                          The version of GParted that ships with Ubuntu 12.10 does not support LVM. It only sees physical volumes, and cannot resize or move them.



                          However, the latest version of GParted does support LVM. I would download the GParted Live CD and use that.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 7 '12 at 16:41









                          FlimmFlimm

                          21.2k1562120




                          21.2k1562120






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • 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%2faskubuntu.com%2fquestions%2f226520%2fhow-can-i-modify-the-size-of-swap-with-lvm-partitions%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

                              Human spaceflight

                              Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                              File:DeusFollowingSea.jpg