Saturday 26 May 2012

rsync of block devices

How to clone virtual disks as logical volumes with resume?

Some clever folks are working on patches to "rsync" to allow the copying of block devices:  http://lists.samba.org/archive/rsync/2010-June/025164.html

Paul Whittaker fixed me up with just such a patched version of rsync so I can move my VM disks around my network more efficiently.  The only thing to note is /dev/mapper/<logical_volume> is a symbolic link and you must use /dev/<vg>/<lv> to access the real block device.  

The example below is me running an "rsync" check over a previously cloned volume that failed to cleanly complete when using my favourite "nc" (netcat) method.  A three minute verify is not bad for an 8GB virtual disk!
root@blackdouglas> rsync -vP --inplace --copy-devices jd:/dev/mapper/JD-vm_canobolissmith_ROOT /dev/mapper/BD1-vm_canobolissmith_ROOT
JD-vm_canobolissmith_ROOT
           0 100%    0.00kB/s    0:03:18 (xfer#1, to-check=0/1)

sent 741502 bytes  received 370826 bytes  3570.88 bytes/sec
total size is 0  speedup is 0.00
root@blackdouglas>

2 comments: