Cloning a VM
- Stop vm1. Run the virt-clone command in the virt-install software package to clone vm10.
1virt-clone -o vm1 -n vm10 -f /home/kvm/images/10.img
In the command, -o indicates the original VM, -n indicates the new VM, and -f indicates that the newly created VM uses the file on the host machine as the image file.
- After the command is executed, vm10 is created. The CPU, memory, drive, and network resources allocated to vm10 are the same as those allocated to vm1. The CPU and network resources allocated to vm10 need to be configured separately.
- There is a possibility that the virt-clone command fails to clone VMs. See the root cause at https://bugs.launchpad.net/qemu/+bug/1824053, which has been rectified in QEMU 5.0.0.
- Check the status of the created VM.
1virsh list --all

- Change the host name of the VM.
The cloned VM has the same host name and IP address as vm1. You need to log in to vm10 and run the following command to change the host name:
1hostnamectl --static set-hostname vm10
- Change the VM IP address.
1vim /etc/sysconfig/network-scripts/ifcfg-ens3
Parent topic: Installing VMs