[CentOS-virt] Transfer of LVM based guests

Tue Nov 29 20:51:45 UTC 2011
James B. Byrne <byrnejb at harte-lyne.ca>

I am investigating the procedure to follow when moving a
KVM guest instance from one host to another where the
guest uses LVM as its storage.  As a preliminary cut I
have cobbled the following together from various sources
located through Google searches:

1.  Log in to vmhost_old

2.  Shutdown guest

3.  Create an LVM snapshot of the guest volume
3.a.   lvcreate -s -L 300m -n LVM_guest_snapshot guest_lv

4.  Convert snapshot to a file image
4.a    dd if=/dev/vhost/LVM_guest_snapshot
          of=/tmp/fs/LVM_guest_snapshot.img bs=4096

5.  Remove the original snapshot
5.a    lvremove /dev/vhost/LVM_guest_snapshot

6.  Move the snapshot image file to the new KVM host. Note
that for large vm guest images tape transport is probably
better than network transfers.

7.  Log in to vhost_new

8.  Create a new lv on the new vhost
8.a    lvcreate -n guest_name_lv -L 60G vhost_new_vg

9.  Copy transferred image to new LV
9.a    dd if=tmp/LVM_guest_snapshot.img
       of=/dev/vhost_new/guest_name_lv 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?

Is there anything obviously wrong or omitted from this?

***          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