Disk Cloning with dd and ssh tunnel
Syntax: dd if=/dev/sda | gzip | ssh root@target ‘gzip -d | dd of=/dev/sda’
Example:
dd if=/dev/xenvg/ss_mail_root bs=32M |gzip |ssh root@192.168.168.4 ‘gzip -d | dd of=/dev/xenvg/yfmail_root bs=32M’
The authenticity of host ‘192.168.168.4 (192.168.168.4)’ can’t be established.
RSA key fingerprint is b0:57:db:cd:c7:d9:7f:5b:ba:df:9d:9a:b7:56:27:ea.
Are you sure you want to continue connecting (yes/no)? yes
root@192.168.168.4’s password:
640+0 records in
640+0 records out
21474836480 bytes (21 GB) copied, 680.57 seconds, 31.6 MB/s
1+551790 records in
1+551790 records out
21474836480 bytes (21 GB) copied, 677.947 seconds, 31.7 MB/s
/* Note with bs size increase, the less time will be taken */
[root@xen02 ~]# dd if=/dev/xenvg/ss_mail_root bs=128M |gzip |ssh root@192.168.168.4 ‘gzip -d | dd of=/dev/xenvg/yfmail_root bs=128M’
root@192.168.168.4’s password:
160+0 records in
160+0 records out
21474836480 bytes (21 GB) copied, 646.192 seconds, 33.2 MB/s
0+464299 records in
0+464299 records out
21474836480 bytes (21 GB) copied, 641.141 seconds, 33.5 MB/s
/* Cloning to other remote machine */
[root@x3 ~]# dd if=/dev/xenvg/win2003 bs=512M |gzip |ssh root@backup.asian-marine.com ‘gzip -d | dd of=/dev/glvg/win2003 bs=512M’
root@backup.asian-marine.com’s password:
20+0 records in
20+0 records out
10737418240 bytes (11 GB) copied, 742.541 seconds, 14.5 MB/s
0+221945 records in
0+221945 records out
10737418240 bytes (11 GB) copied, 741.845 seconds, 14.5 MB/s