kvm_guest主机克隆
1、kvm克隆需要将源主机处于暂停或关机状态,常用命令:virsh>list --all列出所有主机virsh>startdomain1开启domain1虚机virsh>shutdowndomain1关闭domain1虚机virsh>destroydomain1断电domain1虚机virsh>autostartdomain1自动启动domain1虚机virsh>undefine domain1删除domain1虚机virsh>define domain1.xml添加domain1虚机virsh>suspend domain1暂停domain1虚机virsh>resume domain1恢复暂停domain1虚机2、克隆方法:(1)、 Clone the guest called "demo" on the default connection, auto generating a new name and disk clone path. # virt-clone \
--original demo \
--auto-clone(2)、 Clone the guest called "demo" which has a single disk to copy # virt-clone \
--original demo \
--name newdemo \
--file /var/lib/xen/images/newdemo.img(3)、Clone a QEMU guest with multiple disks # virt-clone \
--connect qemu:///system \
--original demo \
--name newdemo \
--file /var/lib/xen/images/newdemo.img \
--file /var/lib/xen/images/newdata.img(4)、Clone a guest to a physical device which is at least as big as the original guests disks. If the destination device is bigger, the new guest can do a filesystem resize when it boots. # virt-clone \
--connect qemu:///system \
--name demo \
--file /dev/HostVG/DemoVM \
--mac 52:54:00:34:11:54(5)、个人常用的克隆方法:#virt-clone -o rhel5.4_32_2 -n rhel5.4_32_3 -f /dev/libvirt_lvm/rhel5.4-3-m 52:54:00:31:15:40
3、克隆完成后,需要修改 /etc/libvirt/qemu/下,新生成虚拟机的.xml文件。将vnc端口修改成未用的。 <graphics type='vnc' port='5910' autoport='no' listen='0.0.0.0'passwd='zhao'>
4、编辑虚机镜像文件 #virt-edit /dev/libvirt_lvm/rhel5.4-3 /etc/sysconfig/network-scripts/ifcfg-eth0 # Virtio Network Device
DEVICE=eth0
BOOTPROTO=static
HWADDR=52:54:00:56:71:FG (和-m 52:54:00:31:15:40 一致)
IPADDR=192.168.199.117
NETMASK=255.255.255.0
ONBOOT=yes5、遗留问题:启动机器后ifcfg-eth0变成ifcfg-eth0.bak,重命名后,重启网卡即可正常。解决方法:在被克隆主机添加以下命令#vim/etc/rc.localif [ -f /etc/sysconfig/network-scripts/ifcfg-eth0.bak ];then
mv /etc/sysconfig/network-scripts/ifcfg-eth0.bak /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
fi
男人与女人,终究也只是欲望的动物吧!真的可以因为爱而结合吗?对不起,我也不知道。。 走自己的路,让别人打车去吧。 不错不错,楼主您辛苦了。。。 找不到恐龙,就用蜥蜴顶 我是来刷分的,嘿嘿 你的丑和你的脸没有关系。。。。。。
页:
[1]