Is there a way to relocate LVs from an un-partitioned disk to a partition on another disk?












1














Freshly signed up newb here, apologies in advance for any silliness and wordiness.



(Also excuse the makeshift formatting; ssh is not enabled on my build yet, and my company has copy-paste disabled in vSphere).



Been grinding pretty hard at my *nix education over the past year or two, and engineering at work has enough faith in me now apparently to have tasked me with an Ubuntu 18.04 LTS lab test VM on our vCenter to ensure that we can support it properly.



Here's some additional details on the issue.



When I booted the ISO, I set up partitioning manually, as per policy. Our current standard is 16 (hence my project to test 18.04), but to complicate things further our documentation is even older than that; version 14. Notably, the boot/installation process seems markedly different between the two versions.



This was the partition plan used:




/boot -512 MB -N/A - This must be physical

/ -5120 MB -lv_root

/var -5120 MB -lv_var

/home -1024 MB -lv_home

/tmp -3072 MB -lv_tmp

swap -1 x RAM with a maximum of 4096 MB -lv_swap

/free -All remaining free space. -lv_free


So initially, I set the VM up with a single disk. However, I noticed that whenever I chose to add a partition to this disk during setup, the option to set LVM became grayed out. The reverse was also true - setting up LVM negated the option to partition the disk. What I eventually did to work around this was simply make two disks, one very small one to mount /boot on, and another much larger one for everything else.



The other issue is that I'm not intending for swap to mounted the way it is. But there was no option in the OS setup that allowed for anything other than "/swap".



What I've wound up with is the following:




sda disk
|-sda1 part
|-sda2 part /boot
sdb disk
|-system_vg_lv_root lvm /
|-system_vg_lv_var lvm /var
|-system_vg_lv_home lvm /home
|-system_vg_lv_tmp lvm /tmp
|-system_vg_lv_swap lvm /swap
|-system_vg_lv_free lvm /free


And what I need is this:




sda disk
|-sda1 part /boot
|-sda2 part
|-system_vg_lv_root lvm /
|-system_vg_lv_var lvm /var
|-system_vg_lv_home lvm /home
|-system_vg_lv_tmp lvm /tmp
|-system_vg_lv_swap lvm [SWAP]
|-system_vg_lv_free lvm /free


And I'm not sure how I can fix this without completely rebuilding the VM from scratch, which I'd really love to avoid. I'm hoping there is a way to unmount the entire vg from sdb and then expand the sda disk in vSphere, add that space to sda1 or sda2 and then put the vg back. That and I need to know what I'm doing wrong with swap. I need it mounted as [SWAP], not /swap, and I know how to do that, but it doesn't help if the entire vg is still taking up its own disk.



Is this fixable? And if I do need to rebuild the OS, is there a step I misread that I can revisit to avoid this in the future?










share|improve this question





























    1














    Freshly signed up newb here, apologies in advance for any silliness and wordiness.



    (Also excuse the makeshift formatting; ssh is not enabled on my build yet, and my company has copy-paste disabled in vSphere).



    Been grinding pretty hard at my *nix education over the past year or two, and engineering at work has enough faith in me now apparently to have tasked me with an Ubuntu 18.04 LTS lab test VM on our vCenter to ensure that we can support it properly.



    Here's some additional details on the issue.



    When I booted the ISO, I set up partitioning manually, as per policy. Our current standard is 16 (hence my project to test 18.04), but to complicate things further our documentation is even older than that; version 14. Notably, the boot/installation process seems markedly different between the two versions.



    This was the partition plan used:




    /boot -512 MB -N/A - This must be physical

    / -5120 MB -lv_root

    /var -5120 MB -lv_var

    /home -1024 MB -lv_home

    /tmp -3072 MB -lv_tmp

    swap -1 x RAM with a maximum of 4096 MB -lv_swap

    /free -All remaining free space. -lv_free


    So initially, I set the VM up with a single disk. However, I noticed that whenever I chose to add a partition to this disk during setup, the option to set LVM became grayed out. The reverse was also true - setting up LVM negated the option to partition the disk. What I eventually did to work around this was simply make two disks, one very small one to mount /boot on, and another much larger one for everything else.



    The other issue is that I'm not intending for swap to mounted the way it is. But there was no option in the OS setup that allowed for anything other than "/swap".



    What I've wound up with is the following:




    sda disk
    |-sda1 part
    |-sda2 part /boot
    sdb disk
    |-system_vg_lv_root lvm /
    |-system_vg_lv_var lvm /var
    |-system_vg_lv_home lvm /home
    |-system_vg_lv_tmp lvm /tmp
    |-system_vg_lv_swap lvm /swap
    |-system_vg_lv_free lvm /free


    And what I need is this:




    sda disk
    |-sda1 part /boot
    |-sda2 part
    |-system_vg_lv_root lvm /
    |-system_vg_lv_var lvm /var
    |-system_vg_lv_home lvm /home
    |-system_vg_lv_tmp lvm /tmp
    |-system_vg_lv_swap lvm [SWAP]
    |-system_vg_lv_free lvm /free


    And I'm not sure how I can fix this without completely rebuilding the VM from scratch, which I'd really love to avoid. I'm hoping there is a way to unmount the entire vg from sdb and then expand the sda disk in vSphere, add that space to sda1 or sda2 and then put the vg back. That and I need to know what I'm doing wrong with swap. I need it mounted as [SWAP], not /swap, and I know how to do that, but it doesn't help if the entire vg is still taking up its own disk.



    Is this fixable? And if I do need to rebuild the OS, is there a step I misread that I can revisit to avoid this in the future?










    share|improve this question



























      1












      1








      1







      Freshly signed up newb here, apologies in advance for any silliness and wordiness.



      (Also excuse the makeshift formatting; ssh is not enabled on my build yet, and my company has copy-paste disabled in vSphere).



      Been grinding pretty hard at my *nix education over the past year or two, and engineering at work has enough faith in me now apparently to have tasked me with an Ubuntu 18.04 LTS lab test VM on our vCenter to ensure that we can support it properly.



      Here's some additional details on the issue.



      When I booted the ISO, I set up partitioning manually, as per policy. Our current standard is 16 (hence my project to test 18.04), but to complicate things further our documentation is even older than that; version 14. Notably, the boot/installation process seems markedly different between the two versions.



      This was the partition plan used:




      /boot -512 MB -N/A - This must be physical

      / -5120 MB -lv_root

      /var -5120 MB -lv_var

      /home -1024 MB -lv_home

      /tmp -3072 MB -lv_tmp

      swap -1 x RAM with a maximum of 4096 MB -lv_swap

      /free -All remaining free space. -lv_free


      So initially, I set the VM up with a single disk. However, I noticed that whenever I chose to add a partition to this disk during setup, the option to set LVM became grayed out. The reverse was also true - setting up LVM negated the option to partition the disk. What I eventually did to work around this was simply make two disks, one very small one to mount /boot on, and another much larger one for everything else.



      The other issue is that I'm not intending for swap to mounted the way it is. But there was no option in the OS setup that allowed for anything other than "/swap".



      What I've wound up with is the following:




      sda disk
      |-sda1 part
      |-sda2 part /boot
      sdb disk
      |-system_vg_lv_root lvm /
      |-system_vg_lv_var lvm /var
      |-system_vg_lv_home lvm /home
      |-system_vg_lv_tmp lvm /tmp
      |-system_vg_lv_swap lvm /swap
      |-system_vg_lv_free lvm /free


      And what I need is this:




      sda disk
      |-sda1 part /boot
      |-sda2 part
      |-system_vg_lv_root lvm /
      |-system_vg_lv_var lvm /var
      |-system_vg_lv_home lvm /home
      |-system_vg_lv_tmp lvm /tmp
      |-system_vg_lv_swap lvm [SWAP]
      |-system_vg_lv_free lvm /free


      And I'm not sure how I can fix this without completely rebuilding the VM from scratch, which I'd really love to avoid. I'm hoping there is a way to unmount the entire vg from sdb and then expand the sda disk in vSphere, add that space to sda1 or sda2 and then put the vg back. That and I need to know what I'm doing wrong with swap. I need it mounted as [SWAP], not /swap, and I know how to do that, but it doesn't help if the entire vg is still taking up its own disk.



      Is this fixable? And if I do need to rebuild the OS, is there a step I misread that I can revisit to avoid this in the future?










      share|improve this question















      Freshly signed up newb here, apologies in advance for any silliness and wordiness.



      (Also excuse the makeshift formatting; ssh is not enabled on my build yet, and my company has copy-paste disabled in vSphere).



      Been grinding pretty hard at my *nix education over the past year or two, and engineering at work has enough faith in me now apparently to have tasked me with an Ubuntu 18.04 LTS lab test VM on our vCenter to ensure that we can support it properly.



      Here's some additional details on the issue.



      When I booted the ISO, I set up partitioning manually, as per policy. Our current standard is 16 (hence my project to test 18.04), but to complicate things further our documentation is even older than that; version 14. Notably, the boot/installation process seems markedly different between the two versions.



      This was the partition plan used:




      /boot -512 MB -N/A - This must be physical

      / -5120 MB -lv_root

      /var -5120 MB -lv_var

      /home -1024 MB -lv_home

      /tmp -3072 MB -lv_tmp

      swap -1 x RAM with a maximum of 4096 MB -lv_swap

      /free -All remaining free space. -lv_free


      So initially, I set the VM up with a single disk. However, I noticed that whenever I chose to add a partition to this disk during setup, the option to set LVM became grayed out. The reverse was also true - setting up LVM negated the option to partition the disk. What I eventually did to work around this was simply make two disks, one very small one to mount /boot on, and another much larger one for everything else.



      The other issue is that I'm not intending for swap to mounted the way it is. But there was no option in the OS setup that allowed for anything other than "/swap".



      What I've wound up with is the following:




      sda disk
      |-sda1 part
      |-sda2 part /boot
      sdb disk
      |-system_vg_lv_root lvm /
      |-system_vg_lv_var lvm /var
      |-system_vg_lv_home lvm /home
      |-system_vg_lv_tmp lvm /tmp
      |-system_vg_lv_swap lvm /swap
      |-system_vg_lv_free lvm /free


      And what I need is this:




      sda disk
      |-sda1 part /boot
      |-sda2 part
      |-system_vg_lv_root lvm /
      |-system_vg_lv_var lvm /var
      |-system_vg_lv_home lvm /home
      |-system_vg_lv_tmp lvm /tmp
      |-system_vg_lv_swap lvm [SWAP]
      |-system_vg_lv_free lvm /free


      And I'm not sure how I can fix this without completely rebuilding the VM from scratch, which I'd really love to avoid. I'm hoping there is a way to unmount the entire vg from sdb and then expand the sda disk in vSphere, add that space to sda1 or sda2 and then put the vg back. That and I need to know what I'm doing wrong with swap. I need it mounted as [SWAP], not /swap, and I know how to do that, but it doesn't help if the entire vg is still taking up its own disk.



      Is this fixable? And if I do need to rebuild the OS, is there a step I misread that I can revisit to avoid this in the future?







      boot partitioning lvm






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 at 7:21

























      asked Nov 13 at 7:15









      conor9999

      63




      63



























          active

          oldest

          votes











          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%2f1092456%2fis-there-a-way-to-relocate-lvs-from-an-un-partitioned-disk-to-a-partition-on-ano%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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.





          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%2faskubuntu.com%2fquestions%2f1092456%2fis-there-a-way-to-relocate-lvs-from-an-un-partitioned-disk-to-a-partition-on-ano%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

          How to make a Squid Proxy server?

          Is this a new Fibonacci Identity?

          Touch on Surface Book