virt-clone of python-virtinst package is a great tool for creating cloned KVM virtual machine quickly.
Example: LVM based kvm
# virt-clone --original sl6-3 \
--name sl6-4 \
--file /dev/mapper/vg_kvm-kvm6 --prompt
In the above example /dev/mapper/vg_kvm-kvm6 LVM should be created before executing the virt-clone command.
Creating LVM
# lvcreate -L 4G -n kvm6 vg_kvm
Example file based storage
virt-clone \
--original ubuntu11 \
--name ubuntu-2 \
--file /var/lib/libvirt/images/ubuntu-2.img
--original sl6-3 = name of the existing KVM (make sure the original KVM is shutdown before creating clone out of it)
--name se6-4 = Name of the New KVM (cloned)
--file = In LVM case path to the existing storage, in file based storage the file will be automatically created by virt-clone
Troubleshooting Network issue
Upon booting the new cloned KVM VM I encounter with problem of not showing any network interface. After digging more it appears that udev on virtual machine changed the eth0 interface with eth1 due to change in MAC of the interface. Quick search on Google suggested the following solution to get back the 'eth0' interface on cloned vm.
1. Open /etc/sysconfig/network-scripts/ifcfg-eth0 and delete the following line and save the file
HWADDR=52:54:00:8f:62:01
2. Remove the following filen and reboot the virtual machine
/etc/udev/rules.d/*persistent-net*'
After reboot eth0 network interface will be available.
Комментариев нет:
Отправить комментарий