KVM Clone Virtual Machine
Introduction to Virt-clone Effect
Virt-clone is primarily used to clone KVM VMs and is available through Options, General Option, Storage configuration, Networking configuration Different options to make some special definitions of the new virtual machine.
1 Viewing KVM virtual machines
[[email protected] ~]# Virsh List--allId Name ' state ' centos6u5_1 Centos6u5 Running
2 Turn off the selected virtual machine
[[Email protected] ~is ~]# virsh List--allId Name State Centos6u5_1 - centos6u5 shut off
This way. If you do not close the KVM virtual machine then the direct cloning will be an error, for example: Error Domain with devices to clone must is paused or shutoff.
3 Cloning a virtual machine
[Email protected] ~]# virt-clone--connect=qemu://system-o centos6u5-n centos6.5_clone-f/opt/qemu-img /centos6u5_clone.img'centos6u5_clone.img' | -XX: $' centos6.5_clone ' created successfully.
4 View all virtual machines list
[Email protected] ~]# Virsh List--allIDs Name State centos6u5_1 - Centos6.5_clone - centos6u5 shut off
5 Starting a new cloned KVM virtual machine Centos6.5_clone
[Email protected] qemu]# Virsh start Centos6.5_clone
Note: Virsh edit centos6.5_clone Change the domain name path
Note: There may be a conflict with the MAC address after cloning, delete the configuration of the eth0 in/etc/udev/rules.d/70-persistent-net.rules, then change the eth1 to eth0, and modify the Ifcfg-eth0 Mac, Confirm that the MAC address is the same in the two configuration files.
6 KVM Virtual Machine cloning complete
[[email protected] qemu]# Virsh List--allId Name ' state ' centos6u5_1 - centos6.5_clone - centos6u5 shut off
Some parameters of 7.virt-clone
Options (some basic options):--version: View version -h,--Help: View assistance information --connect=URI: Connect to hypervisor Libvirt Urigeneral option (General option):-o original_guest,--original=original_guest: Original virtual machine name -n new_name,--name= new_name: New virtual machine name --auto-clone: The clone name and storage path are automatically generated from the original virtual machine configuration. -u new_uuid,--uuid=new_uuid: Clone The new UUID of the virtual machine, the default value is a randomly generated uuidstorage configuration (storage config):-F New_diskfile ,--file=new_diskfile: Specify a new virtual machine disk file --force-copy=TARGET: Force replication Device -- Nonsparse: Do not use sparse files to copy disk images networking configuration: (Network configuration)-M New_mac,--mac=new_mac: Set a new MAC address, default is a random Mac
KVM Clone Virtual Machine