寻觅生命中的那一片浅草......

文章带标签 XenServer

Xen虚拟机迁移到VMware

由于种种原因,我们之前使用了Xen,但使用起来不是很方便,例如有时物理机上的LVM并不会开机激活等,我们就想着集中迁移到VMware进行集中管理

1 环境说明

  1. Xen虚拟机为全虚拟机化,就是内核是没有修改的,此处主要影响硬件驱动,如果用的是半虚拟化,估计转换后,还要处理下initrd文件
  2. 虚拟机里的系统使用了LVM(特别坑)

2 export to ovf

失败

导出后,在导入VMware的时候,提示

encoding specified in XML declaration is incorrect

对于上述错误,有人在VMware论坛提出了解决方案:Xen -> VirtualBox -> VMware

1)Exported OVF and VHD from Citrix XenCenter

2)Created a new VM in Oracle VirtualBox using as virtual disk the VHD disk exported above. (this step was performed on my desktop pc on which I installed VirtualBox) 

3)Exported OVA from Oracle VirtualBox

4)Imported OVA as an Assembly in vSphere

满心欢喜,进行了16个小时的导出后,在导入的时候,并不行,提示硬件不兼容,放弃

参考:OVA文件导入VMware ESXi出错解决办法

3 P2V

就是用物理机转换为虚拟机的方法,可行

我们在转换的时候,转换工具可以识别到源机的磁盘结构(LVM), 但转换过去后,磁盘大小却不对,结构也是乱的,猜测是LVM导致,这里有提到一个将LVM降级的解决办法,但我们没有试,主要是考虑

  1. 数据安全,将LVM降级,怕有风险
  2. 文章发表时间为2013年,较旧
  3. VMware官方文档也表示转换工具支持LVM

文档地址:Solution for LVM based Linux servers using VMware Converter showing no volumes

下面讲可行的方法

步骤一

在「Optinons」这一步,点击「Data to copy」部分内容,或者点击「Edit」,然后选择「Advanced」,然后去到下图

步骤二

此处选择「Destination layout」,点击「VirtualDisk2」,然后点击「To basic」,就是在目标机器上不使用LVM,只使用普通磁盘分区,此处为关键

至于另外2个「Thin」,则可设置,也可以不设置,设置为Thin就是按需占用,按实际使用分配,而不是一下子就分配所有空间

步骤三

Xen服务器上的虚拟机转成VMware的虚拟机后,发现开机黑屏,最后摸索后发现是grub菜单项有问题导致,在开机的时候,直接修改grub菜单,然后把consolse=hvc0删掉,并在最后加入fastboot,就可以正常启动了

步骤四

由于转换的时候,没有识别到/data,我怀疑是因为它磁盘设备文件是/dev/xvdb导致,一般应该是/dev/xvdb1,所以,我们在开机后,添加新磁盘,然后在线同步一次data,最后,关闭所有服务,再同步要同步的数据,本例中含/var/data,最后换ip,开启服务,迁移完成

Boot_centos5.3_into_single_user_mode_on_XenServer

Today,I clone a VM in the XenCenter.I want to log into the new VM to configure ip and so on,But I had forgotten the original VM’s root password.So I can not log into the new one.

There are at least two kinds of way to reset the root password.One way is making the new VM boot from cdrom. I think it is too complicated to do that.The other way is editing grub’s boot option and making the VM boot into single user mode.It’s easy to do that.Follow this step:choose the new VM–>Shut down the new VM–>click the right mouse button–>Properties–>Startup Options–>OS Boot Parameters–>add single after utf8,the conten after edited is graphical utf8 single.Start the new VM again,it boot into single user mode,now we can change root password.

At last,shut down the VM,change OS Boot Parameters’s content to graphical utf8,start the new VM.

设置XenServer中的Linux vm从光驱启动

xenserver中的windows vm安装后可以通过xencenter设置从光驱启动,而linux vm则没有这样的选项,可以通过以下命令行解决:
xe vm-param-set uuid=546f896a-ebe6-8071-2c31-b9214dc1d1b5 HVM-boot-policy=BIOS\ order
xe vm-param-set uuid=546f896a-ebe6-8071-2c31-b9214dc1d1b5 HVM-boot-params:order=”dc”
uuid为vm的uuid,order中的d表明光驱,c表明启动硬盘。这样设置完后通过xencenter中的虚机属性也可以设置启动顺序了。

http://home.vmsky.com/space-32409-do-blog-id-3408.html

xenserver license

1.使用XenCenter工具,连接至Server,Tool–>License Manager–>选择要更新License的服务器,点击Activate….按钮.如果,此服务器可以直接连接到外网,将可以直接获取LIC文件安装,如果不能连接至外网,将会出现更新失败提示,并提示保存申请License文件.选择将申请文件保存.
2.访问:https://activate.vmd.citrix.com, upload申请文件.
3.填写相关信息,主要是MAIL地址,用来接收License 文件.提交.
4.打开邮箱下载License文件.
5.使用Winscp工具将License文件复制到XenServer的/etc/xensource/下,并重新命名为license.
6.重新启动XenServer.
7.License更新完成,可以正常使用.

关于Citrix公司的XenServer免费使用,个人理解,虽然为免费版本,但为了方便管理, 以及获取用户的相关信息,Citrix采用了Free License管理的模式,在到期后,用户只需要再次重复申请新的License文件并进行License安装即可.不会影响XenServer的正常使 用.但是,Citrix公司并未发表声明永久性提供免费使用,至少我没有找到.特别在正式的生产环境,还是建议大家购买正式的服务,以提供更高的性能以及安全的合法的保障.

转载自:http://hi.baidu.com/ts%B4%F3%D1%BC%C0%E6/blog/item/c58976fb885250809f514653%2Ehtml

XenServer_export_import命令

XenServer的vm export与import,可以通过XenCenter来做,手头上又没有Windows的服务器,如果保存到本地,export和import都很麻烦
在网上查了些资料,可以通过命令来将vm export到服务器上,但XenServer主机上,可用空间有限,又无法访问XenServer用于存储虚拟机的空间
于是决定使用nfs,将另外一台Linux服务器A的空间mount过来,用于保存export出来的vm文件

A上的操作192.168.1.2
yum -y install nfs*
yum -y install portmap
mkdir /data/nfs
chmod 777 /data/nfs
允许192.168.1.0/24网段的计算机挂载/home/nfs
echo ‘/data/nfs 192.168.1.*(rw,root_squash)’ >> /etc/exports
service portmap start
service nfs start

XenServer主机1上操作
mkdir /data/export
mount -t nfs 192.168.1.2:/data/nfs /data/export

开始导出
先把要导出的vm关掉,然后查看要导出vm的UUID
xe vm-list params=all

xe vm-export filename=/data/export/017-otrs.xva vm=09faa5ff-ceea-1234-e02e-97cae69878d5

XenServer主机2上操作
mkdir /data/export
mount -t nfs 192.168.1.2:/data/nfs /data/export

xe vm-import filename=/data/nfs/017-otrs.xva

等一下就可以了

我vm分了30G的空间,导出来的文件大概7G,应该也就是vm实际存储的文件大小吧

参考文章:http://tiri.li/schneller-xen-vm-import-auch-via-befehlszeile

2024年三月
« 5月    
 123
45678910
11121314151617
18192021222324
25262728293031