How to move a logical volume from one volume group to another with dd

root's picture

1. You create the target on the target volume group:

core:osx# lvcreate -L100G -n MacPool100Glv bkupvg
  Logical volume "MacPool100Glv" created

2. Have a visual of what you have to do. We have below the target in green and source in red:

core:osx# lvscan
  ACTIVE            '/dev/bkupvg/corelv' [250.00 GB] inherit
  ACTIVE            '/dev/bkupvg/MacPool350Glv' [350.00 GB] inherit
  [color=green]ACTIVE            '/dev/bkupvg/MacPool100Glv' [100.00 GB] inherit[/color]
  ACTIVE            '/dev/datavg/mylv' [2.10 GB] inherit
  ACTIVE            '/dev/datavg/weblv' [72.00 GB] inherit
  ACTIVE            '/dev/datavg/maillv' [1.00 GB] inherit
  ACTIVE            '/dev/datavg/ftplv' [2.00 GB] inherit
  ACTIVE            '/dev/datavg/maclv' [30.00 GB] inherit
  [color=red]ACTIVE            '/dev/datavg/MacPool100Glv' [100.00 GB] inherit[/color]
  ACTIVE            '/dev/rootvg/homelv' [152.00 MB] inherit
  ACTIVE            '/dev/rootvg/slashlv' [952.00 MB] inherit
  ACTIVE            '/dev/rootvg/tmplv' [3.00 GB] inherit
  ACTIVE            '/dev/rootvg/usrlv' [6.66 GB] inherit
  ACTIVE            '/dev/rootvg/varlv' [4.00 GB] inherit
  ACTIVE            '/dev/rootvg/srclv' [4.46 GB] inherit
  ACTIVE            '/dev/rootvg/muninlv' [1.00 GB] inherit
  ACTIVE            '/dev/rootvg/swap0' [7.45 GB] inherit
  ACTIVE            '/dev/rootvg/fileslv' [6.00 GB] inherit

3. Fire up dd command to copy block by block the contents of the source lv:

core:~# time dd if=/dev/datavg/MacPool100Glv of=/dev/bkupvg/MacPool100Glv bs=4M
25600+0 records in
25600+0 records out
107374182400 bytes (107 GB) copied, 1768.24 s, 60.7 MB/s

real	29m28.256s
user	0m0.120s
sys	3m41.034s

Now you have both lv with exactly the same data.

Note: In this example, the source lv was not mounted/used. If yours is mounted and in use, you can create a snapshot:

/sbin/lvcreate -L10G -s -n snap100glv /dev/datavg/MacPool100Glv
time dd if=/dev/datavg/snap100glv of=/dev/bkupvg/MacPool100Glv bs=4M

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content