This articles is published 383 days ago and last updated 383 days ago, some information may be out of date.

How to Shrink VMDK Virtual Disk Size on VMWare ESXi



Expanding the capacity of VM disks is easy, but shrinking their size is not straightforward on VMWare ESXi GUI.

Here, we will perform an action to reduce the disk size on VMWare ESXi using the command line.

Step-by-Step Guide

1. Shutdown the VM

Power off the virtual machine that contains the virtual disk you want to shrink and note that all snapshots of the VM need to be deleted before starting the action.

2. Enable SSH service on VMWare ESXi


3. Shrink VMDK Size on VMWare ESXi

Login to ESXi SSH console via Putty or other SSH client software.

Enter the VM storage directory (e.g., "/vmfs/volumes/Datastorage/").


Edit the file named "hostname.vmdk" using a text editor (e.g. vi VM_TEST.vmdk).

In this case, the edited file was "VM_TEST.vmdk".


Locate the "# Extent description" of the content, which is shown below:

# Extent description
RW 209715200 VMFS "VM_TEST-flat.vmdk"

Suppose the VM's HDD current size is 100GB, which is equivalent to 209715200 of content. We would like to reduce the size by 40GB, which means shrinking it to 60GB. The new content number is "209715200 - (40*1024*1024) = 125829120".

Update the content of VM_TEST.vmdk to:


RW 125829120 VMFS "VM_TEST-flat.vmdk"

Save and close the text editor.

4. Start the VM

Power on the virtual machine and log in to the guest OS.

Open the "Disk Management".



The volume size is still 100GB, so take a "Shrink Volume..." action of the virtual disk.


Now, the virtual disk has been successfully shrunk to the new size.

5. Fix the Display Size (Optional)



The STORAGE of the instance still displays 100GB, but the actual size has been shrunk to 60GB.


To fix this, export and import the VM by OVF TOOL.

Export the VM

ovftool.exe vi://root:"P@ssw0rd"@vms01/VM_TEST c:\tools\VM_TEST.ova

Import the VM

ovftool.exe --sourceType=OVA -n=VM_TEST -ds=Datastorage "c:\tools\VM_TEST.ova" vi://root:"P@ssw0rd"@vms01


To shrink the size of a VMDK virtual disk on VMWare ESXi using the command line. The guide is easy to follow but caution should be exercised and backups should be made before proceeding with the steps.


There're 2 comments