1 准备
关闭虚拟机
2 导出虚拟机配置文件
# virsh dumpxml centos6.8 > /etc/libvirt/qemu/centos6.xml
在同一台linux上,UUD和虚拟磁盘的路径可能需要修改
<uuid>0bdb3329-450d-9756-7254-bb12cf899dcb</uuid>
<source file='/data/kvm/centos6.img'/>
3 导出虚拟磁盘
3.1 查看虚拟机对应的虚拟磁盘
# virsh domblklist centos6.8
Target Source
------------------------------------------------
vda /data/kvm/CentOs6.8.img
3.2 导出
# rsync -avP /data/kvm/centos6.8.qcow2 /data/kvm/centos6.qcow2
4 定义虚拟机
# virsh define /etc/libvirt/qemu/centos6.xml
Domain centos6 defined from /etc/libvirt/qemu/centos6.xml
# virsh list --all
Id Name State
----------------------------------------------------
- centos6 shut off
5 启动虚拟机
# virsh start centos6 --console