免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4647 | 回复: 4
打印 上一主题 下一主题

[VMware] 将VMware转移到xen环境步骤 (转载) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-12-14 21:45 |只看该作者 |倒序浏览
本帖最后由 yongruru 于 2010-12-14 21:51 编辑

由于公司资源紧缺,开发的人员很多都是在自己的虚拟机里开发测试,为了将这些vmware的虚拟环境迁移到xen的虚机里,首先的先转换下格式。
1、
vmware-vdiskmanager -r maildata.vmdk -t 0 maildata-flattened.vmdk

[root@pdc-e2160 CentOS5]# vmware-vdiskmanager -r maildata.vmdk -t 0 maildata-flattened.vmdk
Creating disk 'maildata-flattened.vmdk'
  Convert: 100% done.
Virtual disk conversion successful.


2、
qemu-img convert maildata-flattened.vmdk maildata.img

[root@c2q-q9400 CentOS5]# qemu-img convert maildata-flattened.vmdk maildata.img


   文章参考:
I'm sure there are more incarnations of this. It's rather hairy if you've not dealt with it before.
How do you find the right one? Look inside your ".vmx" file for a line beginning with:
scsi0:0.fileName = windows2003.vmdk
oride0:0.fileName = windows2003.vmdk

That's all there is to it. Now, lets assume the name of our disk is "windows2003.vmdk".
$ vmware-vdiskmanager -r windows2003.vmdk -t 0 windows2003-flattened.vmdk

This will create a "single growable virtual disk" that is flattened into a single file.
The next step is to turn this flattend.vmdk file into a disk image with qemu-img from the QEMU project.
$ qemu-img convert windows-2003-flattened.vmdk windows2003.img

When this completes, you will now have a windows2003.img file that might boot for you.
The unfortunate reality of running a Windows OS is that it makes a number of assumptions at install time as to your PC hardware. If you transplant the image, you may need to change the Hardware Abstraction Layer (HAL).Windows 2003, for example has 6 HALs:
HALMACPI.DLL - ACPI Multi processor PCHALAACPI.DLL - ACPI Uniprocessor PCHALACPI.DLL - Advanced Configuration and PowerInterface (ACPI)HALMPS.DLL - MPS Multiprocessor PCHALAPIC.DLL - MPS Uniprocessor PCHAL.DLL - Standard PC

Only one is selected and installed as \WINDOWS\SYSTEM32\HAL.DLL at install time.
It is possible to modify your C:\boot.ini to specify a different "/HAL=HAL.DLL", if you copy in the other DLLs so they can be referenced. In this way, it is possible to do some trial and error to see which of the above HALs work with which domU HVM configuration.

When you create your Xen configuration file, you have the opportunity to set four flags that critically interact with the above HALs, namely:# enable/disable HVM guest PAE, default=0 (disabled)pae=0# enable/disable HVM guest ACPI, default=0 (disabled)acpi=0# enable/disable HVM guest APIC, default=0 (disabled)apic=0# The number of CPUs to assign to this domUvcpus=1

The above configuration would be most at home with the "Standard PC" HAL.DLL.
For the MPS HALs, one would assume you would enable APIC.
For the ACPI HALs, one would assume you would enable ACPI.
Good luck figuring out which Xen configuration matches which HAL. At the moment, the only success I've really had with Xen 3.0.3's HVM is to use the "Standard PC" HAL.DLL.

When VMWare was used to build the Windows image, it detected ACPI and used an ACPI HAL. To revert this to the "Standard PC" HAL.DLL, I had to mount the image and replace this file:# mount -o loop,offset=$((63*512)),rw windows2003.img /mnt# find /mnt -name 'hal*.dll' -print/mnt/WINDOWS/ServicePackFiles/i386/halaacpi.dll/mnt/WINDOWS/ServicePackFiles/i386/hal.dll/mnt/WINDOWS/ServicePackFiles/i386/halacpi.dll/mnt/WINDOWS/ServicePackFiles/i386/halapic.dll/mnt/WINDOWS/ServicePackFiles/i386/halmacpi.dll/mnt/WINDOWS/ServicePackFiles/i386/halmps.dll/mnt/WINDOWS/system32/hal.dll# cp -f /mnt/WINDOWS/ServicePackFiles/i386/hal.dll /mnt/WINDOWS/system32/hal.dll# umount /mnt

Now that you have a "fixed" img file representing the entire drive, you can dd it straight to a lvm logical volume to be used as a Xen phy: vbd device:# ls -la win2003.img-rw-r--r--  1 root root 8589934592 2006-11-16 13:44 win2003.img# lvcreate -L 8G -n win2003-hda vg# dd if=windows2000.img of=/dev/vg/win2003-hda bs=1M

Now you are done. Start up your spiffy new HVM domain.
This, in a nutshell, is how you convert a VMWare image into a Xen HVM disk image.

论坛徽章:
0
2 [报告]
发表于 2010-12-14 21:52 |只看该作者
这个论坛的编辑器太次了

论坛徽章:
0
3 [报告]
发表于 2010-12-14 22:15 |只看该作者
能翻译成中文就更好了

论坛徽章:
0
4 [报告]
发表于 2010-12-15 15:46 |只看该作者
放google翻译里面  再修改几下  差不多了。。呵呵

论坛徽章:
0
5 [报告]
发表于 2010-12-18 20:15 |只看该作者
为什么不用中文呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP