How to Shrink VMDK File of VM in VSphere

How to Shrink VMDK Using (AIOM Partition Assistant) Software

 Step 1: Shrink the VM Disk at Hypervisor

  • Shut down the Virtual Machine
  • SSH to ESXi Server console, where virtual machine resides. Navigate to Virtual Machine path
#cd /vmfs/volumes/Datastore_name/VM_Name
  • Edit the “VM_Name.vmdk” file using “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 8 GB.

8 GB = 8*1024*1024*1024/512 = 16777216

The below GUI snap confirms that VM has 8 GB assigned vmdk..


  • To shrink the disk, Edit the descriptor file VM_Name.vmdk ie. test.vmdk.
# cp test.vmdk test.vmdk.bkup (take backup)
# vi test.vmdk

Under extent description replace value between RW _ _ _ _ _ VMFS *-flat.vmdk. In my case it was 8GB disk assigned and hence the value was 83886080. I want to reduce the vmdk by 2 GB so after the shrink vmdk size should be 6GB.

So for 6 GB, use the below mentioned calculation

6(1024*1024*1024)/512 = 12582912 and save the file.


  • Use SVMontion (Move VM from one datastore to another and back). Then VM properties reflect the new size of the disk 6 GB as shown below.


 Step 2: Shrink the Underling Guest OS Disk

  • Power on the VM
  • Check the partition size, specially the one which you want to shrink. You will see total capacity is still “8 GB”.
  • Download and install AOMEI Partition Assistant Standard (Freeware) from
  • After install run the software. You will see in figure disk already showing “6 GB”. To fix the issue
  • Right click on the disk which you want to shrink and choose “resize partition”


  • Here is the tricky part, shrink the disk from “6GB” to “4GB”, press “OK”.


  • It will reboot and then come back.
  • After booting. Open the software, you will see “2GB” is unallocated. Right click on the unallocated partition and choose “merge partitions”


  • Choose the drive in with you want to shown below. Press “OK”


  • Now select the disk and choose “apply”.


  • Now close the software and check the Total size of disk. Which is exactly the same as we want.




Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s