When you need to create multiple VMs with vanilla Linux installed, cloning an existing VM saves you time with installation and configuration of new VMs. If you are using VMware Workstation, VM cloning process is streamlined with a built-in Clone Virtual Machine Wizard. However, if you are using VMware Server, it does not have such functionality, and you need to clone VMs manually. In order to clone a VM in VMware Server 2.0, you can follow these step-by-step instructions.
First, make a copy of a disk image of an existing VM (e.g., old_vm).
Next, create a new VM via VMware Server web interface (using the same VM template as the existing VM), and name it "new_vm". When asked about a disk, choose "use existing disk" and point it to the copy you made before. You'll then get directory new_vm/ with 3 files inside: new_vm.vmsd, new_vm.vmx, and new_vm.vmxf.
Now, move file(s) of your new disk image (e.g., temp_vm.vmdk) to new_vm/ directory.
Rename your disk image as follows.
Open new_vm.vmx file in an editor, and change paths to point to new location of your disk image (e.g., new_vm.vmdk)
Power up the cloned VM.
The final step needed involves updating the network configuration inside the cloned VM, and is thus Linux-distro specific.
For CentOS/RHEL/Fedora-based VM, open up the VM console, and modify the following:
- /etc/sysconfig/network (change hostname)
- /etc/udev/rules.d/70-persistent-net.rules (change mac-address of network interface(s) according to new_vm.vmx specification)
- /etc/sysconfig/network-scripts/ifcfg-ethX (change hwaddr field)
For Debian/Ubuntu-based VM, open up the VM console, and modify the following:
- /etc/hostname (change hostname)
Reboot the cloned VM again, to complete the whole process.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!