Over the past couple months I’ve been comparing VMWare Workstation against VMWare Player. Workstation costs $200, while Player is free. While the “free” part is enough for me to keep using Player, there are some things I miss about Workstation. One of the things I miss is the ability to make snapshots and copies of virtual machines. However, with a little bit of work, it’s possible to create a copy of a virtual machine you created with Player. Here’s an example of how I did it with a minimalist installation of Fedora 12.
Copy the original “golden” virtual machine directory within the Virtual Machines directory. The original virtual machine directory was named
Fedora12Mini, and the new directory was renamed
Fedora12Firewall. The first step is to change all the file names in the copied directory to match the new directory name (which will become your virtual machine’s name in Player). The virtual machine directory contains (at least) five files that have the same name as the virtual machine’s name, differing only by their extension. In the example below, all instances of
Fedora12Mini need to be changed to
How the copied directory looks before changing file names
Once that’s complete, open the new
Fedora12Firewall.vmx file. The .vmx file contains most of the configuration settings for the virtual machine. Modify all instances of the original virtual machine name (
Fedora12Mini) to the new name (
Fedora12Firewall) in the .vmx file. While you have the .vmx file open, note two lines you’ll need to look for later. These are the lines that start with ‘
ethernet0.generatedAddress‘ and ‘
uuid.location‘. These values are equivalent to the HWADDR (or MAC) and UUID values in your operating system’s configuration. Both of those values are intended to uniquely identify your network card and computer, respectively. When you start the virtual machine, these values will be regenerated for your new virtual machine, and you will need to update your virtual machine’s configuration with those new values. Before starting the new virtual machine, you still need to make one more file name change, this one in the .vmxf file; change the original virtual machine name to the new name, just like you did in the .vmx file earlier.
The generatedAddress and uuid lines in the .vmx file
Start the VM by starting VMWare Player, and then clicking “Open a Virtual Machine”. Navigate to the new directory and open the .vmx file in that directory. Now click “Play Virtual Machine.” Shortly after doing that, you will be asked if you moved or copied the virtual machine. When asked, say that you “copied”. The virtual machine will then start up.
The network adapter will fail upon startup. You’ll know this because you will not be able to make any network connections. Verify this by executing
ifconfig and looking for the IP address of the
Results of ifconfig
Note there is no ethernet controller (there should be at least an
eth0 setting). This is happening because Fedora’s configuration files do not match the changes made to the virtual hardware that were made when you told Player that you copied the virtual machine. To fix this, open up the .vmx file on the host and note the new ethernet generatedAddress and UUID location values. Open
/etc/sysconfig/networking-scripts/ifcfg-eth0 on the virtual machine and enter the contents of the
ethernet0.generatedAddress line into the
HWADDR line in
ifcfg-eth0, and the uuid.location contents into the
UUID line in
ethernet0.generatedAddress to ifcfg-eth0 is straightforward, but the UUID value isn’t formatted the same as in the .vmx file. When updating
ifcfg-eth0 with the new UUID, just ensure that it follows the same pattern of 4 bytes-2 bytes-2 bytes-2bytes-6 bytes. The easiest way I found to do this was to just add a new UUID underneath the existing UUID, then deleting the original UUID when finished:
ifcfg-eth0 after updating HWADDR and UUID, but before deleting original UUID
After deleting the original UUID value and saving
ifcfg-eth0, restart the virtual machine. (An aside: I’m not completely sure a full system restart is necessary here. I tried to restart the networking service [service network restart], and the changes didn’t seem to take effect until after the full system restart.) You should now have an IP address, and all will be good with the world.