[CentOS-virt] Transfer of LVM based guests

James B. Byrne byrnejb at harte-lyne.ca
Wed Nov 30 11:23:11 EST 2011

On Tue, November 29, 2011 17:11:01, Ed Heron Ed at
Heron-ent.com wrote:

> If you are moving the virtual disk, you can't run
> the virtual machine while you are moving it.
> Therefore, taking a snapshot (and removing it later)
> is superfluous.

Point taken.

> I use md5sum to give myself some extra re-assurance
> that a copy that big is accurate.

Good idea.

> Are the virtualization servers at the same location?

At the moment. It is planned that there will be two vhosts
at each of two different locations, one backing up the

>  How often do you move virtual machines?

I have not moved any as of yet.  I am investigating how to
do this as part of setting up our first virtual server
host.  I am discovering what is possible and the
techniques used.  Moving vm guests is not being considered
for load balancing but is under consideration for
providing warm spares for use in a DR situation.

> If your virtualization servers are in the same
> location, you might want to look into setting up a
> LAN for transferring virtual machine images.  It
> would only take an extra network card in each
> virtualization server and a Gb Ethernet switch
> (or better).

Our vhosts all (will) have two nics, one for public IPs
and one for private IPs.  The private IPs are used for
vhost management.  The experimental vhost is so equipped.

> If you are interested in virtual disk replication,
> you might want to look at DRBD.  It adds an extra layer
> to your storage, but allows for hot replication of
> disk space which would allow you to start a virtual
> machine on any virtualization server.

This is a useful suggestion. However, I find that the
availability of a DRDB package on CentOS-6 is presently an
issue.  And, our vm project has already expanded into
multiple areas with commensurate delays.  I think that I
will leave DRDB for a later time.

So, what I now have for a proposed procedure is:

1.  Log in to vmhost_old

2.  Shutdown guest

3.  Convert guest lvs to file images for each lv
3.a    dd if=/dev/vhost/lv_vhost_guest
          of=/tmp/fs/lv_vhost_guest.img bs=4096

4.  Create MD5 hash for each image file
4.a    md5sum /tmp/fs/lv_vhost_guest.img > \

5.  Move the guest image file(s)  and the checksum file to
the new vhost; preserving both the directory structure and
file names or subsequently modifying the file names in the
md5 checksum file. Note that for large vm guest images
tape transport is probably better than network transfers.

6.  Log in to vhost_new

7.  Verify md5 checksum(s) on transferred file(s).
7.a    md5sum -c /tmp/fs/lv_vhost_guest.md5

8.  Create a new lv(s) on the new vhost. Ensure sufficient
8.a    lvcreate -n lv_guest_name -L 60G vhost_new_vg

9.  Copy transferred image to new LV
9.a    dd if=/tmp/fs/lv_vhost_guest.img
       of=/dev/vhost_new/lv_guest_name bs=4096

10.  Copy guest xml file from vhost_old via sftp
10.a.   get /etc/libvirt/qemu/guest_name.xml \

11. Start new guest?


***          E-Mail is NOT a SECURE channel          ***
James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3

More information about the CentOS-virt mailing list