So, you’ve deployed VMware ESXi and successfully deployed your first VM. Now you are looking for the “clone” function that used to feature in the VMware Server of old. I have some bad news, they’ve taken it away from the free VSphere management application – its now a feature you have to pay for.
“Thats ok, i’ll just SSH in and cp the files like I used to using VMware Server 2″… well, bad news again, its not that simple anymore. You have to do a little bit of hackery, simple hackery mind 🙂
First step is to enable SSH on ESXi.
- Go to the ESXi console and press Alt+F1 – you will get a blank screen
- Type: unsupported and press <enter> (you won’t see anything as you type, but “Password:” will pop up)
- Enter the root password, press <enter>
- At the prompt type “vi /etc/inetd.conf”
- Look for the line that starts with “#ssh” (you can search with pressing “/”, or just press down to scroll)
- Remove the “#” from infront of the ssh line entries (put the cursor on the # and press “x” to delete)
- Save “/etc/inetd.conf” by typing “:wq!”
- Restart the management service “/sbin/services.sh restart”
Some people report that you have to manually kill and restart the “inetd” process using kill -HUP , but I didn’t need to do this.
You now have SSH access into the ESXi host.
Cloning a VM using SSH on ESXi
- SSH into the server (duh!)
- Locate the VM datastore (for me this was /vmfs/volumes/datastore1/)
- Make a directory for your new virtual machine
- Clone using “vmkfstools -i” (eg: vmkfstools -i /vmfs/volumes/datastore1/SOURCE/source.vmdk /vmfs/volumes/datastore1/TARGET/TARGET.vmdk)
- Cloning process runs (time to complete depends on size of SOURCE)
- In VSphere create a new custom VM as you would normally, and at the disk stage, select “use an existing disk” and browse to the TARGET vm that you’ve just cloned
Oh, obviously the clone process won’t run if the SOURCE vm is powered on and running, you have to fully power it down.
As always, comments and feedback much appreciated – oh and talk to me on twitter 🙂