1

On a Debian wheezy i installed KVM for virtualization and install some VMs on it. I use separate LVM disks because of its performance for my VMs disk.

Now i need to clone one of them in new LVM disk. I searched too much for it and i found virt-clone, but unfortunately The virt-clone just clone Vms with disk in files and cannot clone LVM disks. I think it is possible by dd like so:

dd if=/dev/vg_kvm/lv_disk1 of=/dev/vg_kvm/lv_disk2

Is there any more optimize solution? How can i clone my VM which is installed on a LVM disk to a new LVM disk?

shgnInc
  • 1,804
  • 3
  • 22
  • 29

1 Answers1

6

You can use LVM volumes as targets for the copy without a problem

virt-clone -o source_system --name new_system --file /dev/vg_kvm/lv_disk2

should do the trick. It handles the source block device (instead of a file) as well.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • If i do so, Is there any problem for network-UUID and VM-UUID? If so, how to solve it? – shgnInc Apr 19 '14 at 12:03
  • 1
    No, there is not. Please read the `virt-clone` man page. Cite: `Elements which require uniqueness will be updated to avoid a clash between old and new guests.` What has this to do with whether you use a file or a LVM volume as a target anyway? Either `virt-clone` handles this correctly or it doesn't, but it wouldn't make a difference depending on the target device. Remember: A block device *is* a file, that's one of the core principles of Unix: Devices are files. – Sven Apr 19 '14 at 12:08