Cloning a VMware machine
How to Enable SSH on VMware ESXi server
Some info Taken from http://www.yellow-bricks.com/2008/08/10/howto-esxi-and-ssh/
Note: if you use the Vmware Remote Command Line tools - you do not need to enable SSH - but its handy to know how to do it anyway.
1. Go to the ESXi console and press alt+F1 2. Type: unsupported (No prompt, typing is blind) 3. Enter the root password 4. At the prompt type "vi /etc/inetd.conf" 5. Look for the line that starts with #ssh 6. Remove the # (press the "x" if the cursor is on the character) 7. Save /etc/inetd.conf by typing ":wq!" 8. Restart the VMware host server.
How to Clone a existing VM located on your ESXi Datastore.
Summary
1. Create a VM without any Hard disk 2. Copy an existing hardisk (cloning an existing server) to the new location 3. Assign new harddisk to your new VM
Create a Virtual Machine (VM) without any Hard Disk
Using Vmware Infrastrure Client
1. Create a new Virtual Machine 2. Select "Custom" 3. Enter name of your VM (e.g. "Win2003-202") 4. Select datastore on where VM should be located 5. Choose guest OS <next>, no of processors <next>, RAM <next>, NIC interfaces <next> 6. Stroage Adapter Type (LSI Logic) 7. select "Do not create disk" 8. Finish
Copy an existing Virtual Disk to your newly created VM folder
Using the linux copy command “cp” or VMWare's Remote Command Line Tools (can be used within SSH or from your client PC) Below Example: creates copy of the Virtual Disk from VM “Win2003-201” to VM “Win2003-202”
1. SSH to the VMware Host Server 2. Login using the "root" username and password 3. Naviagte to the datstore where the disk you want to clone / copy is located. e.g.: cd vmfs/volumes/datastore2/Win2003-201
4. Use vmkfstools with "- i" option to clone a disk image (vmdk file), use the "-d thin" option to create a thin copy of hardisk.
vmkfstools -d thin -i /vmfs/volumes/datastore2/Win2003-201/Win2003-201.vmdk /vmfs/volumes/datastore2/Win2003-202/Win2003-202.vmdk
Add the newly copied VM Disk to your newly created Virtual Machine
Using Vmware Infrastrure Client
1. Right-click your new VM (Win2003-202) and select "Edit Settings" 2. Select "Add" and choose "Hard Drive", click Next 3. Select "Use an existing Virtual disk" - Browse to the location of your newly copied Virtual Disk 4. Select Next, Next, Finish
Note: If the server you have copied is a Windows Machine, you MUST run newsid.exe on the new VM Download from here: http://technet.microsoft.com/en-us/sysinternals/bb897418.aspx
This creates a new SID for the server as well as renaming it. This needs to be done if the two servers are to join a domain and not to conflict with each other.