how to clone a VM on LVM to another in KVM?
8,977
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.
Related videos on Youtube
Author by
shgnInc
Updated on September 18, 2022Comments
-
shgnInc almost 2 years
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 Thevirt-clone
just clone Vms with disk in files and cannot clone LVM disks. I think it is possible bydd
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 about 10 yearsWhat was wrong with my question for down vote it?
-
-
shgnInc about 10 yearsIf i do so, Is there any problem for network-UUID and VM-UUID? If so, how to solve it?
-
FooBee about 10 yearsNo, 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? Eithervirt-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.