IT技术互动交流平台

XEN虚拟化实战系列(三)之XEN虚拟机复制

作者:koumm  发布日期:2013-08-29 08:57:24

1. 查看现有一个虚拟机的配置文件 

1)虚拟机配置文件的位置/etc/xen/test01     
2) 虚拟机配置文件

# cat /etc/xen/test01

24

 

2. 复制xen虚拟机磁盘文件 

# cp  /data/test01.img  /data/test02.img 

25

3. 复制与修改新虚拟机配置文件 

# cd /etc/xen/   
# cp test01 test02    
# vi test02    
# 修改说明:    
(1) name修改为新虚拟机名称    
(2) uuid把最后几个数据改变一下    
(3) disk改为实际路径。    
(4) vif修改网卡的MAC地址把最后几个数据改变一下 

26

 

4. 启动新的虚拟机并修改主机名,IP地址 

(1) 启动虚拟机

29

可以看到test02虚拟机已经启动。

(2) 控制台进入虚拟机

[root@node1 xen]# xm console test02

启动过程:   


rtc: IRQ 8 is not free. 
rtc: IRQ 8 is not free. 
i8042.c: No controller found. 
Red Hat nash version 5.1.19.6 starting 
Mounting proc filesystem 
Reading all physical volumes.  This may take a while... 
Found volume group "vg" using metadata type lvm2 
2 logical volume(s) in volume group "vg" now active 
Welcome to Oracle Linux Oracle Linux Server release 5.8
Press 'I' to enter interactive startup. 
Starting udev: [  OK  ] 
Loading default keymap (us): [  OK  ] 
Setting hostname test01:  [  OK  ] 
Setting up Logical Volume Management:   2 logical volume(s) in volume group "vg" now active 
[  OK  ] 
Checking filesystems 
Checking all file systems. 
[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/vg/root 
/dev/vg/root: clean, 120221/1277952 files, 774393/1277952 blocks 
[/sbin/fsck.ext3 (1) -- /boot] fsck.ext3 -a /dev/xvda1 
/boot: recovering journal 
/boot: clean, 41/26104 files, 28206/104388 blocks 
[  OK  ] 
Remounting root filesystem in read-write mode:  [  OK  ] 
Mounting local filesystems:  [  OK  ] 
Enabling local filesystem quotas:  [  OK  ] 
Enabling /etc/fstab swaps:  [  OK  ] 
INIT: Entering runlevel: 3
Entering non-interactive startup 
Applying Intel CPU microcode update: [FAILED] 
Starting background readahead: [  OK  ] 
Checking for hardware changes [  OK  ] 
[  OK  ] iSCSI daemon: [  OK  ] 
[  OK  ] 
Applying ip6tables firewall rules: ip6tables-restore v1.3.5: ip6tables-restore: unable to initializetable 'filter'
Error occurred at line: 3
Try `ip6tables-restore -h' or 'ip6tables-restore --help' for more information. 
[FAILED] 
Bringing up loopback interface:  [  OK  ] 
[  OK  ] 
Starting smartd: [  OK  ] 
Oracle Linux Server release 5.8
Kernel 2.6.18-308.el5xen on an x86_64 
test01 login:

30

 

(3) 修改虚拟机主机名

# vi /etc/hosts

# vi /etc/sysconfig/network

将test01修改为test02虚拟机名称

33

 

(4) 修改虚拟机IP地址

删除掉虚拟网卡配置文件

32

重新配置IP地址

# vi /etc/sysconfig/network-script/ifcfg-eth0 

 

31

注要:chkconfig sendmail off


Tag标签: XEN   虚拟化   虚拟机复制  
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规