Date: 6/3/2019
Server virtualization with KVM
Linux System Administration

Exercise: Cloning VMs with virt-clone

  • Clone kvm1 to a new VM host, kvm3, by executing the command below:
    virt-clone --connect=qemu:///system -o kvm1 -n kvm3 -f /home/hostadm/KVM/kvm3.qcow2
  • Check if the new VM is in the list, start it, then login to its console:
    virsh list --all
    virsh start kvm3
    virsh console kvm3
  • Fix the host name:
    Login to the system as user hostadm, elevate privileges by running sudo -s, then follow the procedure below to change the host name from kvm1 to kvm3:
    Edit file /etc/hostname and replace kvm1 by kvm3.

  • Reset the machine ID by running the following commands on kvm3:
    rm -f /etc/machine-id
    rm /var/lib/dbus/machine-id
    dbus-uuidgen --ensure=/etc/machine-id
    dbus-uuidgen --ensure
  • Clear the DHCP leased IP settings:
    dhclient -r ens3
  • Execute command reboot on kvm3:
    Exit the VM console with ^] key combination.

    After reboot, the new VM should come up with the correct host name and the MAC address.

  • Take me to the Course Website