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

下载本文档

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

文档简介

1 如何把 linux 物理机迁移到 vmware 中 如何把 linux 物理机迁移到 vmware 中 gzjoker 要把物理机的 linux 迁移到 vmware 中 vmware 自己提供了 vmware converter 这个看了评测 好像不能迁移到 vmware workstation 中 所以没 有去尝试 google 之后 发现了一些方法 实际测试成功 整理一下 1 备份物理机 如果是 windows 的系统 这个好办了 常用的 ghost 之类的都可以用 而 linux 系统 ghost 不可用 有一个开源的工具 Clonezilla 可以用 到这里下载一个 live cd http clonezilla org clonezilla live php 刻盘 使用光盘启动机器 完成备份 如果想要完成迁移 大部分都需要把物 理机的所有硬盘都迁移到 vmware 中 这时候需要在物理机上面外接一个硬盘来 放备份的镜像 Clonezilla 也支持把镜像放到 ftp nfs server samba 等网络 服务器上面 但是那样速度可能太慢 如果速度快 可以插入一个 USB 的移动 硬盘 Clonezilla 会自动识别 USB 设备的 关于 Clonezilla 的使用方法 可以看下面的这些连接 图文并茂的 1 http clonezilla org fine print live doc php 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 的虚拟机 新建的磁盘最好跟物理机的磁盘大小相等或者 2 大于物理机的磁盘大小 最终硬盘的磁盘大小会与物理机的数据大小有关系 新建磁盘如果是 scsi 的 最好选择 buslogic 的 scsi 卡 否则后面修复的 时候 会找不到磁盘 不能选择 buslogic 的 就选择 ide 的磁盘 但是这样修 复完了以后 则需要去修改 etc fstab 文件了 因为物理机是 scsi 磁盘 看到 的是 dev sda1 这样的格式 ide 的磁盘就是 dev hda1 这样的格式 使用 Clonezilla 的 live cd 启动虚拟机 按照上面两个连接的方法 把物 理机的镜像恢复到虚拟机中 developerworks 上面的那篇文章 在恢复的步骤 说要先给目标磁盘分区 格式化之类的 我没有做 直接启动 live cd 然后恢 复即可 会自动对目标磁盘分区 3 修复 vmware 镜像中的 linux 物理机的镜像恢复到 vmware 中以后 由于物理机的硬件条件跟虚拟机不同 所以并不能立刻开始使用 甚至启动都启动不起来 所以需要修复一下 修复 的方法 有几种 引用一下 可以每种都试下 那种方便使用哪种 方法一 引用自 nezilla E8 BF 9B E8 A1 8Clinux E7 B3 BB E7 BB 9F E7 9A 84 E7 89 A9 E 7 90 86 E6 9C BA E5 88 B0 E8 99 9A E6 8B 9F E6 9C BA E7 9A 84p2v E8 BF 81 E7 A7 BB 操作步骤 测试成功 1 使用 clonezilla live 进行备份 可备份到移动硬盘上 或者网络上 不管使用哪种方式 都建议将备份好的 image 放到网络上 便于后续的恢 3 复工作 记录一下 当前 1 2 3 版本的 clonezilla 还不认识 R710 的网卡 所以引 导过程需要超时 4 次 每次 1 分钟 因为机器有 4 块网卡 耗时 当了后边 vmware 环境中 它就认识那个网卡了 启动非常快速 2 在虚拟机中创建一个新的虚拟机 注意硬盘不能小于物理机的硬盘 3 启动虚拟机 并以 clonezilla live 光盘引导 进入 shell 模式 使用 fdisk 对本地的硬盘进行分区 只需要创建一个分 区 保存分区表 重启虚拟机 sudo su fdisk l fdisk dev sda 创建分区 reboot 4 再次以 clonezilla live 光盘引导 启动虚拟机 进行 linux 系统的恢 复 进行恢复 使用网络资源进行恢复 本地机器设置静态 ip 即可 我使用的 ssh 方式挂载镜像数据 非常方便 5 恢复系统以后 调整一些参数 如果不执行此步骤 直接启动虚机硬盘引导 会遇到 panic 之类的严重错 误 其实就是找不到合适的引导盘 用 linux 的安装光盘 随便哪个版本都可以 只要是 Linux 即可 版本与 主机系统相同是最好 引导虚拟机启动 进入 linux rescue 模式 4 然后执行 mkinitrd 命令 重建 initrd 即可 如果有多余的文件系统 可以修改 etc fstab 文件进行注释 如果原来物 理机里有多块本地硬盘 或者加载有 iscsi san 等网络磁盘 都需要修改这个 文件 6 重启就好了 poertoff 虚机 修改虚机设置 将光驱挂载去掉 虚拟机可以不要光盘引 导了 可以自行引导了 power on 之后 虚机不再报错了 系统正常了 只需要修改自己的网络地址 所有服务已正常 方法二 引用自 cmd displayKC externalId 1002402 Virtual machine does not boot after being converted from a physical Red Hat machine Details A converted physical machine running Red Hat does not boot as expected Virtual machine fails to boot after conversion The boot process halts with an error Possible errors include o No volume groups found o Kernel panic not syncing Attempted to kill init o VFS Cannot open root device LABEL or 00 00 5 o Please append a correct root boot option o Kernel panic VFS Unable to mount root fs on 00 00 Solution The issue occurs because the operating system s ramdisk image does not include the drivers 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 use this hardware You must replace the existing ramdisk image with one that includes the proper drivers Converter 3 0 x did not support hot cloning of Linux operating systems or the configuration of resulting virtual machines for new virtual 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 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 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 6 1 If your physical source machine has a vCenter Converter 4 0 supported 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 If you are unable to use Converter to create a new Red Hat virtual 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 snapshot and back up files can be deleted o In these steps you will be making sure that the operating system has 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 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 If the physical computer was IDE based replace any instance of the text dev hda with dev sda in the files etc fstab 7 boot grub device map and boot grub grub conf 7 Ensure that grub is installed properly Type grub install and press Enter 8 If the file etc modules conf exists edit it and remove any existing entries 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 If you will be using BusLogic 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 BusLogic 3 If 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 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 ramdisk image to be rebuilt The file will is located in boot List the contents of the directory by typing 8 ls boot and pressing Enter There will be a file with a name similar to 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 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 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 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 If 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 1 Convert the physical machine again 方法三 引用自 Successful Physical to Virtual P2V conversion of Linux boxes with 9 VMware Converter For those you who are looking for the comprehensive details steps of how to P2V a linux box with VMware Converter Pre requisites Have the Linux installation Boot CD1 handy You should purchase VMware Converter Enterprise license 1 Download VMware Converter Enterprise latest version and burn it to 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 settings 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 the information is entered correctly it should start importing 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 customization steps which I did not configure for but after successful copy of the local disks 10 10 Go to the ESX server where the imported VM resides Edit the settings 11 In the VM s settings check any irregular settings which might appears In my case I had to change the OS type of VM from other 32bit to 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 just as expected Steps to fix the kernel panic on the Linux VM 13 Boot up with the bootable Linux installation CD 1 If it doesn t boot from the CD you may have to change the VM s setting to go to the BIOS setting on the next boot so that you can change the boot sequence 14 At the boot prompt type Linux rescue and hit enter 15 It will search for the Linux partition In my case it could not find the hard disks So I had to go back to VM s setting to change the BusLogic 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 11 18 It will get you bac

温馨提示

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

评论

0/150

提交评论