Clone Virtual Machine on VMware Server 2.0
When you need a bunch of virtual machines with the same set up is really boring setting every single on from scratch. Cloning of virtual machines is VMware’s ESX is only a few clicks away. For the VMware Server product you need a bit of extra work as it lucks that functionality.
Bellow are some simple steps to get a virtual machines cloned:
- Create a new directory named after the name of the new virtual machine. You’ll need to create in the directory you decided to host the virtual machines. This is usually /var/lib/vmware/Virtual\ Machines
- Copy the disk image of the virtual machines you want to clone into the newly created directory and name it after the name of the new virtual machine. [ shutdown the existing virtual machine before copying the disk image ]
- Copy the vmname.vmx and vmname.vmxf files form the directory of the existing virtual machine into the directory of the new virtual machine.
- Changes in vmname.vmx:
- Replace all the entries that contain the existing virtual machine’s name with the new name. These are the values of the attrubutes: nvram, displayName, extendedConfigFile and scsi0:0.fileName. The last one may be different depending on the controller you’ll be providing to the virtual machine.
- Replace the existing UUIDs (you can generate new ones using the uuidgen command).
- Replace MAC address (you can change just a few digits).
- Replace the vmci0.id (change a few digits here as well).
- Changes in vmname.vmxf
- Replace the existing VMId with a new id generated by uuidgen.
- Replace the vmxPathName attribute.
Once you are done with all these, you can launch the VMware Infrastructure Web Access (type vmware in the console) and add the cloned virtual machine in the inventory:
- Virtual Machine -> Add Virtual Machine to inventory -> Select the new virtual machine from the inventory.
You can now start up the cloned virtual machine. You’ll need to change a couple of things in the OS settings of the virtual machine:
- /etc/hosts -> Replace old hostname with new one
- /etc/sysconfig/network -> Replace old hostname with new one
- /etc/sysconfig/network-scripts/ifcfg-eth0 -> Replace MAC address with new one and any other settings specific to the host