VMWare ESXi guest – Reduce hard disk size

Everyone knows its easy to increased hard disk size, you just need to type in the amount in GB and expand the size in the OS level. But to reduce it is not straight forward, but can be done.

For example, you have a windows guest machine with c:\20o gb HDD, and you wish to reduce this to 100 gb.

Step 1 : Shrink the C drive in the windows OS to 100 gb and delete the partition and make it free for use.

Step 2: Power off the VMWare guest machine.

Step 3: Open putty and connect to the datastore where the vmware guest machine resides, /vmfs/volumes/..etc….

Step 4: using cat or Vi, open the file named *.VMDK (VMname.VMDK). under extent description, you will find RW 419430400 . The number after RW defines the size of the VMWare guest disk.

The number 419430400 is calculated as follows :

200 GB = 200 * 1024 *1024 *1024 / 512 = 419430400

Step 5: We need to reduce the VMDK file size to 100 GB , so we have to do calculation to find out

100 GB = 100 * 1024 *1024 *1024 / 512 = 209715200

Using Vi , edit the value in the *.VMDk file to 209715200  and save it.

Step 6: Reboot the Guest and you will see that the size of the VMWare guest has been reduced to 100 GB.





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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