Copy VMWare Server virtual servers (Ubuntu) between physical machines, avoid locking errors and fix missing eth0

I needed to copy a virtual Ubuntu Server install from our backup store to a new physical server (server A) as our old server (server B) suffered a major failure and wouldn’t even boot. This meant copying the whole VMWare directory containing the Ubuntu virtual machine from the backup store (a USB harddrive in this case) to the new physical server (server A). I had installed the free VMWare Server on both server B and A so that if anything happened to server B I would be able to get up and running quickly on server A.

Note: I am assuming you can install and configure VMWare Server for Windows, which is what I’m using here.

Once I copied the whole directory from the backup store to server A’s VMWare directory (in this case c:vmware) I then used the VMWare web interface to “Virtual Machine – Add Virtual Machine to Inventory” which allowed me to select the .vmx file in my datastore that corresponded to my copied Ubuntu virtual machine.

On trying to start the virtual machine I get a warning message and a choice:

msg.uuid.altered: This virtual machine may have been moved or copied. In order to configure certain management and networking features VMware Server needs to know which. Did you move this virtual machine, or did you copy it? If you don’t know, answer “I copied it”.

I select “I copied it” and then click “ok”, which then brings up an error:

“Power On Virtual Machine” failed to complete

If these problems persist, please contact your system administrator.
Cannot open the disk ‘C:vmwareVIRTUALSERVERNAMEVIRTUALSERVERNAME.vmdk’ or one of the snapshot disks it depends on. Reason: Failed to lock the file.

Ok, so it seems that because I copied the virtual server from the backup store it also included the .lck directories, which are used while the server is running. The simple fix is to delete these directories in C:vmwareVIRTUALSERVERNAME and allow VMWare server to rebuild them. Once I had deleted the two directories “VIRTUALSERVERNAME.vmdk.lck” and “VIRTUALSERVERNAME.vmem.lck” I could start the virtual machine.

I then ran into another problem, which was that my network instance eth0 was not being set up correctly even with VMWare Server set to use “Bridged” networking which worked on the old server. Running “ifconfig -a” showed that eth0 wasn’t there and it didn’t have the static IP I had given it previously in “/etc/network/interfaces”. The loopback interface, l0, was there but not eth0.

Orzeszek has an easy solution for this, which is to delete the “/etc/udev/rules.d/70-persistent-net.rules” file and “sudo reboot” to allow Ubuntu to rebuild the file with the correct MAC address, set up by VMWare Server when we originally added the virtual machine to the inventory. Now everything should be working perfectly.

Some people have reported other errors, which can be fixed by changing the name of eth0 in “/etc/network/interfaces” to eth1, which I didn’t need to do but you might.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>