VMware Cloud Community
Sconnelly2001
Contributor
Contributor

Does anyone know how to shrink a VMDK file of a CENTOS server

We currently have an image that has been built using CentOS op sys.  Originally it was set to have two VMDK disks of 80GBs each.

However we have now managed to optimise the CentOS operating system down to 40GBs each, however we are having problems trying to shrink the VMDK files down.

If we use VMWare converter and change the values of the VMDKs and then click ok and convert they are still the same size.

Please if someone could point me in the right direction to resolve this issue that would be great.

I would have thought that there would perhaps be a third party application that would be able restore the CentOS server into a smaller VMDK file.

Any assistance would be greatly appreciated.

0 Kudos
4 Replies
Praveenmna
Enthusiast
Enthusiast

Have you try to do V2V and during the course try to shrink the disk size.

If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points. Praveen P Senior Support Engineer
0 Kudos
Sconnelly2001
Contributor
Contributor

Many thanks for your reply.

So when we run the converter it allows us to change the value of the drives from 85GB down to 45GBs, but at the end of the conversion the drives are still 85GB.

On the Centos side the engineer has shruken the data down to 45 GBs roughly on each VMDK.  The VMDK files have a large amount of empty disk space.

Do you think that VMKFSTools might be able to assist with?

0 Kudos
Praveenmna
Enthusiast
Enthusiast

Found an article which has the same requirement. Make sure to take complete backup if you are trying this.

http://professionalvmware.com/2009/09/how-to-shrink-a-vmdk-file-in-esx/

If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points. Praveen P Senior Support Engineer
0 Kudos
Sconnelly2001
Contributor
Contributor

Many thanks Ill give that a try and let you know how I get on.

Summary

vi or nano the [VMDKName]-Flat.vmdk file

Edit the following entry to match the desired disk size divisable by 512.

RW 41943040 VMFS "VMDKNAME-FLAT.vmdk"

Then run

Vmkfstools –i [vmdk_Disk_Name] to clone the VMDK and shrink the overall size.



0 Kudos