Linked Clone in vSphere 6 without vCenter

Please refer to the following steps on how to create Linked Clone with 1 Master Image (Windows 2012 R2 Server) without vCenter in my Lab on SSD Hard Disk

Install Windows 2012 R2 Server with latest patches and do run SYSPREP and save it for our Master Image

C:\Windows\System32\SysPrep\SysPrep.exe

SysPrep
Check “Generalize” to generate a new SID, and Select Shutdown.
**Click **OK
and once the SysPrep is completed, server will be shutdown.

Login to vSphere 6 Host using SSH Client to find out the VMID for the Template Image created

vim-cmd vmsvc/getallvms 
Vmid     Name                  File                      Guest OS          Version             Annotation
84     AVENTIS-TEMPLATE-WIN2012R2       [240] AVENTIS-TEMPLATE-WIN2012R2/AVENTIS-TEMPLATE-WIN2012R2.vmx             windows8Server64Guest     vmx-11    

VMID of the template image is 84, and create a SnapShot on the template image using the following commands

vim-cmd vmsvc/snapshot.create 84 "BASE" "Master Image for LinkClone"
Create Snapshot:

vim-cmd vmsvc/snapshot.get 84
Get Snapshot:
|-ROOT
--Snapshot Name        : BASE
--Snapshot Id        : 1
--Snapshot Desciption  : Master Image for LinkClone
--Snapshot Created On  : 5/29/2016 14:56:32
--Snapshot State       : powered off

Repeat the following steps for new VM provisioned from Master Image using Linked Clone 

Create a new Directory for the new VM, and copy the SnapShot (-000001*.vmdk) and configuration file (vmx) from template

src="/vmfs/volumes/240/AVENTIS-TEMPLATE-WIN2012R2"
dst="/vmfs/volumes/240/vCenter"

mkdir $dst

cat $src/AVENTIS-TEMPLATE-WIN2012R2.vmx | grep fileName
scsi0:0.fileName = "AVENTIS-TEMPLATE-WIN2012R2_0-000001.vmdk"

cp $src/AVENTIS-TEMPLATE-WIN2012R2_0-000001*.vmdk $dst
cp $src/AVENTIS-TEMPLATE-WIN2012R2.vmx $dst

Rename the Copied VMDK file

mv $dst/*-delta.vmdk $dst/vCenter-000001-delta.vmdk
 mv $dst/*000001.vmdk $dst/vCenter-000001.vmdk
 mv $dst/*.vmx $dst/vCenter.vmx
 ls $dst
  vCenter-000001-delta.vmdk  vCenter-000001.vmdk        vCenter.vmx

Remove the following lines using sed

sed -i '/sched.swap.derivedName/d' ./*.vmx 
sed -i '/uuid.bios/d' ./*.vmx 
sed -i '/uuid.location/d' ./*.vmx 
sed -i '/extendedConfigFile/d' ./*.vmx
sed -i '/nvram/d' ./*.vmx
sed -i '/migrate.hostLog/d' ./*.vmx
sed -i '/ethernet0.generatedAddress/d' ./*.vmx

Change the Display Name and the location of the VMDK file

sed -i -e '/displayName =/ s/= .*/= "'vCenter'"/' ./*.vmx
sed -i -e '/scsi0:0.fileName =/ s/= .*/= "'vCenter-000001.vmdk'"/' ./*.vmx

Open vCenter-000001.vmdk file and modify parentFileNameHint = THE MASTER IMAGE FILE RW 209715200 VMFSSPARSE “NEW -DELTA.VM

vi vCenter-000001.vmdk

Disk DescriptorFile
version=1
encoding="UTF-8"
CID=dd8e31e1
parentCID=b7de00bf
isNativeSnapshot="no"
createType="vmfsSparse"
parentFileNameHint="/vmfs/volumes/240/AVENTIS-TEMPLATE-WIN2012R2/AVENTIS-TEMPLATE-WIN2012R2_0.vmdk"
# Extent description
RW 209715200 VMFSSPARSE "vCenter-000001-delta.vmdk"

# The Disk Data Base
#DDB

ddb.longContentID = "6a5d50785c6e1eff29e84dcedd8e31e1"

Register the VM and Power On

vim-cmd solo/registervm $dst/vCenter.vmx
87 

vim-cmd vmsvc/power.on 87
Powering on VM:

The new VM will only consume very little spaces

root@esx:/vmfs/volumes/572ef3c5-0518c917-6aa8-9c8e99294f30/vCenter] ls -lh
total 4764696
-rw-------    1 root     root        8.5K May 29 19:43 nvram
-rw-------    1 root     root      384.2M May 29 19:50 vCenter-000001-delta.vmdk
-rw-------    1 root     root         384 May 29 19:42 vCenter-000001.vmdk
-rw-------    1 root     root        4.0G May 29 19:42 vCenter-0f23eacf.vswp
-rw-r--r--    1 root     root           0 May 29 19:36 vCenter.vmsd
-rwxr-xr-x    1 root     root        3.2K May 29 19:42 vCenter.vmx
-rw-------    1 root     root           0 May 29 19:42 vCenter.vmx.lck
-rw-------    1 root     root        3.8K May 29 19:42 vCenter.vmxf
-rwxr-xr-x    1 root     root        3.1K May 29 19:42 vCenter.vmx~
-rw-r--r--    1 root     root       49.9K May 29 19:37 vmware-1.log
-rw-r--r--    1 root     root      316.3K May 29 19:43 vmware.log
-rw-------    1 root     root      169.0M May 29 19:42 vmx-vCenter-254012111-1.vswp

I will try to provision few Servers for Citrix XenDesktop lab soon to see what is the maximum number of VM that i can provision before experience slowness using linked Clone

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top