Move all data in LV to first PV, remove others












0














I have a logical volume, /dev/echohome/home01



It has three physical volumes: /dev/sda1, /dev/sdb1, /dev/sdc1



sda1 is 4TB w/ 0 extents available, sdb1 is 4TB w/ 476930 extents available, sdc1 is 1TB w/ 0 extents available



Current ext4 filesystem is ~45% full @ 3.1TB. Logical volume size is 6.37TB.



I would like to move ALL data to sda1 OR sdb1, then remove the other two PVs. Based on the reading I've done, I could try some combination of resize2fs pvmove and lvreduce to possibly accomplish what I'm looking for.



My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?



edit: I've considered that the simplest solution would probably be to backup the entire filesystem to a larger disk, shrink it, then move it back to a reconfigured LV, but I don't currently have the spare disk space. :(










share|improve this question





























    0














    I have a logical volume, /dev/echohome/home01



    It has three physical volumes: /dev/sda1, /dev/sdb1, /dev/sdc1



    sda1 is 4TB w/ 0 extents available, sdb1 is 4TB w/ 476930 extents available, sdc1 is 1TB w/ 0 extents available



    Current ext4 filesystem is ~45% full @ 3.1TB. Logical volume size is 6.37TB.



    I would like to move ALL data to sda1 OR sdb1, then remove the other two PVs. Based on the reading I've done, I could try some combination of resize2fs pvmove and lvreduce to possibly accomplish what I'm looking for.



    My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?



    edit: I've considered that the simplest solution would probably be to backup the entire filesystem to a larger disk, shrink it, then move it back to a reconfigured LV, but I don't currently have the spare disk space. :(










    share|improve this question



























      0












      0








      0







      I have a logical volume, /dev/echohome/home01



      It has three physical volumes: /dev/sda1, /dev/sdb1, /dev/sdc1



      sda1 is 4TB w/ 0 extents available, sdb1 is 4TB w/ 476930 extents available, sdc1 is 1TB w/ 0 extents available



      Current ext4 filesystem is ~45% full @ 3.1TB. Logical volume size is 6.37TB.



      I would like to move ALL data to sda1 OR sdb1, then remove the other two PVs. Based on the reading I've done, I could try some combination of resize2fs pvmove and lvreduce to possibly accomplish what I'm looking for.



      My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?



      edit: I've considered that the simplest solution would probably be to backup the entire filesystem to a larger disk, shrink it, then move it back to a reconfigured LV, but I don't currently have the spare disk space. :(










      share|improve this question















      I have a logical volume, /dev/echohome/home01



      It has three physical volumes: /dev/sda1, /dev/sdb1, /dev/sdc1



      sda1 is 4TB w/ 0 extents available, sdb1 is 4TB w/ 476930 extents available, sdc1 is 1TB w/ 0 extents available



      Current ext4 filesystem is ~45% full @ 3.1TB. Logical volume size is 6.37TB.



      I would like to move ALL data to sda1 OR sdb1, then remove the other two PVs. Based on the reading I've done, I could try some combination of resize2fs pvmove and lvreduce to possibly accomplish what I'm looking for.



      My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?



      edit: I've considered that the simplest solution would probably be to backup the entire filesystem to a larger disk, shrink it, then move it back to a reconfigured LV, but I don't currently have the spare disk space. :(







      lvm






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 23 at 1:24









      Rui F Ribeiro

      38.8k1479128




      38.8k1479128










      asked May 3 at 20:52









      Jason Bock

      32




      32






















          1 Answer
          1






          active

          oldest

          votes


















          0















          My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?




          You don't need to know that. That's LVM's job. resize2fs works on the logical volume, which is allowed to span multiple disks. Once your filesystem is small enough to fit onto one disk, you can tell LVM to move it over, and remove the other disks.





          There are four steps to doing this.




          1. Reduce the size of the filesystem to less than 4TB. (resize2fs)


          2. Reduce the size of the logical volume to less than 4TB. (lvreduce)



            (This step can lose data if you truncate the filesystem too far, so read the manpage!)




          3. Move the logical volume away from each drive. (pvmove <source pv> <dest pv>)



            (You'll need to do this one disk at a time.)



          4. Remove the disk. (vgreduce then pvremove)







          share|improve this answer























          • Thanks, this really helps me to understand more about the abstraction layers of LVM. This solution worked.
            – Jason Bock
            May 6 at 17:41











          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%2f441659%2fmove-all-data-in-lv-to-first-pv-remove-others%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









          0















          My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?




          You don't need to know that. That's LVM's job. resize2fs works on the logical volume, which is allowed to span multiple disks. Once your filesystem is small enough to fit onto one disk, you can tell LVM to move it over, and remove the other disks.





          There are four steps to doing this.




          1. Reduce the size of the filesystem to less than 4TB. (resize2fs)


          2. Reduce the size of the logical volume to less than 4TB. (lvreduce)



            (This step can lose data if you truncate the filesystem too far, so read the manpage!)




          3. Move the logical volume away from each drive. (pvmove <source pv> <dest pv>)



            (You'll need to do this one disk at a time.)



          4. Remove the disk. (vgreduce then pvremove)







          share|improve this answer























          • Thanks, this really helps me to understand more about the abstraction layers of LVM. This solution worked.
            – Jason Bock
            May 6 at 17:41
















          0















          My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?




          You don't need to know that. That's LVM's job. resize2fs works on the logical volume, which is allowed to span multiple disks. Once your filesystem is small enough to fit onto one disk, you can tell LVM to move it over, and remove the other disks.





          There are four steps to doing this.




          1. Reduce the size of the filesystem to less than 4TB. (resize2fs)


          2. Reduce the size of the logical volume to less than 4TB. (lvreduce)



            (This step can lose data if you truncate the filesystem too far, so read the manpage!)




          3. Move the logical volume away from each drive. (pvmove <source pv> <dest pv>)



            (You'll need to do this one disk at a time.)



          4. Remove the disk. (vgreduce then pvremove)







          share|improve this answer























          • Thanks, this really helps me to understand more about the abstraction layers of LVM. This solution worked.
            – Jason Bock
            May 6 at 17:41














          0












          0








          0







          My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?




          You don't need to know that. That's LVM's job. resize2fs works on the logical volume, which is allowed to span multiple disks. Once your filesystem is small enough to fit onto one disk, you can tell LVM to move it over, and remove the other disks.





          There are four steps to doing this.




          1. Reduce the size of the filesystem to less than 4TB. (resize2fs)


          2. Reduce the size of the logical volume to less than 4TB. (lvreduce)



            (This step can lose data if you truncate the filesystem too far, so read the manpage!)




          3. Move the logical volume away from each drive. (pvmove <source pv> <dest pv>)



            (You'll need to do this one disk at a time.)



          4. Remove the disk. (vgreduce then pvremove)







          share|improve this answer















          My specific detail that doesn't seem to be addressed in other questions is the physical location of the data that I'm trying to preserve -- if I don't know which PV a file physically resides on, how can I confidently resize2fs and then ultimately pvremove?




          You don't need to know that. That's LVM's job. resize2fs works on the logical volume, which is allowed to span multiple disks. Once your filesystem is small enough to fit onto one disk, you can tell LVM to move it over, and remove the other disks.





          There are four steps to doing this.




          1. Reduce the size of the filesystem to less than 4TB. (resize2fs)


          2. Reduce the size of the logical volume to less than 4TB. (lvreduce)



            (This step can lose data if you truncate the filesystem too far, so read the manpage!)




          3. Move the logical volume away from each drive. (pvmove <source pv> <dest pv>)



            (You'll need to do this one disk at a time.)



          4. Remove the disk. (vgreduce then pvremove)








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 8 at 19:25









          Rui F Ribeiro

          38.8k1479128




          38.8k1479128










          answered May 3 at 22:11









          Nick ODell

          9792820




          9792820












          • Thanks, this really helps me to understand more about the abstraction layers of LVM. This solution worked.
            – Jason Bock
            May 6 at 17:41


















          • Thanks, this really helps me to understand more about the abstraction layers of LVM. This solution worked.
            – Jason Bock
            May 6 at 17:41
















          Thanks, this really helps me to understand more about the abstraction layers of LVM. This solution worked.
          – Jason Bock
          May 6 at 17:41




          Thanks, this really helps me to understand more about the abstraction layers of LVM. This solution worked.
          – Jason Bock
          May 6 at 17:41


















          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%2f441659%2fmove-all-data-in-lv-to-first-pv-remove-others%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