LVM move / copy data between physical machines

Recently we needed to copy lvm volumes from one machine to another and due to the size of volumes we prefferd to avoid copying using dd dump file.

After doing some research that is what we come up with :

  • you have to create the same volume size on the target machine

lvcreate -L 100G -n destinationyou have to copy the data over

  • you have to copy data from source to target (this is run from the source machine)

sudo dd if=/dev/vgname/source bs=1M | ssh -c arcfour destination_host ‘dd bs=1M of=/dev/vgname/destination’

We realized later that lack of progress bar is a problem so we adjusted it by using bar command -s parameter should show the total capacity of the volume in transfer.

sudo dd if=/dev/vgname/source bs=1M | bar -bs 1m -s 100g| ssh -c arcfour destination_host ‘dd bs=1M of=/dev/vgname/destination’