How to copy a large LVM volume (14TB) from one server to another?

I have to copy a very large LVM volume from server A to server B. Below is the filesystem of server A and server B

Server A

[root@AVDVD-Filer ~]# df -h 
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_avdvdfiler-lv_root
                       16T   14T  1.5T  91% /
tmpfs                 3.0G     0  3.0G   0% /dev/shm
/dev/cciss/c0d0p1     194M   23M  162M  13% /boot
/dev/mapper/vg_avdvdfiler-test
                      2.3T  201M  2.1T   1% /test
/dev/sr0              3.3G  3.3G     0 100% /mnt

server B

[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-LogVol00
                       20G  2.5G   16G  14% /
tmpfs                 3.0G     0  3.0G   0% /dev/shm
/dev/cciss/c0d0p1     194M   23M  162M  13% /boot
/dev/mapper/VolGroup00-LogVol00
                       16T  133M   15T   1% /xiangao/lv1
/dev/mapper/VolGroup00-LogVol01
                      4.7T  190M  4.5T   1% /xiangao/lv2

I want to copy the LVM volume /dev/mapper/vg_avdvdfiler-lv_root on server A to LVM volume /dev/mapper/VolGroup00-LogVol00 on server B. Server A and server B are in the same IP segment. In the LVM volume on server A, there is all average 500M avi wmv mp4 etc.

I tried mounting /dev/mapper/vg_avdvdfiler-lv_root on server A to server B through NFS, then use cp to copy. It is clear I failed.

Because the LVM volume is too big, I do not have good idea why. I hope a good solution here.


Solution 1:

i think i would use rsync over ssh in this situation.

if the transfer dies half-way, using tar over ssh, you won't be able to resume the transfer, you will have to start from scratch.

Solution 2:

A tar pipe is probably best for this.

Solution 3:

This was the best solution for me:

dd if=/dev/myvolumegroup/mylogicalvolume bs=4096 | pv | ssh targetmachine dd of=/dev/myvolumegroup/mylogicalvolume bs=4096

You have to setup the lvm logical volume on the target machine first, with the same or more space.

Note, some people have suggested this with nc (netcat), however it won't work because netcat will close when it receives an EOF, of which there are many within a partition. Ssh doesn't have this problem.

I used bs=4096 instead of bs=512 because it was much faster. YMMV.

The reason pv is in there is that it shows you progress, which is pretty nice when sending large amounts of data so you get an idea of transfer rates and how long you expect to wait before it's finished.