KVM clone existing VM with new ip and mac

2022-10-27

you need a existing VM and the status of the vm should be shutdown/offline.

1
virsh list

####info: the output from this command may not show the VM what you want to clone

cloning VM with virt-clone

1
2
3
4
5
6
	NEWVM=new-vm-unchanged-name
IMAGEPATH=/mnt/lvmvg01storageraid1
PATHTOIMAGE=$IMAGEPATH/${VMNAME}.qcow2
VMTEMPLATE=debian10-tmpl

virt-clone --original $VMTEMPLATE --name $NEWVM --file $PATHTOIMAGE
info: with command file you can check the type of the new create container file