Showing posts with the label VMDK troubleshooting

Clone a VM without VMware vcenter

Steps for cloning VM using SSH:

SSH to the ESXi hostIdentify the path of the source (say, /vmfs/volumes/datastore1/SourceVM/ where sourceVM is the name of the source VM)Create a new folder in the desired datastore mkdir /vmfs/volumes/datastore1/DesintationVM

where DestinationVM is the name of the new VM
Clone the sourceVM vmdk to the newly created folder DestinationVM
vmkfstools -i /vmfs/volumes/datastore1/SourceVM/sourceVM.vmdk /vmfs/volumes/datastore1/DesintationVM/DesintationVM.vmdk

Once cloning is completed, proceed with the creation of the new VM using vSphere clientIn the option where you need to provision the harddisk for the new VM, choose 'Use an existing virtual disk'Browse and point the newly cloned vmdk file

Failed to start a VMware virtual machine


When you Power On a VM, you will be greeted with the below error message:
'Failed to start the virtual machine.
Module DevicePowerOn power on failed. Unable to create virtual SCSI device for scsi0:0, '/vmfs/volumes/...........vmdk' Failed to open disk scsi0:0: Unsupported or invalid disk type 7. Ensure that the disk has been imported.'


This will occur when you

How to shrink size of a vmdk file in ESXi 5.0?

When we try to reduce or shrink the size of an existing vmdk file, the operation fails.
There is no option to reduce the size using vSphere client. For this you may need to use putty or cli. Please remember to delete unwanted data from the OS and to shrink the partition internally using the diskmgmt.msc tool. After shrinking , perform the below:

How to reclaim size of a thin provisioned vmdk file in ESXi 5.0?


When we use thin provisioned vmdk, the size of the vmdk expands as we pile up data in the OS. But if we delete some data from OS, the reclaimed space in the OS will not be reclaimed from the vmdk. It will continue to occupy the maximum space it have ever used after creation.

Resizing an IDE virtual disk

Remove the IDE vmdk from the VMEdit the “vmdk” file (can be found under cd /vmfs/volumes/<datastore_name>/<vm_name>/)Change ddb.adapterType from “ide” to “lsilogic”Add the IDE vmdk to the VMChange the size of the diskRemove the IDE vmdk from the VMEdit the “vmdk” file Change ddb.adapterType from “lsilogic” to “ide”Add the IDE vmdk to the VMPower on the VM and “extend” the partition within Windows 7
Thanks for Duncan Epping's blog.

VM disk cannot be resized- Failed to extend the disk


-With the vSphere Client, if you edit a VM's settings and then select one of its virtual disks, the option to resize the disk is greyed out.
-When trying to extend the disk using vmkftools for resizing, you will receive the below error:
Failed to extend the disk. Failed to lock the file.
-When you extend the disk using vsphere client, the change is not getting reflected.

Root cause:-

The VM will be having a snapshot. Because when a snaphot is taken the actual VMDK file will be locked and the changes will be written to a new delta file. Due to this reason, the actual VMDK file could not be resized. 

Another possible reason: If the disk is IDE, the change may not get reflected. The resolution step for this issue is mentioned here 


Remove the snapshot file and then try to resize.