How to Clone an ESXi OS without vCenter – Nested Lab

 
I’ve created a base esx VM on parent esx machine – “esxlab01” and named it esx_template

 

The datastore view of files under esx_template is shown as below 

[root@esxlab-01:~] ls -ltr /vmfs/volumes/Datastore-SSHD/esx_template/
total 634944
-rw-r–r– 1 root root 0 Apr 19 16:02 esx_template.vmsd
-rw-r–r– 1 root root 412695 Apr 19 16:22 vmware-1.log
-rw-r–r– 1 root root 214356 Apr 19 16:25 vmware-2.log
-rw-r–r– 1 root root 258223 Apr 19 16:39 vmware-3.log
-rw-r–r– 1 root root 289246 Apr 19 17:10 vmware-4.log
-rw——- 1 root root 270840 Apr 19 17:12 esx_template.nvram
-rw——- 1 root root 532 Apr 19 17:12 esx_template.vmdk
-rw-r–r– 1 root root 215186 Apr 19 17:21 vmware.log
-rwxr-xr-x 1 root root 3683 Apr 19 17:21 esx_template.vmx
-rw——- 1 root root 26843545600 Apr 19 17:21 esx_template-flat.vmdk

We are only interested in *.vmdk files, *.vmx and *.vmsd file in above folder which are required for our cloning 

Back on the esxlab01, i now create a new VM named sfo01-m01-esx02 with no harddisk attached as shown 

 


We will now use the harddisk of the template vm to create a disk for this new VM shell we created 

 

We will not be having a vCenter ready for our vCF install to do a clone so we are going to do a manual approach of copying the files via the shell to the new VM’s directory as shown.

Procedure to Clone VM disks when vCenter is not present

Browse to the datastore view of the VM shell we just created, in this example sfo01-m01-esx02 is the new VM we just created 

 

root@esxlab-01:/vmfs/volumes/607c2b1c-13cf66f2-f2f7-b8ac6f19f4ba] cd sfo01-m01-esx02

Copy just these files from esxtemplate VM to sfo01-m01-esx02

 
  • [root@esxlab-01:/vmfs/volumes/607c2b1c-13cf66f2-f2f7-b8ac6f19f4ba/sfo01-m01-esx02] cp -a /vmfs/volumes/Datastore-SSHD/esx_template/*.vmdk .
  • [root@esxlab-01:/vmfs/volumes/607c2b1c-13cf66f2-f2f7-b8ac6f19f4ba/sfo01-m01-esx02] cp -a /vmfs/volumes/Datastore-SSHD/esx_template/esx_template.vmsd .
  • [root@esxlab-01:/vmfs/volumes/607c2b1c-13cf66f2-f2f7-b8ac6f19f4ba/sfo01-m01-esx02] cp -a /vmfs/volumes/Datastore-SSHD/esx_template/esx_template.vmx .

So once the copy is over, we will see a view similar to this one.

 

[root@esxlab-01:/vmfs/volumes/607c2b1c-13cf66f2-f2f7-b8ac6f19f4ba/sfo01-m01-esx02] ls -ltr
total 26214464
-rw-r–r– 1 root root 0 Apr 19 16:02 esx_template.vmsd
-rw——- 1 root root 532 Apr 19 17:12 esx_template.vmdk
-rwxr-xr-x 1 root root 3683 Apr 19 17:21 esx_template.vmx
-rw——- 1 root root 26843545600 Apr 19 17:21 esx_template-flat.vmdk
-rwxr-xr-x 1 root root 2073 Apr 19 20:24 sfo01-m01-esx02.vmx
-rw-r–r– 1 root root 0 Apr 19 20:24 sfo01-m01-esx02.vmsd
[root@esxlab-01:/vmfs/volumes/607c2b1c-13cf66f2-f2f7-b8ac6f19f4ba/sfo01-m01-esx02]

Go back to esx-UI as shown and we will now attach the esx_template.vmdk disk to be the parent disk for the sfo01-m01-esx02 VM

 


 

Select the template disk as shown

 

Template disk is now attached to our VM

 

Poweron the VM

Once the VM is up, lets now change the IP address and hostname


As we copied everything from template, the only change here is the IP address and hostname 

 

Reboot the VM
 

 

Set the hostname and fdqn as shown from CLI


[root@sfo01-m01-esx02:~] esxcli system hostname set –host=sfo01-m01-esx02
[root@sfo01-m01-esx02:~] esxcli system hostname set –fqdn=sfo01-m01-esx02.ash.local

(Visited 108 times, 1 visits today)

Leave a Reply