如何把物理机的linux迁移到vmware中_第1页
如何把物理机的linux迁移到vmware中_第2页
如何把物理机的linux迁移到vmware中_第3页
如何把物理机的linux迁移到vmware中_第4页
如何把物理机的linux迁移到vmware中_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、如何把linux物理机迁移到vmware中gzjoker要把物 理机 的 linux 迁 移到 vmware 中, vmware 自己 提供 了 vmware converter ,这个看了评测,好像不能迁移到 vmware workstation 中,所以没 有去尝试。 google 之后,发现了一些方法,实际测试成功,整理一下。1、备份物理机如果是 windows 的系统,这个好办了,常用的 ghost 之类的都可以用,而 linux 系统, ghost 不可用。有一个开源的工具 Clonezilla 可以用。到这里下载一个 live cd : /c

2、lonezilla-live.php,刻盘,使用光盘启动机器,完成备份。如果想要完成迁移,大部分都需要把物 理机的所有硬盘都迁移到 vmware 中,这时候需要在物理机上面外接一个硬盘来 放备份的镜像, Clonezilla 也支持把镜像放到 ftp ,nfs server ,samba 等网络 服务器上面,但是那样速度 可能太慢,如果速度快,可以插入一个USB的移动 硬盘,Clonezilla 会自动识别USB设备的。关于 Clonezilla 的使用方法,可以看下面的这些 连接, 图文并茂 的:(1) /fine-print-live-doc.php

3、?path=./clonezilla-live /doc/01_Save_disk_image/00-boot-clonezilla-live-cd.doc#00-boot-clone zilla-live-cd.doc(2) 2、恢复物理机镜像到 vmware中新建一个vmware的虚拟机,新建的磁盘最好跟物理机的 磁盘大小相等或者大于物理机的 磁盘大小,最终硬盘的磁盘大小会与物理机的 数据大小有关系。新建磁 盘如果是 scsi 的,最好选择 buslogic 的 scsi 卡,否则 后面 修复 的 时候, 会找 不到 磁盘,不能 选择 buslogic 的, 就选择 ide 的磁盘, 但是

4、这 样修 复完了以后, 则需要去 修改 /etc/fstab文件 了,因为 物理机是 scsi 磁盘,看到的是/dev/sdal这样的格式,ide的磁盘就是/dev/hdal这样的格式。使用 Clonezilla 的 live cd 启动 虚拟 机, 按照 上面 两个连接的方法,把物 理机的镜像 恢复到虚拟机中。 developerworks 上面的 那篇文章 ,在恢复的步骤 , 说要先给目标磁 盘分区, 格式化 之类的, 我没有做, 直接启动 live cd 然后恢 复即 可, 会自动 对目标磁 盘分 区。3、修复 vmware 镜像中的 linux物理机的镜像 恢复到vmware中以后,由

5、于物理机的硬 件条件跟虚拟 机不同, 所以并不能立刻开始使用, 甚至启动都启动不 起来,所以需要 修复一下, 修复 的方法,有 几种, 引用一下,可以 每种 都试下, 那种方便使用哪种。方法一: 引用自: nezilla%E8%BF%9B%E8%A1%8Clinux%E7%B3%BB%E7%BB%9F%E7%9A%84%E7%89%A9% 7%90%86%E6%9C%BA%E5%88%B0%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%9A%84p2 BF%81%E7%A7%BB/操作步骤 :( 测试成功 )1,使用 clonezilla live进行 备份。可备份到移动硬盘上,

6、 或者网络 上。不管使用哪种方式,都建议将备份好的 image 放到网络上, 便于后续的恢复工作记录一下, 当前 1.2.3 版本的 clonezilla 还不认识 R710 的网卡,所以 引 导过程需要超时 4次,每次 1分钟,因为机器有 4块网卡,耗时。当了后边 vmware 环境 中, 它就认识那 个网卡 了,启动 非常快速 。2,在虚拟机中 创建一个新的虚拟机。注意 硬盘不能 小于物理机的硬盘。3,启动 虚拟机,并以 clonezilla live 光盘引导。进入 shell 模式,使用 fdisk 对本地的硬盘 进行分区,只需要创建一个分 区,保存分区表。重启虚拟 机。sudo su

7、 -fdisk -lfdisk /dev/sda;( 创建 分区)reboot4,再次以 clonezilla live 光盘 引导,启动 虚拟 机,进行 linux 系统的 恢 复。进行恢复 。使用 网络 资源进行恢复 ,本地 机器设置静态 ip 即可, 我使用的 ssh 方式挂载镜像 数据 ,非常方 便。5,恢复 系统以后, 调整一些 参数 。如果不执行此步骤,直接启动虚机硬盘 引导,会遇到 panic 之类的 严重错 误,其实就是找不到 合适 的引导盘。用 linux 的安装 光盘 (随 便哪 个版本 都可以, 只要是 Linux 即可, 版本 与 主机系统 相同是最好)引导虚拟机启动,

8、 进入 linux rescue 模式。然后执行 mkinitrd 命令 ,重建 initrd 即可。如果有多余的文件系统,可以 修改/etc/fstab 文件进行 注释,如果原来物 理机里有 多块本地 硬盘, 或者加载有 iscsi/san 等网络磁 盘,都需要 修改这个 文件 。6, 重启 就好了。poertoff 虚机, 修改虚 机设置, 将光驱挂 载去 掉, 虚拟 机可以不要光盘 引 导了,可以自 行引 导了。power on 之后, 虚机不 再报错 了,系统 正常了 !只需要修改自己的 网络地址,所有 服务已正常。 方法二:引用自 &cmd=displayKC&externalId=

9、1002402Virtual machine does not boot after being converted from a physical Red Hat machineDetails? A converted physical machine running Red Hat does not boot asexpected? Virtual machine fails to boot after conversion? The boot process halts with an error? Possible errors include:o No volume groups f

10、oundo Kernel panic not syncing: Attempted to kill in it!o VFS: Cannot open root device LABEL=/ or 00:00o Please append a correct = root= boot optiono Kernel panic: VFS: Unable to mount root fs on 00:00SolutionThe issue occurs because the operating system s ramdisk image does not include the drivers

11、or modules for the virtual SCSI adapter configured for the virtual machine. These modules are not in the ramdisk image because the image was originally created on a system that did not usethis hardware. You must replacethe existingramdiskimage with one thatincludes the proper drivers.Converter 3.0.x

12、 did notsupport hotcloningof Linux operatingsystems or the configurationof resultingvirtualmachines for newvirtual hardware. It only supported cold cloning without configuration. vCenter Converter 4.0 does support hot cloning and the configuration of some Linux operating systems, including Red Hat.

13、Refer to the manual for a list of supported versions.Please validate that each troubleshooting step below is true for your environment. Each step will provide instructions or a link to a document, in order to eliminate possible causes and take corrective action as necessary. The steps are ordered in

14、 the most appropriate sequence to isolate the issue and identify the proper resolution. Please do not skip a step.Note: If you perform a corrective action in any of the following steps, attempt booting the virtual machine again.1. I f your physical source machine has a vCenter Converter 4.0 supporte

15、d version of Red Hat installed and you still have access to it:1. Upgrade to vCenter Converter 4.0 if you have not done so already.2. Run Converter and perform another physical to virtual conversion. This virtual machine should boot.2. I f you are unable to use Converter to create a new Red Hat virt

16、ual machine that boots, you will need to modify the guest operating system.Notes:o Before beginning, VMware recommends that you take a snapshot of your virtual machine. VMware also recommends that you back up any files that you edit in the following steps. Once the operating system is working the sn

17、apshot and back up files can be deleted.o In these steps, you will be making sure that the operating systemhas the appropriate type of virtual hard disk controller. This can be either LSI Logic or BusLogic. Choose the controller that is most suited to your version of Red Hat and make sure that it is

18、 this controller that is being presented to the virtual machine.3. Boot the virtual machine from the first Red Hat installation disk.4. At the first prompt, type linux rescue and press Enter.5. Change root to the mounted installation. Type chroot /mnt/sysimage and press Enter.6. I f the physical com

19、puter was IDE based, replace any instance ofthe text /dev/hda with /dev/sda in the files /etc/fstab,/boot/grub/device.map, and /boot/grub/grub.conf.7. Ensure that grub is installed properly. Type grub-install and press Enter.8. I f the file /etc/modules.conf exists, edit it and remove any existing e

20、ntries.9. Edit the file /etc/modprobe.conf.1. Look for alias ethx module entries, where x is replaced by a number and module is replaced by text. Change each module entry to pcnet32.2. I f you will be using BusLogic:Look for alias scsi_hostadapterx module entries, where x is replaced by a number and

21、 module is replaced by text. Change each module entry to BusLogic.3. I f you will be using LSI Logic:Look for alias scsi_hostadapterx module entries, where x is replaced by a number and module is replaced by text. Change each module entry to mptscsih.Additionally, look for an alias scsi_hostadapter

22、module entry, where module is replaced by text and there is no number after hostadapter. If it exists, replace module with mptbase. If it does not exist, add alias scsi_hostadapter mptbase directly above the line that now reads alias scsi_hostadapter1 mptscsih.10. Determine the full path to the ramd

23、isk image to be rebuilt. The file will is located in /boot. List the contents of the directory by typing ls /boot and pressing Enter. There will be a file with a name similarto initrd-2.6.9-42.EL.img. In this example, the full path to the ramdisk image is /boot/initrd-2.6.9-42.EL.img. Make a note of

24、 this.Note: If there is more than one initrd- file in /boot, type cat /etc/grub.conf and press Enter to determine which file is being used.11. Determine the kernel version to use for rebuilding the ramdisk image. Type ls /lib/modules and press Enter. In this example, you will see the directory 2.6.9

25、-42.EL. Make a note of this.Note: If there is more than one directory shown, type cat /etc/grub.conf and press Enter to determine which kernel version is being used.12. Rebuild the ramdisk. Type the command mkinitrd -v -f /boot/initrd-2.6.9-42.EL.img 2.6.9-42.EL and press Enter, where /boot/initrd-2

26、.6.9-42.EL.img is replaced with the information noted in h. and 2.6.9-42.EL is replaced by the information noted in step i.3. I f you are unable to use a supported version of Red Hat, or the procedure in 2. did not work:0. Modify the physical machine to have support for either BusLogic or LSI Logic.

27、1. Convert the physical machine again.方法三:引用自 Successful Physical to Virtual P2V conversion of Linux boxes withVMware Converter? For those you who are looking for the comprehensive details stepsof how to P2V a linux box with VMware Converter.Pre-requisites: Have the Linux installation Boot CD1 handy

28、. You should purchase VMware Converter Enterprise license.1. Download VMware Converter Enterprise latest version and burn itto the CD. I used version 3.0.2 update 1.2. Boot up with the above VMware Converter CD on the physical Linux box.3. Let the WinPE load up and watch for the Network adaptor sett

29、ings screen. Make necessary changes such as IP addressing.4. Finally you should see the VMware Converter screen where you can import the machine.5. Click on Import machine button and follow the steps.6. Important Make sure you select all disks and no resizing during the import process.7. If all thei

30、nformation isentered correctly, it should startimporting to ESX/VC.8. It will create a VM on the selected ESX server.9. In my case it failed at 97%where the error occurs at customizationsteps (which I did not configure for) but after successful copy ofthelocal disks.10. Go to the ESX server where th

31、e imported VM resides. Edit the settings.11. In the VM s settings, check any irregular settings which mightappears. In my case, I had to change the OS type of VM from other 32bitto REHL 4.12. When the VM is powered up for the first time as soon as P2V has finished, kernel panic will occur and it is

32、just as expected.Steps to fix the kernel panic on the Linux VM13. Boot up with the bootable Linux installation CD1. If it doesn t boot from the CD, you may have to change the VMs setting to go totheBIOS setting on the next boot so that you can change the boot sequence.14. At the boot: prompt type Li

33、nux rescue and hit enter.find the hard disksback to VM15. It will search for the Linux partition. In my case, it could nots setting to changetheBusLogic SCSI controller to LsiLogic.16. After changing to LsiLogic controller, Linux installation image was able to find the Linux partitions on the VM.17. The system will give you opportunity to mount the root file system.At the linux prompt, type: chroot /mnt/sysimage and hit enter.18. It will get you back to the prompt.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论