Thursday, March 19, 2015

Clone A VMware’s VM Without vCenter in ESXi 5.x-Using VMKFS

                                           I herewith show the procedure by cloning a VM Server/snapshot of a VM.We have already option for taking Snapshots of a VM in VSphere client.
For taking snapshot via VSphere client :- Right click the vVM ---> Make a snapshot
For taking Clone follow the steps
  1. Shutdown the VM otherwise the files will be locked.
  2. Connect the ESXi host via Putty and Browse the Datastore and check the VM Server location
#cd /vmfs/volumes/datstore name
     3.   List the items in the location
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7#ls
     4.   Enter in to the location, which is allocated for the VM and list the items
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1#ls
                                       As you can see now, there are more than one vmdk disk files, the flat vmdk, the delta vmdk and the vmdk descriptor file (the Xp3-000001.vmdk file in our example), along with the memory snapshot and various control and log files.
    For taking Clone Via vmkfstool command line Syntax :-
vmkfstools -i source_path destination_path -d disk_format -a adapter_type
If you didn’t have a snapshot, the source file would be the vmdk descriptor file of your vm
     5.   Create the destination folder in datastore folder
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1 # mkdir SVR-2
     6.   Clone the disk file - In the case of Snapshot
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1-000001.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
     7.   Clone the disk file - No snapshot-take direct machine clone
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
    8. Create a new vm and force the use of an existing disk file via VSphere client
Eg:-
Based i have a VM machine named “vmsvr-1” located in datastore.Datastore name is 220
Here i have clone my vmsvr-1 machine to a new vmsvr-2 VM and loaded into SVR-2 folder
  1. Login into the ESXi host and check the item in machine placed location                                    
                      #cd /vmfs/volumes/220/
                     /vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1#ls
vmsvr-1-flat.vmdk  vmware-11.log
vmsvr-1.nvram      vmware-12.log
vmsvr-1.vmdk       vmware-13.log
vmsvr-1.vmsd       vmware-8.log
vmsvr-1.vmx        vmware-9.log
vmsvr-1.vmxf       vmware.log
vmware-10.log
  1. Clone the disk file - No snapshot-take direct machine clone
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
After you enter the above command it shows a message to start the cloning process
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/220/SVR-1/vmsvr-1.vmdk'...
Clone: 10% done.
Clone: 100% done.
  1. Check the SVR-2 folder location after the cloning process
                    /vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-2 #ls
vmsvr2-flat.vmdk  vmsvr2.vmdk
  1. Create a new vm and force the use of an existing disk file (vmsvr-2.vmdk) via VSphere client

No comments:

Post a Comment

bloggerwidgets