Thursday, 12 August 2010

Using VMware vSphere CLI to convert Sparse Disk to Thick

Scenario:

VMware virtual machines are being transferred from one hosting provider to another. You are given a desktop SATA disk with the virtual machines files on and you upload the files using the vSphere Client to a VMFS datastore connected to one of your ESXi servers. You right-click on the VMX file and import the machine. The disks appear as either 0 bytes in size or 'Type:' = sparse. You remove the disks and re-add, they still come up as 'Type:' = sparse, and the virtual machine will not boot


The solution:

Use the VMware vSphere CLI to convert the Sparse Disk to Thick using the following command, then remove the sparse disks from the VM and add the converted disks (keeping SCSI IDs in order):

Command syntax:

vmkfstools.pl --server=IPADDRESSOFVMHOSTorHOSTNAME -i /vmfs/volumes/SOURCEPATH/SOURCEFILENAME.vmdk /vmfs/volumes/DESTINATIONPATH/DESTINATIONFILENAME.vmdk


Example:

C:\Program Files (x86)\VMware\VMware vSphere CLI>vmkfstools.pl --server=esxi01 -i /vmfs/volumes/"test store"/DC1/scsi0-0-0-DC1.vmdk /vmfs/volumes/"test store"/DC1/DC1_0.vmdk

Enter username: root
Enter password:


UPDATE: Or you could just storage vMotion the sparse disk and this will have the same affect.

No comments:

Post a Comment