kvm克隆

Kvm克隆:

 

克隆前需要关闭kvm虚拟机

 

[root@super67 ~]# virt-clone -o ubuntu16 -n ubuntu16-1 -f /var/lib/libvirt/images/ubuntu16-1.img

Cloning unbuntu16.raw                                                                                                         |  107 B     00:00    

Clone 'ubuntu16-1' created successfully.

 

查看克隆出来的配置文件:

[root@super67 ~]# ll /etc/libvirt/qemu/

total 20

drwxr-xr-x 2 root root 4096 Sep  4 10:31 autostart

drwx------ 3 root root 4096 Sep  4 13:43 networks

-rw------- 1 root root 2297 Sep  4 13:58 ubuntu16-1.xml

-rw------- 1 root root 2290 Sep  4 13:13 ubuntu16.xml

-rw------- 1 root root 2574 Sep  4 10:32 www.linux1.cn.xml

 

 

对比和原来的区别:

[root@super67 ~]# cd !$

cd /etc/libvirt/qemu/

[root@super67 qemu]# diff ubuntu16.xml ubuntu16-1.xml

4c4

<   virsh edit ubuntu16

---

>   virsh edit ubuntu16-1

9,10c9,10

<   <name>ubuntu16</name>

<   <uuid>729109f3-6bcc-2f44-b1d3-4f9f6bface83</uuid>

---

>   <name>ubuntu16-1</name>

>   <uuid>2402c258-0631-1864-a958-f445a95a3f29</uuid>

31c31

<       <source file='/var/lib/libvirt/disk/unbuntu16.raw'/>

---

>       <source file='/var/lib/libvirt/images/ubuntu16-1.img'/>

48c48

<       <mac address='52:54:00:b0:48:17'/>

---

  • <mac address='52:54:00:1b:4d:62'/>

 

 

如果克隆出现的虚拟机需要连接网络:

需要进入克隆出来的kvm虚拟机的系统中:

删除/etc/udev/…70-net……文件

修改网卡ifcfg-eth0配置

重启kvm虚拟机。

posted @ 2018-01-21 21:21  xuanhui  阅读(188)  评论(0编辑  收藏  举报