Reset and Clone libvirt/KVM guest virtual machines

February 20, 2020 in memos.

Prepare the clone

Use the virt-sysprep command to reset a virtual machine. The virtual machine must be shut down before you use this command.

virt-sysprep --connect qemu:///system -d centos7-gold

Create the clone

Use the virt-clone command to create a clone of an existing virtual machine.

virt-clone  --original centos7-gold --name centos7-01 --auto-clone