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…. icon cool How To Shrink VMware Virtual Disk Files and disable shrinking

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.
shrink virtual disk to gain place vmdk How To Shrink VMware Virtual Disk Files and disable shrinking
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.
shrink virtual disk to gain place vmdk not possible when snapshot How To Shrink VMware Virtual Disk Files and disable shrinking

Source: VMware KB Article: 1010941



Comments

  1. says

    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