Cloning an LVM2 thin pool with all the snapshots











up vote
1
down vote

favorite












Need to clone a 400gb pool onto another machine. Will this work?
First I collect the data about the existing pool:



[root@oktest-prod-db-2 ~]# lvdisplay --units B vg_oktestdb2/pool
--- Logical volume ---
LV Name pool
VG Name vg_oktestdb2
LV UUID tPfUzG-bHW2-jepz-1Sf6-BSmw-jKz4-Tf6djR
LV Write Access read/write
LV Creation host, time oktest-db-2, 2015-03-31 18:55:17 +0300
LV Pool transaction ID 134
LV Pool metadata pool_tmeta
LV Pool data pool_tdata
LV Pool chunk size 262144 B
LV Zero new blocks yes
LV Status available
# open 0
LV Size 474031849472 B
Allocated pool data 10.16%
Allocated metadata 7.66%
Current LE 113018
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:5


Then create a new pool with the same size:



[root@oktest-prod-db-1-new ~]# lvcreate -L 474031849472b -T vg_oktestdb1/pool --chunksize 256k
Logical volume "lvol0" created
Logical volume "pool" created


And lastly copy it over ssh:



[root@oktest-prod-db-2 ~]# dd bs=128k if=/dev/mapper/vg_oktestdb2-pool | ssh root@oktest-prod-db-1-new 'dd bs=128k of=/dev/mapper/vg_oktestdb1-pool'


Now I just sit and wait for several hours



Upd: it did work back then.










share|improve this question




























    up vote
    1
    down vote

    favorite












    Need to clone a 400gb pool onto another machine. Will this work?
    First I collect the data about the existing pool:



    [root@oktest-prod-db-2 ~]# lvdisplay --units B vg_oktestdb2/pool
    --- Logical volume ---
    LV Name pool
    VG Name vg_oktestdb2
    LV UUID tPfUzG-bHW2-jepz-1Sf6-BSmw-jKz4-Tf6djR
    LV Write Access read/write
    LV Creation host, time oktest-db-2, 2015-03-31 18:55:17 +0300
    LV Pool transaction ID 134
    LV Pool metadata pool_tmeta
    LV Pool data pool_tdata
    LV Pool chunk size 262144 B
    LV Zero new blocks yes
    LV Status available
    # open 0
    LV Size 474031849472 B
    Allocated pool data 10.16%
    Allocated metadata 7.66%
    Current LE 113018
    Segments 1
    Allocation inherit
    Read ahead sectors auto
    - currently set to 256
    Block device 253:5


    Then create a new pool with the same size:



    [root@oktest-prod-db-1-new ~]# lvcreate -L 474031849472b -T vg_oktestdb1/pool --chunksize 256k
    Logical volume "lvol0" created
    Logical volume "pool" created


    And lastly copy it over ssh:



    [root@oktest-prod-db-2 ~]# dd bs=128k if=/dev/mapper/vg_oktestdb2-pool | ssh root@oktest-prod-db-1-new 'dd bs=128k of=/dev/mapper/vg_oktestdb1-pool'


    Now I just sit and wait for several hours



    Upd: it did work back then.










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Need to clone a 400gb pool onto another machine. Will this work?
      First I collect the data about the existing pool:



      [root@oktest-prod-db-2 ~]# lvdisplay --units B vg_oktestdb2/pool
      --- Logical volume ---
      LV Name pool
      VG Name vg_oktestdb2
      LV UUID tPfUzG-bHW2-jepz-1Sf6-BSmw-jKz4-Tf6djR
      LV Write Access read/write
      LV Creation host, time oktest-db-2, 2015-03-31 18:55:17 +0300
      LV Pool transaction ID 134
      LV Pool metadata pool_tmeta
      LV Pool data pool_tdata
      LV Pool chunk size 262144 B
      LV Zero new blocks yes
      LV Status available
      # open 0
      LV Size 474031849472 B
      Allocated pool data 10.16%
      Allocated metadata 7.66%
      Current LE 113018
      Segments 1
      Allocation inherit
      Read ahead sectors auto
      - currently set to 256
      Block device 253:5


      Then create a new pool with the same size:



      [root@oktest-prod-db-1-new ~]# lvcreate -L 474031849472b -T vg_oktestdb1/pool --chunksize 256k
      Logical volume "lvol0" created
      Logical volume "pool" created


      And lastly copy it over ssh:



      [root@oktest-prod-db-2 ~]# dd bs=128k if=/dev/mapper/vg_oktestdb2-pool | ssh root@oktest-prod-db-1-new 'dd bs=128k of=/dev/mapper/vg_oktestdb1-pool'


      Now I just sit and wait for several hours



      Upd: it did work back then.










      share|improve this question















      Need to clone a 400gb pool onto another machine. Will this work?
      First I collect the data about the existing pool:



      [root@oktest-prod-db-2 ~]# lvdisplay --units B vg_oktestdb2/pool
      --- Logical volume ---
      LV Name pool
      VG Name vg_oktestdb2
      LV UUID tPfUzG-bHW2-jepz-1Sf6-BSmw-jKz4-Tf6djR
      LV Write Access read/write
      LV Creation host, time oktest-db-2, 2015-03-31 18:55:17 +0300
      LV Pool transaction ID 134
      LV Pool metadata pool_tmeta
      LV Pool data pool_tdata
      LV Pool chunk size 262144 B
      LV Zero new blocks yes
      LV Status available
      # open 0
      LV Size 474031849472 B
      Allocated pool data 10.16%
      Allocated metadata 7.66%
      Current LE 113018
      Segments 1
      Allocation inherit
      Read ahead sectors auto
      - currently set to 256
      Block device 253:5


      Then create a new pool with the same size:



      [root@oktest-prod-db-1-new ~]# lvcreate -L 474031849472b -T vg_oktestdb1/pool --chunksize 256k
      Logical volume "lvol0" created
      Logical volume "pool" created


      And lastly copy it over ssh:



      [root@oktest-prod-db-2 ~]# dd bs=128k if=/dev/mapper/vg_oktestdb2-pool | ssh root@oktest-prod-db-1-new 'dd bs=128k of=/dev/mapper/vg_oktestdb1-pool'


      Now I just sit and wait for several hours



      Upd: it did work back then.







      lvm snapshot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 11:58

























      asked Aug 27 '15 at 15:16









      basin

      260312




      260312






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          Not sure how it goes trough a pipe to a SSH session, but I'm used to do this with netcat



          first launch a listening netcat on the destination server :



          netcat -p 1237 -l | dd of=<destination lv path/name> obs=$((1024*1024)) ibs=8192


          Then on the source server



          dd ibs=$((1024*1024)) obs=8192 <source lv path/name>  | pv | netcat <ip of destination server> 1237


          you can skip the "pv" part of course and change the port "1237" to whatever will pass trough your firewalls.



          Also you can pipe it into gzip but from my experience this is not a big
          gain.






          share|improve this answer





















          • Was it a thin pool?
            – basin
            Aug 27 '15 at 17:05











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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: 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%2fsuperuser.com%2fquestions%2f963678%2fcloning-an-lvm2-thin-pool-with-all-the-snapshots%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








          up vote
          0
          down vote



          accepted










          Not sure how it goes trough a pipe to a SSH session, but I'm used to do this with netcat



          first launch a listening netcat on the destination server :



          netcat -p 1237 -l | dd of=<destination lv path/name> obs=$((1024*1024)) ibs=8192


          Then on the source server



          dd ibs=$((1024*1024)) obs=8192 <source lv path/name>  | pv | netcat <ip of destination server> 1237


          you can skip the "pv" part of course and change the port "1237" to whatever will pass trough your firewalls.



          Also you can pipe it into gzip but from my experience this is not a big
          gain.






          share|improve this answer





















          • Was it a thin pool?
            – basin
            Aug 27 '15 at 17:05















          up vote
          0
          down vote



          accepted










          Not sure how it goes trough a pipe to a SSH session, but I'm used to do this with netcat



          first launch a listening netcat on the destination server :



          netcat -p 1237 -l | dd of=<destination lv path/name> obs=$((1024*1024)) ibs=8192


          Then on the source server



          dd ibs=$((1024*1024)) obs=8192 <source lv path/name>  | pv | netcat <ip of destination server> 1237


          you can skip the "pv" part of course and change the port "1237" to whatever will pass trough your firewalls.



          Also you can pipe it into gzip but from my experience this is not a big
          gain.






          share|improve this answer





















          • Was it a thin pool?
            – basin
            Aug 27 '15 at 17:05













          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          Not sure how it goes trough a pipe to a SSH session, but I'm used to do this with netcat



          first launch a listening netcat on the destination server :



          netcat -p 1237 -l | dd of=<destination lv path/name> obs=$((1024*1024)) ibs=8192


          Then on the source server



          dd ibs=$((1024*1024)) obs=8192 <source lv path/name>  | pv | netcat <ip of destination server> 1237


          you can skip the "pv" part of course and change the port "1237" to whatever will pass trough your firewalls.



          Also you can pipe it into gzip but from my experience this is not a big
          gain.






          share|improve this answer












          Not sure how it goes trough a pipe to a SSH session, but I'm used to do this with netcat



          first launch a listening netcat on the destination server :



          netcat -p 1237 -l | dd of=<destination lv path/name> obs=$((1024*1024)) ibs=8192


          Then on the source server



          dd ibs=$((1024*1024)) obs=8192 <source lv path/name>  | pv | netcat <ip of destination server> 1237


          you can skip the "pv" part of course and change the port "1237" to whatever will pass trough your firewalls.



          Also you can pipe it into gzip but from my experience this is not a big
          gain.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 27 '15 at 16:05









          JFL

          27314




          27314












          • Was it a thin pool?
            – basin
            Aug 27 '15 at 17:05


















          • Was it a thin pool?
            – basin
            Aug 27 '15 at 17:05
















          Was it a thin pool?
          – basin
          Aug 27 '15 at 17:05




          Was it a thin pool?
          – basin
          Aug 27 '15 at 17:05


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f963678%2fcloning-an-lvm2-thin-pool-with-all-the-snapshots%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

          Plaza Victoria

          In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

          How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...