需要先将原机关机
root@Server-A7:/etc/libvirt/qemu# virsh shutdown UPF_VM-0819
Domain UPF_VM-0819 is being shutdown
root@Server-A7:/etc/libvirt/qemu# virsh list --all
Id Name State
----------------------------------------------------
13 CP_VM-1 running
- UPF_VM-0819 shut off
开始克隆
# /root/UPF_VM-0819-1.qcow2 会根据原机在克隆过程中自动生成
root@Server-A7:/etc/libvirt/qemu# virt-clone -o UPF_VM-0819 -n UPF_VM-0819-1 --file /root/UPF_VM-0819-1.qcow2
WARNING Setting the graphics device port to autoport, in order to avoid conflicting.
Allocating 'UPF_VM-0819-1.qcow2' | 20 GB 00:01:09
Clone 'UPF_VM-0819-1' created successfully.
查看克隆后的虚拟机
# virsh list --all
Id Name State
----------------------------------------------------
13 CP_VM-1 running
- UPF_VM-0819 shut off
- UPF_VM-0819-1 shut off
启动克隆后的虚拟机
# virsh start UPF_VM-0819-1