How To Shrink VMware Virtual Disk Files and disable shrinking
Sometimes you just want to disable shrinking of VMdk for certain VMs. How do you do that?
Before you get started you should know that, if this is done repeatedly, the virtual disk can become unavailable, effectively causing a denial of service. so In most datacenter environments, disk shrinking – no. So you can disable this feature. Especially if some people (even with no administrative privileges) can do that, so you better make sure….
Normal users and processes—that is users and processes without root or administrator privileges—within virtual machines have the capability to invoke this procedure.
What does Shrinking?
Shrinking a virtual disk reclaims unused space in the virtual disk. It means that, if there is empty space in the disk, this process reduces the amount of space the virtual disk occupies on the host drive.
Before you edit the .vmx file:
01. Always power off the virtual machine.
02. Make sure you are logged on as a user with the correct permission level to edit the file.
03. Make a backup copy of the .vmx file. If your edits break the virtual machine, you can just roll back to the original version of the file.

To disable disk shrink for a virtual machine:
01. Power off the virtual machine and remove the virtual machine from the inventory.
02. Edit the virtual machine’s .vmx file and add the following lines:
isolation.tools.diskWiper.disable = “TRUE”isolation.tools.diskShrink.disable = “TRUE”
03. Power on the virtual machine and re-add the virtual machine to the inventory.

Source: VMware KB Article: 1010941
4 Comments
Leave a Reply
Other posts from Server Virtualization
- Create your own Provider Virtual Data Center
- Measure some perf benchs with VMark
- VMware partners with Symantec on ApplicationHA
- Andre Leibovici's Linked cloning storage calculator
- SIOC yes, but not in the SMB kit...
- Best practices KB on how-to install ESX 4.1 and vCenter
- Hyper-V and new linux integration tools
- How to Fix “Transaction log for database ‘VIM_VCDB’ is full” errors
- How to change from ACPI Multiprocessor HAL back to ACPI Uniprocessor HAL in Windows 2003
- AD Integration for ESXi 4.1
- vCenter converter with Hyper-V import
- Serial Port handling in ESXi 4.1
- Four memory optimization techniques available in vSphere 4.1
- Activating remote access via SSH in ESXi4.1
- vSphere Compatibility Matrixes
- 150 new features or enhancements in vSphere 4.1
- Personalized install of VMware tools
- VMware tools download from VMware Website
- How to change virtual SCSI controler
- Microsoft's patch for .NET breaks VI client connection






















You can go even deeper in hardening your VMX file… Have a look at this article http://virtualfoundry.blogspot.com/2009/04/hardening-vmx-file.html
This one is for the paranoiacs…. -:) Sure you can go really far wit that. Thanks.
Hi Vladan,
Thanks for this useful, easy to follow article.
Do you think reducing the size that a VM occupies on the phsyical disk will also assist in any VMDK level fragmentation on the disk?
Cheers,
Simon
Simon,
I would say that after a shrink done, you should run a defrag inside of the VM. And also by using thin provisionning can help since,
“A preallocated disk avoids fragmentation at the .vmdk file level.”
They’re are some tips on Fusion blog too…
http://blogs.vmware.com/teamfusion/2008/10/tip-defragmenta.html