Move a logical volume from one volume group to another

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











up vote
15
down vote

favorite
6












Is it possible to move a logical volume from one volume group to another in whole?



It is possible to create a (more or less) matching lv and copy the data over, but is there any way to do this with LVM tools alone?



If not, is there a theoretical reason or a technical limitation (extent sizes)?







share|improve this question
























    up vote
    15
    down vote

    favorite
    6












    Is it possible to move a logical volume from one volume group to another in whole?



    It is possible to create a (more or less) matching lv and copy the data over, but is there any way to do this with LVM tools alone?



    If not, is there a theoretical reason or a technical limitation (extent sizes)?







    share|improve this question






















      up vote
      15
      down vote

      favorite
      6









      up vote
      15
      down vote

      favorite
      6






      6





      Is it possible to move a logical volume from one volume group to another in whole?



      It is possible to create a (more or less) matching lv and copy the data over, but is there any way to do this with LVM tools alone?



      If not, is there a theoretical reason or a technical limitation (extent sizes)?







      share|improve this question












      Is it possible to move a logical volume from one volume group to another in whole?



      It is possible to create a (more or less) matching lv and copy the data over, but is there any way to do this with LVM tools alone?



      If not, is there a theoretical reason or a technical limitation (extent sizes)?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 '12 at 7:15









      XTL

      5641315




      5641315




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          11
          down vote













          A volume group consists of whole physical volumes. A physical volume consists of many extents (an extent is typically 4MB); each extent may belong to a different logical volume. To transfer a logical volume to a different group, you cannot simply transfer extents, because that might split the physical volume between the source VG and the target VG.



          What you can do is transfer one or more PVs from the source VG to the target VG, with the vgsplit command. You can specify which PVs you want to transfer, or which LV (but only one at a time). If you specify an LV, it and the other LVs in the source VG must be on separate PVs. The destination VG will be created if no VG exists with the specified name.



          vgsplit -n source_group/volume_to_copy source_group target_group
          vgsplit source_group target_group /dev/sdy99 /dev/sdz99


          You may need to use pvmove first to arrange for the logical volumes you want to move to be on separate PVs.



          If you meant to retain the physical boundaries of the VG and move the data, there's no built-in tool, but you could make a mirror then remove the original.






          share|improve this answer






















          • Looks like the target_group can be a pre-existing one?
            – XTL
            Mar 25 '12 at 13:19

















          up vote
          3
          down vote













          As of the LVM in Debian stretch (9.0), namely 2.02.168-2, it's
          possible to do a copy of a logical volume across volume groups using a
          combination of vgmerge, lvconvert, and vgsplit. Since a move is
          a combination of a copy and a delete, this will also work for a move.



          Alternatively, you can use pvmove to just move the volume.



          A complete self-contained example session using loop devices and
          lvconvert follows.



          Summary: we create volume group vg1 with logical volume lv1, and vg2 with lv2, and make a copy of lv1 in vg2.



          Create files.



          truncate pv1 --size 100MB
          truncate pv2 --size 100MB


          Set up loop devices on files.



          losetup /dev/loop1 pv1
          losetup /dev/loop2 pv2


          Create physical volumes on loop devices (initialize loop devices for
          use by LVM).



          pvcreate /dev/loop1 /dev/loop2


          Create volume groups vg1 and vg2 on /dev/loop1 and /dev/loop2
          respectively.



          vgcreate vg1 /dev/loop1
          vgcreate vg2 /dev/loop2


          Create logical volumes lv1 and lv2 on vg1 and vg2 respectively.



          lvcreate -L 10M -n lv1 vg1
          lvcreate -L 10M -n lv2 vg2


          Create ext4 filesystems on lv1 and lv2.



          mkfs.ext4 -j /dev/vg1/lv1
          mkfs.ext4 -j /dev/vg2/lv2


          Optionally, write something on lv1 so you can later check the copy was
          correctly created. Make vg1 inactive.



          vgchange -a n vg1


          Run merge command in test mode. This merges vg1 into vg2.



          vgmerge -A y -l -t -v <<destination-vg>> <<source-vg>>
          vgmerge -A y -l -t -v vg2 vg1


          And then for real.



          vgmerge -A y -l -v vg2 vg1


          Then create a RAID 1 mirror pair from lv1 using lvconvert. The
          dest-pv argument tells lvconvert to make the mirror copy
          on /dev/loop2.



          lvconvert --type raid1 --mirrors 1 <<source-lv>> <<dest-pv>>
          lvconvert --type raid1 --mirrors 1 /dev/vg2/lv1 /dev/loop2


          Then split the mirror. The new LV is now lv1_copy.



          lvconvert --splitmirrors 1 --name <<source-lv-copy>> <<source-lv>>
          lvconvert --splitmirrors 1 --name lv1_copy /dev/vg2/lv1


          Make vg2/lv1 inactive.



          lvchange -a n /dev/vg2/lv1


          Then (testing mode)



          vgsplit -t -v <<source-vg>> <<destination-vg>> <<moved-to-pv>>
          vgsplit -t -v /dev/vg2 /dev/vg1 /dev/loop1


          For real



          vgsplit -v /dev/vg2 /dev/vg1 /dev/loop1


          Resulting output:



          lvs
          [...]
          lv1 vg1 -wi-a----- 12.00m
          lv1_copy vg2 -wi-a----- 12.00m
          lv2 vg2 -wi-a----- 12.00m


          NOTES:



          1) Most of these commands will need to be run as root.



          2) If there is any duplication of the names of the logical volumes in
          the two volume groups, vgmerge will refuse to proceed.



          3) On merge, logical volumes in vg1 must be inactive. And on split, logical volumes in vg2 belonging to vg1 must be inactive. In our case, this is lv1.






          share|improve this answer





























            up vote
            1
            down vote













            I will offer my own:



            umount /somedir/

            lvdisplay /dev/vgsource/lv0 --units b

            lvcreate -L 12345b -n lv0 vgtarget

            dd if=/dev/vgsource/lv0 of=/dev/vgtarget/lv0 bs=1024K conv=noerror,sync status=progress

            mount /dev/vgtarget/lv0 /somedir/


            if everything is good, remove the source



            lvremove vgsource/lv0





            share|improve this answer




















            • This is pretty much the opposite of the question. The point is to move the volume instead of copying the data to a new one.
              – XTL
              Jun 17 at 7:55










            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%2f34820%2fmove-a-logical-volume-from-one-volume-group-to-another%23new-answer', 'question_page');

            );

            Post as a guest






























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            11
            down vote













            A volume group consists of whole physical volumes. A physical volume consists of many extents (an extent is typically 4MB); each extent may belong to a different logical volume. To transfer a logical volume to a different group, you cannot simply transfer extents, because that might split the physical volume between the source VG and the target VG.



            What you can do is transfer one or more PVs from the source VG to the target VG, with the vgsplit command. You can specify which PVs you want to transfer, or which LV (but only one at a time). If you specify an LV, it and the other LVs in the source VG must be on separate PVs. The destination VG will be created if no VG exists with the specified name.



            vgsplit -n source_group/volume_to_copy source_group target_group
            vgsplit source_group target_group /dev/sdy99 /dev/sdz99


            You may need to use pvmove first to arrange for the logical volumes you want to move to be on separate PVs.



            If you meant to retain the physical boundaries of the VG and move the data, there's no built-in tool, but you could make a mirror then remove the original.






            share|improve this answer






















            • Looks like the target_group can be a pre-existing one?
              – XTL
              Mar 25 '12 at 13:19














            up vote
            11
            down vote













            A volume group consists of whole physical volumes. A physical volume consists of many extents (an extent is typically 4MB); each extent may belong to a different logical volume. To transfer a logical volume to a different group, you cannot simply transfer extents, because that might split the physical volume between the source VG and the target VG.



            What you can do is transfer one or more PVs from the source VG to the target VG, with the vgsplit command. You can specify which PVs you want to transfer, or which LV (but only one at a time). If you specify an LV, it and the other LVs in the source VG must be on separate PVs. The destination VG will be created if no VG exists with the specified name.



            vgsplit -n source_group/volume_to_copy source_group target_group
            vgsplit source_group target_group /dev/sdy99 /dev/sdz99


            You may need to use pvmove first to arrange for the logical volumes you want to move to be on separate PVs.



            If you meant to retain the physical boundaries of the VG and move the data, there's no built-in tool, but you could make a mirror then remove the original.






            share|improve this answer






















            • Looks like the target_group can be a pre-existing one?
              – XTL
              Mar 25 '12 at 13:19












            up vote
            11
            down vote










            up vote
            11
            down vote









            A volume group consists of whole physical volumes. A physical volume consists of many extents (an extent is typically 4MB); each extent may belong to a different logical volume. To transfer a logical volume to a different group, you cannot simply transfer extents, because that might split the physical volume between the source VG and the target VG.



            What you can do is transfer one or more PVs from the source VG to the target VG, with the vgsplit command. You can specify which PVs you want to transfer, or which LV (but only one at a time). If you specify an LV, it and the other LVs in the source VG must be on separate PVs. The destination VG will be created if no VG exists with the specified name.



            vgsplit -n source_group/volume_to_copy source_group target_group
            vgsplit source_group target_group /dev/sdy99 /dev/sdz99


            You may need to use pvmove first to arrange for the logical volumes you want to move to be on separate PVs.



            If you meant to retain the physical boundaries of the VG and move the data, there's no built-in tool, but you could make a mirror then remove the original.






            share|improve this answer














            A volume group consists of whole physical volumes. A physical volume consists of many extents (an extent is typically 4MB); each extent may belong to a different logical volume. To transfer a logical volume to a different group, you cannot simply transfer extents, because that might split the physical volume between the source VG and the target VG.



            What you can do is transfer one or more PVs from the source VG to the target VG, with the vgsplit command. You can specify which PVs you want to transfer, or which LV (but only one at a time). If you specify an LV, it and the other LVs in the source VG must be on separate PVs. The destination VG will be created if no VG exists with the specified name.



            vgsplit -n source_group/volume_to_copy source_group target_group
            vgsplit source_group target_group /dev/sdy99 /dev/sdz99


            You may need to use pvmove first to arrange for the logical volumes you want to move to be on separate PVs.



            If you meant to retain the physical boundaries of the VG and move the data, there's no built-in tool, but you could make a mirror then remove the original.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 13 '17 at 12:37









            Community♦

            1




            1










            answered Mar 23 '12 at 19:28









            Gilles

            504k1199971523




            504k1199971523











            • Looks like the target_group can be a pre-existing one?
              – XTL
              Mar 25 '12 at 13:19
















            • Looks like the target_group can be a pre-existing one?
              – XTL
              Mar 25 '12 at 13:19















            Looks like the target_group can be a pre-existing one?
            – XTL
            Mar 25 '12 at 13:19




            Looks like the target_group can be a pre-existing one?
            – XTL
            Mar 25 '12 at 13:19












            up vote
            3
            down vote













            As of the LVM in Debian stretch (9.0), namely 2.02.168-2, it's
            possible to do a copy of a logical volume across volume groups using a
            combination of vgmerge, lvconvert, and vgsplit. Since a move is
            a combination of a copy and a delete, this will also work for a move.



            Alternatively, you can use pvmove to just move the volume.



            A complete self-contained example session using loop devices and
            lvconvert follows.



            Summary: we create volume group vg1 with logical volume lv1, and vg2 with lv2, and make a copy of lv1 in vg2.



            Create files.



            truncate pv1 --size 100MB
            truncate pv2 --size 100MB


            Set up loop devices on files.



            losetup /dev/loop1 pv1
            losetup /dev/loop2 pv2


            Create physical volumes on loop devices (initialize loop devices for
            use by LVM).



            pvcreate /dev/loop1 /dev/loop2


            Create volume groups vg1 and vg2 on /dev/loop1 and /dev/loop2
            respectively.



            vgcreate vg1 /dev/loop1
            vgcreate vg2 /dev/loop2


            Create logical volumes lv1 and lv2 on vg1 and vg2 respectively.



            lvcreate -L 10M -n lv1 vg1
            lvcreate -L 10M -n lv2 vg2


            Create ext4 filesystems on lv1 and lv2.



            mkfs.ext4 -j /dev/vg1/lv1
            mkfs.ext4 -j /dev/vg2/lv2


            Optionally, write something on lv1 so you can later check the copy was
            correctly created. Make vg1 inactive.



            vgchange -a n vg1


            Run merge command in test mode. This merges vg1 into vg2.



            vgmerge -A y -l -t -v <<destination-vg>> <<source-vg>>
            vgmerge -A y -l -t -v vg2 vg1


            And then for real.



            vgmerge -A y -l -v vg2 vg1


            Then create a RAID 1 mirror pair from lv1 using lvconvert. The
            dest-pv argument tells lvconvert to make the mirror copy
            on /dev/loop2.



            lvconvert --type raid1 --mirrors 1 <<source-lv>> <<dest-pv>>
            lvconvert --type raid1 --mirrors 1 /dev/vg2/lv1 /dev/loop2


            Then split the mirror. The new LV is now lv1_copy.



            lvconvert --splitmirrors 1 --name <<source-lv-copy>> <<source-lv>>
            lvconvert --splitmirrors 1 --name lv1_copy /dev/vg2/lv1


            Make vg2/lv1 inactive.



            lvchange -a n /dev/vg2/lv1


            Then (testing mode)



            vgsplit -t -v <<source-vg>> <<destination-vg>> <<moved-to-pv>>
            vgsplit -t -v /dev/vg2 /dev/vg1 /dev/loop1


            For real



            vgsplit -v /dev/vg2 /dev/vg1 /dev/loop1


            Resulting output:



            lvs
            [...]
            lv1 vg1 -wi-a----- 12.00m
            lv1_copy vg2 -wi-a----- 12.00m
            lv2 vg2 -wi-a----- 12.00m


            NOTES:



            1) Most of these commands will need to be run as root.



            2) If there is any duplication of the names of the logical volumes in
            the two volume groups, vgmerge will refuse to proceed.



            3) On merge, logical volumes in vg1 must be inactive. And on split, logical volumes in vg2 belonging to vg1 must be inactive. In our case, this is lv1.






            share|improve this answer


























              up vote
              3
              down vote













              As of the LVM in Debian stretch (9.0), namely 2.02.168-2, it's
              possible to do a copy of a logical volume across volume groups using a
              combination of vgmerge, lvconvert, and vgsplit. Since a move is
              a combination of a copy and a delete, this will also work for a move.



              Alternatively, you can use pvmove to just move the volume.



              A complete self-contained example session using loop devices and
              lvconvert follows.



              Summary: we create volume group vg1 with logical volume lv1, and vg2 with lv2, and make a copy of lv1 in vg2.



              Create files.



              truncate pv1 --size 100MB
              truncate pv2 --size 100MB


              Set up loop devices on files.



              losetup /dev/loop1 pv1
              losetup /dev/loop2 pv2


              Create physical volumes on loop devices (initialize loop devices for
              use by LVM).



              pvcreate /dev/loop1 /dev/loop2


              Create volume groups vg1 and vg2 on /dev/loop1 and /dev/loop2
              respectively.



              vgcreate vg1 /dev/loop1
              vgcreate vg2 /dev/loop2


              Create logical volumes lv1 and lv2 on vg1 and vg2 respectively.



              lvcreate -L 10M -n lv1 vg1
              lvcreate -L 10M -n lv2 vg2


              Create ext4 filesystems on lv1 and lv2.



              mkfs.ext4 -j /dev/vg1/lv1
              mkfs.ext4 -j /dev/vg2/lv2


              Optionally, write something on lv1 so you can later check the copy was
              correctly created. Make vg1 inactive.



              vgchange -a n vg1


              Run merge command in test mode. This merges vg1 into vg2.



              vgmerge -A y -l -t -v <<destination-vg>> <<source-vg>>
              vgmerge -A y -l -t -v vg2 vg1


              And then for real.



              vgmerge -A y -l -v vg2 vg1


              Then create a RAID 1 mirror pair from lv1 using lvconvert. The
              dest-pv argument tells lvconvert to make the mirror copy
              on /dev/loop2.



              lvconvert --type raid1 --mirrors 1 <<source-lv>> <<dest-pv>>
              lvconvert --type raid1 --mirrors 1 /dev/vg2/lv1 /dev/loop2


              Then split the mirror. The new LV is now lv1_copy.



              lvconvert --splitmirrors 1 --name <<source-lv-copy>> <<source-lv>>
              lvconvert --splitmirrors 1 --name lv1_copy /dev/vg2/lv1


              Make vg2/lv1 inactive.



              lvchange -a n /dev/vg2/lv1


              Then (testing mode)



              vgsplit -t -v <<source-vg>> <<destination-vg>> <<moved-to-pv>>
              vgsplit -t -v /dev/vg2 /dev/vg1 /dev/loop1


              For real



              vgsplit -v /dev/vg2 /dev/vg1 /dev/loop1


              Resulting output:



              lvs
              [...]
              lv1 vg1 -wi-a----- 12.00m
              lv1_copy vg2 -wi-a----- 12.00m
              lv2 vg2 -wi-a----- 12.00m


              NOTES:



              1) Most of these commands will need to be run as root.



              2) If there is any duplication of the names of the logical volumes in
              the two volume groups, vgmerge will refuse to proceed.



              3) On merge, logical volumes in vg1 must be inactive. And on split, logical volumes in vg2 belonging to vg1 must be inactive. In our case, this is lv1.






              share|improve this answer
























                up vote
                3
                down vote










                up vote
                3
                down vote









                As of the LVM in Debian stretch (9.0), namely 2.02.168-2, it's
                possible to do a copy of a logical volume across volume groups using a
                combination of vgmerge, lvconvert, and vgsplit. Since a move is
                a combination of a copy and a delete, this will also work for a move.



                Alternatively, you can use pvmove to just move the volume.



                A complete self-contained example session using loop devices and
                lvconvert follows.



                Summary: we create volume group vg1 with logical volume lv1, and vg2 with lv2, and make a copy of lv1 in vg2.



                Create files.



                truncate pv1 --size 100MB
                truncate pv2 --size 100MB


                Set up loop devices on files.



                losetup /dev/loop1 pv1
                losetup /dev/loop2 pv2


                Create physical volumes on loop devices (initialize loop devices for
                use by LVM).



                pvcreate /dev/loop1 /dev/loop2


                Create volume groups vg1 and vg2 on /dev/loop1 and /dev/loop2
                respectively.



                vgcreate vg1 /dev/loop1
                vgcreate vg2 /dev/loop2


                Create logical volumes lv1 and lv2 on vg1 and vg2 respectively.



                lvcreate -L 10M -n lv1 vg1
                lvcreate -L 10M -n lv2 vg2


                Create ext4 filesystems on lv1 and lv2.



                mkfs.ext4 -j /dev/vg1/lv1
                mkfs.ext4 -j /dev/vg2/lv2


                Optionally, write something on lv1 so you can later check the copy was
                correctly created. Make vg1 inactive.



                vgchange -a n vg1


                Run merge command in test mode. This merges vg1 into vg2.



                vgmerge -A y -l -t -v <<destination-vg>> <<source-vg>>
                vgmerge -A y -l -t -v vg2 vg1


                And then for real.



                vgmerge -A y -l -v vg2 vg1


                Then create a RAID 1 mirror pair from lv1 using lvconvert. The
                dest-pv argument tells lvconvert to make the mirror copy
                on /dev/loop2.



                lvconvert --type raid1 --mirrors 1 <<source-lv>> <<dest-pv>>
                lvconvert --type raid1 --mirrors 1 /dev/vg2/lv1 /dev/loop2


                Then split the mirror. The new LV is now lv1_copy.



                lvconvert --splitmirrors 1 --name <<source-lv-copy>> <<source-lv>>
                lvconvert --splitmirrors 1 --name lv1_copy /dev/vg2/lv1


                Make vg2/lv1 inactive.



                lvchange -a n /dev/vg2/lv1


                Then (testing mode)



                vgsplit -t -v <<source-vg>> <<destination-vg>> <<moved-to-pv>>
                vgsplit -t -v /dev/vg2 /dev/vg1 /dev/loop1


                For real



                vgsplit -v /dev/vg2 /dev/vg1 /dev/loop1


                Resulting output:



                lvs
                [...]
                lv1 vg1 -wi-a----- 12.00m
                lv1_copy vg2 -wi-a----- 12.00m
                lv2 vg2 -wi-a----- 12.00m


                NOTES:



                1) Most of these commands will need to be run as root.



                2) If there is any duplication of the names of the logical volumes in
                the two volume groups, vgmerge will refuse to proceed.



                3) On merge, logical volumes in vg1 must be inactive. And on split, logical volumes in vg2 belonging to vg1 must be inactive. In our case, this is lv1.






                share|improve this answer














                As of the LVM in Debian stretch (9.0), namely 2.02.168-2, it's
                possible to do a copy of a logical volume across volume groups using a
                combination of vgmerge, lvconvert, and vgsplit. Since a move is
                a combination of a copy and a delete, this will also work for a move.



                Alternatively, you can use pvmove to just move the volume.



                A complete self-contained example session using loop devices and
                lvconvert follows.



                Summary: we create volume group vg1 with logical volume lv1, and vg2 with lv2, and make a copy of lv1 in vg2.



                Create files.



                truncate pv1 --size 100MB
                truncate pv2 --size 100MB


                Set up loop devices on files.



                losetup /dev/loop1 pv1
                losetup /dev/loop2 pv2


                Create physical volumes on loop devices (initialize loop devices for
                use by LVM).



                pvcreate /dev/loop1 /dev/loop2


                Create volume groups vg1 and vg2 on /dev/loop1 and /dev/loop2
                respectively.



                vgcreate vg1 /dev/loop1
                vgcreate vg2 /dev/loop2


                Create logical volumes lv1 and lv2 on vg1 and vg2 respectively.



                lvcreate -L 10M -n lv1 vg1
                lvcreate -L 10M -n lv2 vg2


                Create ext4 filesystems on lv1 and lv2.



                mkfs.ext4 -j /dev/vg1/lv1
                mkfs.ext4 -j /dev/vg2/lv2


                Optionally, write something on lv1 so you can later check the copy was
                correctly created. Make vg1 inactive.



                vgchange -a n vg1


                Run merge command in test mode. This merges vg1 into vg2.



                vgmerge -A y -l -t -v <<destination-vg>> <<source-vg>>
                vgmerge -A y -l -t -v vg2 vg1


                And then for real.



                vgmerge -A y -l -v vg2 vg1


                Then create a RAID 1 mirror pair from lv1 using lvconvert. The
                dest-pv argument tells lvconvert to make the mirror copy
                on /dev/loop2.



                lvconvert --type raid1 --mirrors 1 <<source-lv>> <<dest-pv>>
                lvconvert --type raid1 --mirrors 1 /dev/vg2/lv1 /dev/loop2


                Then split the mirror. The new LV is now lv1_copy.



                lvconvert --splitmirrors 1 --name <<source-lv-copy>> <<source-lv>>
                lvconvert --splitmirrors 1 --name lv1_copy /dev/vg2/lv1


                Make vg2/lv1 inactive.



                lvchange -a n /dev/vg2/lv1


                Then (testing mode)



                vgsplit -t -v <<source-vg>> <<destination-vg>> <<moved-to-pv>>
                vgsplit -t -v /dev/vg2 /dev/vg1 /dev/loop1


                For real



                vgsplit -v /dev/vg2 /dev/vg1 /dev/loop1


                Resulting output:



                lvs
                [...]
                lv1 vg1 -wi-a----- 12.00m
                lv1_copy vg2 -wi-a----- 12.00m
                lv2 vg2 -wi-a----- 12.00m


                NOTES:



                1) Most of these commands will need to be run as root.



                2) If there is any duplication of the names of the logical volumes in
                the two volume groups, vgmerge will refuse to proceed.



                3) On merge, logical volumes in vg1 must be inactive. And on split, logical volumes in vg2 belonging to vg1 must be inactive. In our case, this is lv1.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Sep 19 '17 at 13:20

























                answered Jul 1 '17 at 19:14









                Faheem Mitha

                22.1k1676131




                22.1k1676131




















                    up vote
                    1
                    down vote













                    I will offer my own:



                    umount /somedir/

                    lvdisplay /dev/vgsource/lv0 --units b

                    lvcreate -L 12345b -n lv0 vgtarget

                    dd if=/dev/vgsource/lv0 of=/dev/vgtarget/lv0 bs=1024K conv=noerror,sync status=progress

                    mount /dev/vgtarget/lv0 /somedir/


                    if everything is good, remove the source



                    lvremove vgsource/lv0





                    share|improve this answer




















                    • This is pretty much the opposite of the question. The point is to move the volume instead of copying the data to a new one.
                      – XTL
                      Jun 17 at 7:55














                    up vote
                    1
                    down vote













                    I will offer my own:



                    umount /somedir/

                    lvdisplay /dev/vgsource/lv0 --units b

                    lvcreate -L 12345b -n lv0 vgtarget

                    dd if=/dev/vgsource/lv0 of=/dev/vgtarget/lv0 bs=1024K conv=noerror,sync status=progress

                    mount /dev/vgtarget/lv0 /somedir/


                    if everything is good, remove the source



                    lvremove vgsource/lv0





                    share|improve this answer




















                    • This is pretty much the opposite of the question. The point is to move the volume instead of copying the data to a new one.
                      – XTL
                      Jun 17 at 7:55












                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    I will offer my own:



                    umount /somedir/

                    lvdisplay /dev/vgsource/lv0 --units b

                    lvcreate -L 12345b -n lv0 vgtarget

                    dd if=/dev/vgsource/lv0 of=/dev/vgtarget/lv0 bs=1024K conv=noerror,sync status=progress

                    mount /dev/vgtarget/lv0 /somedir/


                    if everything is good, remove the source



                    lvremove vgsource/lv0





                    share|improve this answer












                    I will offer my own:



                    umount /somedir/

                    lvdisplay /dev/vgsource/lv0 --units b

                    lvcreate -L 12345b -n lv0 vgtarget

                    dd if=/dev/vgsource/lv0 of=/dev/vgtarget/lv0 bs=1024K conv=noerror,sync status=progress

                    mount /dev/vgtarget/lv0 /somedir/


                    if everything is good, remove the source



                    lvremove vgsource/lv0






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 15 at 2:20









                    conan

                    111




                    111











                    • This is pretty much the opposite of the question. The point is to move the volume instead of copying the data to a new one.
                      – XTL
                      Jun 17 at 7:55
















                    • This is pretty much the opposite of the question. The point is to move the volume instead of copying the data to a new one.
                      – XTL
                      Jun 17 at 7:55















                    This is pretty much the opposite of the question. The point is to move the volume instead of copying the data to a new one.
                    – XTL
                    Jun 17 at 7:55




                    This is pretty much the opposite of the question. The point is to move the volume instead of copying the data to a new one.
                    – XTL
                    Jun 17 at 7:55












                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f34820%2fmove-a-logical-volume-from-one-volume-group-to-another%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