2008年10月4日星期六

如何移动VMware虚拟机

这次移动虚拟机,没有成功,害得我差点没抓狂,为了不让这种事情再次发生,虽然这件事情过去了,但是我还是去网上找了一下资料,后来在官方网站看到下面的信息,我终于明白我的移动为什么没有成功了。因为我在移动之前没有关闭客户机,我一直都是用暂停的,省得去开机关机。但是这次暂停仿佛是有问题的,官方的说明明确指出了这一点,虽然我觉得暂停的内存文件被删除了那么和关机没有什么两样,但事实上是我还是开机不了,GRUB选择之后,内核一直启动不了,不断的重启。下次我还是要试一下关机之后再移动看看有没有用。


Preparing a Workstation 5 Virtual Machine for a Move



1. Shut down the guest operating system and power off the virtual machine. If the virtual machine is suspended, resume it, then shut down the guest operating system.



2. Do one of the following:



  • If you are moving the virtual machine to a new host and have a network connection between the original host machine and the new host, you are finished with the preparations on the original host.


  • Otherwise, you need to have a way of moving the virtual disk (.vmdk) files from the virtual machine's directory to the new host. You could move them to a shared network directory, for example, or burn them to CD-ROMs if they are not too large.



    Once you know how you are going to move the virtual machine, go to Moving a Workstation 5 Virtual Machine to a New Host.



  • If you are moving this virtual machine to another directory on this host, then you are ready to make the move. Copy all the files in the virtual machine's original directory to the new location.


  • If you stored any files in directories other than the virtual machine directory, be sure to move them into a directory of the same name and same position relative to the location of the virtual machine.



    Start VMware Workstation and open the new virtual machine you just created. Choose File > Open, then browse to the virtual machine's configuration (.vmx) file.




    还有移动后网卡不能用的问题,参考这个


    如果把vmware安装后的所有文件(vmx等)拷贝到另外一台主机,那么使用同样的vmware station可以继续使用已经安装的系统而不必重新安装。但是有一点要注意,就是网卡的问题。当拷贝后第一次启动,vmware会提示此系统是否是copy过来的,如果是那么就会为虚拟系统的网卡重新分配一个mac地址,可以通过查看vmx文件知道mac的详细地址。

    在debian linux虚拟系统中网卡的mac地址在 /etc/udev/rules.d/z25_persistent-net.rules中,只要把eth0或者对应需要的网卡标识对应到新的MAC地址就可以。同时需要修改/etc/network/interfaces中的IP地址,不然在同一个局域网中会产生IP冲突。修改完毕后重新启动就可以了。

    应该有办法不重新启动,但是还没有找解决方案,可能通过/proc可以避免重启吧。

    没有评论:

    发表评论