1. Navigate to Virtual Machine path from your ESX SSH session
cd /vmfs/volumes/Datastore_name/VM_Name
2. Edit the VM_Name.vmdk file using Nano or vi editor,
Below is the content of .vmdk file.
Let us understand what it is and how do we understand disk size. In the above screenshot, Size of the disk shows 83886080. How it is calculated. It is nothing but 40 GB.
40 GB = 40*1024*1024*1024/512 = 83886080
The below GUI snap confirms that VM has 40 GB assigned vmdk..
Lets say for 50 GB = 50*1024*1024*1024/512 = 104857600
To shrink the disk , Edit the descriptor file by vi VM_Name.vmdk ie. vi test.vmdk
Under extent description replace value between RW _ _ _ _ _ VMFS *-flat.vmdk. In my case it was 40GB disk assigned and hence the value was 83886080. I want to reduce the vmdk by 10 GB so after the shrink vmdk size should be 30GB.
So for 30 GB, use the below mentioned calculation
30(1024*1024*1024)/512 = 62914560 and save the file. svmotion the vm to forth and back then VM properties now reflect the new size of the disk 30 GB
I hope the above steps are helpful for you. Thanks for reading !!!