Virtual machines opens the door for creating a VM template, where the guest OS is installed in a pre-defined manner, and task-specific instances of this template can be created and disposed of when the task is completed. For example, evaluation of a 30-day evaluation software installation is a prime example. Repeated installation, followed by un-installation, on a OS takes its toll leaving remnants of the products in unlikely locations. Creating a new VM instance dedicated to product evaluation and later deleting the entire VM once the product evaluation has completed is...in a word...simple.
This requires defining a VM template, simply put a generic OS installation that you'll clone for specific tasks. This is generated simply by creating a VM and installing the guest OS (documented in VMWare references). What isn't documented is how to clone/copy the VM. That will be the focus of the remainder of this post.
Suppose you have a VM template called WinXpBase, located in /VM/WinXpBase/ and you wish to clone this VM as Clone01 at /VM/Clone01/.
Step 1 - Copy the VM:
$ cp -rf /VM/WinXpBase /VM/Clone01
Step 2 - Update the Virtual Disks
$ cd /VM/Clone01
$ vmware-vdiskmanager -n WinXpBase.vmdk Clone01.vmdk
Step 3 - Rename Files Accordingly
$ mv WinXpBase.vmx Clone01.vmx
$ mv WinXpBase.vmsd Clone01.vmsd
Step 4 - Update File Name References in VM Properties
open the Clone01.vmx file in your favorite editor and search-n-replace instances of WinXpBase with Clone01
Step 5 - Add VM to VM List
As root, edit the following files:
/etc/vmware/vm-list
/etc/vmware/vm-list-private
duplicating the lines with WinXpBase, followed by search-n-replace with Clone01.
Fire up the VM Console and power up your new Clone01 VM.
Last Step - Apply New VM Identifier
Upon applying power to your new Clone01 VM, you'll encounter a pop-up similar to:
This is a one-time pop-up, you should select Create and you've just cloned your very own VM.
No comments:
Post a Comment